### this file is sourced not run
PKGVER=8.4.0
PKGBUILD=1
PKGARCH=i686

# source: BLFS 8.2 updated to latest
TARBALL=curl-$PKGVER.tar.xz
MD5SUM=8424597f247da68b6041dd7f9ca367fe
SRC_URL=http://curl.haxx.se/download/$TARBALL
BUNDLE=

SLACKREQ='openssl32 libssh2_32 librtmp32 libidn2_32 zstd32 brotli32' # libc-ares32 (build-time only)
SLACKDESC="curl32: curl32 $PKGVER (Versatile file transfer)  
curl32:  
curl32: The cURL package contains an utility and a library used for transferring 
curl32: files both download and *upload* with URL syntax to any of the following 
curl32: protocols: DICT FILE FTP FTPS GOPHER HTTP HTTPS IMAP IMAPS POP3 POP3S 
curl32: RTSP SCP SFTP SMTP SMTPS TELNET TFTP SSH SMB/CIFS.
curl32: 
curl32: This contains the 32-bit version of the library
curl32: 
curl32: https://curl.haxx.se/
curl32: 
"

### default pkg_download
### default pkg_prepare
### package - only collect the libraries
pkg_package() {
	rm -rf bin sbin usr/bin usr/sbin usr/include usr/share etc
	mkdir -p usr/bin usr/include/curl &&
	mv -v tmp/curl-config-32 usr/bin
}

### build
pkg_build() {

	# threaded-resolver much faster and more stable than c-ares	
	#CONFFLAGS="$CONFFLAGS --disable-static --disable-threaded-resolver --enable-ares \
	#--enable-smb --with-libssh2 \
	#--with-openssl --with-ca-path=/etc/ssl/certs"

	CONFFLAGS="$CONFFLAGS --disable-static --enable-threaded-resolver --disable-ares \
	--enable-smb --with-libssh2 \
	--with-openssl --with-ca-path=/etc/ssl/certs"	

	pkg_build_autoconf && 
	ln -sf /usr/$LIBDIR/libcurl.so.4.8.0 /usr/$LIBDIR/libcurl.so.3 && # Some games link to the older curl.

	pkg_build_slackdesc &&

	# CBLFS multilib patch
	mv -v /usr/bin/curl-config /tmp/curl-config-32
}


