From 12c352dfc9e6664d7cecad2c5192b87b0be6863e Mon Sep 17 00:00:00 2001 From: Andrew Kaster Date: Sat, 8 Jan 2022 23:37:02 -0700 Subject: [PATCH] Ports: Convert curl port to use CMake, remove two autoconf patches This removes the shlib hack from the install step, which repackaged the static library as the shared one. It also has the benefit of making the port work with the Clang toolchain :^). --- Ports/curl/package.sh | 23 +++++-- .../disable-prototype-mismatch-check.patch | 63 ------------------- Ports/curl/patches/fix-autoconf.patch | 11 ---- 3 files changed, 19 insertions(+), 78 deletions(-) delete mode 100644 Ports/curl/patches/disable-prototype-mismatch-check.patch delete mode 100644 Ports/curl/patches/fix-autoconf.patch diff --git a/Ports/curl/package.sh b/Ports/curl/package.sh index cb9e01b52a..bafc6b9cba 100755 --- a/Ports/curl/package.sh +++ b/Ports/curl/package.sh @@ -5,10 +5,25 @@ useconfigure=true files="https://curl.se/download/curl-${version}.tar.bz2 curl-${version}.tar.bz2 1e7a38d7018ec060f1f16df839854f0889e94e122c4cfa5d3a37c2dc56f1e258" auth_type=sha256 depends=("openssl" "zlib" "zstd") -configopts=("--disable-ntlm-wb" "--with-openssl=${SERENITY_INSTALL_ROOT}/usr/local" "--disable-symbol-hiding") +configopts=("-DCMAKE_TOOLCHAIN_FILE=${SERENITY_BUILD_DIR}/CMakeToolchain.txt") + +configure() { + mkdir -p curl-build + cmake -G Ninja \ + -S curl-${version} \ + -B curl-build \ + "${configopts[@]}" \ + -DCURL_USE_OPENSSL=ON \ + -DCURL_ZSTD=ON \ + -DCURL_DISABLE_NTLM=ON \ + -DCURL_DISABLE_TESTS=ON \ + -DCURL_HIDDEN_SYMBOLS=OFF +} + +build() { + ninja -C curl-build +} install() { - run make DESTDIR=${SERENITY_INSTALL_ROOT} "${installopts[@]}" install - ${CC} -shared -o ${SERENITY_INSTALL_ROOT}/usr/local/lib/libcurl.so -Wl,-soname,libcurl.so -Wl,--whole-archive ${SERENITY_INSTALL_ROOT}/usr/local/lib/libcurl.a -Wl,--no-whole-archive -lzstd - rm -f ${SERENITY_INSTALL_ROOT}/usr/local/lib/libcurl.la + ninja -C curl-build install } diff --git a/Ports/curl/patches/disable-prototype-mismatch-check.patch b/Ports/curl/patches/disable-prototype-mismatch-check.patch deleted file mode 100644 index 977a31f53b..0000000000 --- a/Ports/curl/patches/disable-prototype-mismatch-check.patch +++ /dev/null @@ -1,63 +0,0 @@ ---- curl-7.81.0/configure.orig 2022-01-08 01:39:27.339369369 +0000 -+++ curl-7.81.0/configure 2022-01-08 01:40:30.218717020 +0000 -@@ -19836,50 +19836,8 @@ - rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext - - -- { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if compiler halts on function prototype mismatch" >&5 --printf %s "checking if compiler halts on function prototype mismatch... " >&6; } -- cat confdefs.h - <<_ACEOF >conftest.$ac_ext --/* end confdefs.h. */ - - --# include -- int rand(int n); -- int rand(int n) -- { -- if(n) -- return ++n; -- else -- return n; -- } -- --int main (void) --{ -- -- int i[2]={0,0}; -- int j = rand(i[0]); -- if(j) -- return j; -- -- ; -- return 0; --} -- --_ACEOF --if ac_fn_c_try_compile "$LINENO" --then : -- -- { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 --printf "%s\n" "no" >&6; } -- as_fn_error $? "compiler does not halt on function prototype mismatch." "$LINENO" 5 -- --else $as_nop -- -- { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 --printf "%s\n" "yes" >&6; } -- --fi --rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext -- - - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if compiler supports hiding library internal symbols" >&5 - printf %s "checking if compiler supports hiding library internal symbols... " >&6; } ---- curl-7.81.0/configure.ac.orig 2022-01-08 01:42:45.505315507 +0000 -+++ curl-7.81.0/configure.ac 2022-01-08 01:42:47.917290542 +0000 -@@ -420,7 +420,6 @@ - - CURL_CHECK_COMPILER_HALT_ON_ERROR - CURL_CHECK_COMPILER_ARRAY_SIZE_NEGATIVE --CURL_CHECK_COMPILER_PROTOTYPE_MISMATCH - CURL_CHECK_COMPILER_SYMBOL_HIDING - - CURL_CHECK_CURLDEBUG diff --git a/Ports/curl/patches/fix-autoconf.patch b/Ports/curl/patches/fix-autoconf.patch deleted file mode 100644 index fa58287574..0000000000 --- a/Ports/curl/patches/fix-autoconf.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- curl-7.81.0/config.sub.orig 2022-01-08 01:37:56.256315591 +0000 -+++ curl-7.81.0/config.sub 2022-01-08 01:38:02.352252211 +0000 -@@ -1368,7 +1368,7 @@ - | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \ - | -sym* | -kopensolaris* | -plan9* \ - | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ -- | -aos* | -aros* | -cloudabi* | -sortix* \ -+ | -aos* | -aros* | -cloudabi* | -sortix* | -serenity* \ - | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ - | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ - | -hiux* | -knetbsd* | -mirbsd* | -netbsd* \