### this file is sourced not run
PKGBUILD=1
PKGARCH=x86_64

# source: james

# release tarball
#PKGVER=
#TARBALL=
#MD5SUM=
#SRC_URL=
BUNDLE=

# git-master tarball
PKGVER=2024.04 # pull date
#MD5SUM=
#hash=6ffff18602bd166c4cd8c5e2dfb8cd020ef40962
#hash7=${hash#???????}; hash7=${hash%$hash7}
#TARBALL=flexisip-$PKGVER-$hash7.tar.gz
#SRC_URL=https://github.com/BelledonneCommunications/flexisip/archive/$hash.tar.gz
# we don't use directly, since it needed 2GB worth of submodules

SLACKREQ='libjansson libnghttp2 libxerces-c mariadb postgresql redis' # build-time pyhon3-pystache python3-six git
SLACKDESC="flexisip: flexisip $PKGVER (SIP Server)
flexisip: 
flexisip: Flexisip is a complete and scalable SIP server suite that includes 
flexisip: several modules: a proxy, a presence server, a conference server, a 
flexisip: back-to-back user agent, and Flexisip account manager for the 
flexisip: creation and administration of SIP accounts.
flexisip: 
flexisip: https://www.linphone.org/flexisip-server
flexisip: 
flexisip: 
flexisip: 
"

### default pkg_download
### prepare
pkg_prepare() {
	if [ -d /mnt/sdc1/flexisip-git ]; then
		echo "Copying sources to build directory ..."
		cp -a /mnt/sdc1/flexisip-git tmp
	else
		echo "Source not available"
		return 1
	fi
}

### default pkg_package
### build
pkg_build() {
	CMAKEFLAGS="$CMAKEFLAGS       \
		-DENABLE_SNMP=OFF         \
		-DINTERNAL_LIBHIREDIS=ON  \
		-DINTERNAL_JSONCPP=ON     \
		-DENABLE_B2BUA=ON         \
		-DENABLE_SOCI_POSTGRESQL_BACKEND=ON \
		-DENABLE_SPECIFIC_FEATURES=OFF      \
		-DCMAKE_INSTALL_PREFIX=/opt/flexisip-2024.04 \
		-DCMAKE_BUILD_TYPE=Release \
		-DSYSCONF_INSTALL_DIR=/etc \
	" &&
	pkg_build_cmake &&
	pkg_build_slackdesc	
}
