diff options
| author | Ethan Morgan <ethan@gweithio.com> | 2026-02-14 16:44:06 +0000 |
|---|---|---|
| committer | Ethan Morgan <ethan@gweithio.com> | 2026-02-14 16:44:06 +0000 |
| commit | 54409423f767d8b1cf30cb7d0efca6b4ca138823 (patch) | |
| tree | d915ac7828703ce4b963efdd9728a1777ba18c1e /vcpkg/ports/openssl/unix | |
Diffstat (limited to 'vcpkg/ports/openssl/unix')
| -rw-r--r-- | vcpkg/ports/openssl/unix/android-cc.patch | 20 | ||||
| -rwxr-xr-x | vcpkg/ports/openssl/unix/configure | 31 | ||||
| -rw-r--r-- | vcpkg/ports/openssl/unix/move-openssldir.patch | 16 | ||||
| -rw-r--r-- | vcpkg/ports/openssl/unix/no-empty-dirs.patch | 22 | ||||
| -rw-r--r-- | vcpkg/ports/openssl/unix/no-static-libs-for-shared.patch | 12 | ||||
| -rw-r--r-- | vcpkg/ports/openssl/unix/portfile.cmake | 172 | ||||
| -rw-r--r-- | vcpkg/ports/openssl/unix/remove-deps.cmake | 7 |
7 files changed, 280 insertions, 0 deletions
diff --git a/vcpkg/ports/openssl/unix/android-cc.patch b/vcpkg/ports/openssl/unix/android-cc.patch new file mode 100644 index 0000000..f4c3d68 --- /dev/null +++ b/vcpkg/ports/openssl/unix/android-cc.patch @@ -0,0 +1,20 @@ +diff --git a/Configurations/15-android.conf b/Configurations/15-android.conf +index 41ad922..d15e34c 100644 +--- a/Configurations/15-android.conf ++++ b/Configurations/15-android.conf +@@ -102,6 +102,7 @@ + my $cflags; + my $cppflags; + ++if (0) { + # see if there is NDK clang on $PATH, "universal" or "standalone" + if (which("clang") =~ m|^$ndk/.*/prebuilt/([^/]+)/|) { + my $host=$1; +@@ -158,6 +159,7 @@ + $sysroot =~ s|^$ndk/||; + $sysroot = " --sysroot=\$($ndk_var)/$sysroot"; + } ++} + $android_ndk = { + cflags => $cflags . $sysroot, + cppflags => $cppflags, diff --git a/vcpkg/ports/openssl/unix/configure b/vcpkg/ports/openssl/unix/configure new file mode 100755 index 0000000..2d49b3d --- /dev/null +++ b/vcpkg/ports/openssl/unix/configure @@ -0,0 +1,31 @@ +#!/usr/bin/env bash + +set -e + +declare -a OUT_OPTIONS + +INTERPRETER=perl + +LAST_SEEN= +COPY_OPTIONS=no +for OPTION; do + case "${OPTION},${COPY_OPTIONS}" in + */Configure,no) + OUT_OPTIONS+=("${OPTION}") + INTERPRETER="${LAST_SEEN}" + COPY_OPTIONS=yes + ;; + --prefix=*|--openssldir=*|--libdir=*|--cross-compile-prefix=*|--debug,*) + OUT_OPTIONS+=("${OPTION}") + ;; + -*|*=*) + ;; + *,yes) + OUT_OPTIONS+=("${OPTION}") + ;; + esac + LAST_SEEN="${OPTION}" +done + +set -x +"${INTERPRETER}" ${OUT_OPTIONS[@]} diff --git a/vcpkg/ports/openssl/unix/move-openssldir.patch b/vcpkg/ports/openssl/unix/move-openssldir.patch new file mode 100644 index 0000000..2a39bdb --- /dev/null +++ b/vcpkg/ports/openssl/unix/move-openssldir.patch @@ -0,0 +1,16 @@ +diff --git a/Configurations/unix-Makefile.tmpl b/Configurations/unix-Makefile.tmpl +index c82c086..6c5402d 100644 +--- a/Configurations/unix-Makefile.tmpl ++++ b/Configurations/unix-Makefile.tmpl +@@ -690,6 +690,11 @@ install_ssldirs: + chmod 644 "$(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf"; \ + fi + ++ $(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(INSTALLTOP)$(OPENSSLDIR) ++ for I in $(DESTDIR)$(OPENSSLDIR)/*; do \ ++ mv $$I $(DESTDIR)$(INSTALLTOP)$(OPENSSLDIR)/; \ ++ done ++ + install_dev: install_runtime_libs + @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1) + @$(ECHO) "*** Installing development files" diff --git a/vcpkg/ports/openssl/unix/no-empty-dirs.patch b/vcpkg/ports/openssl/unix/no-empty-dirs.patch new file mode 100644 index 0000000..7cf0cf0 --- /dev/null +++ b/vcpkg/ports/openssl/unix/no-empty-dirs.patch @@ -0,0 +1,22 @@ +diff --git a/Configurations/unix-Makefile.tmpl b/Configurations/unix-Makefile.tmpl +index 6c5402d..fc982df 100644 +--- a/Configurations/unix-Makefile.tmpl ++++ b/Configurations/unix-Makefile.tmpl +@@ -823,7 +823,7 @@ _install_modules_deps: install_runtime_libs build_modules + + install_engines: _install_modules_deps + @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1) +- @$(PERL) $(SRCDIR)/util/mkdir-p.pl "$(DESTDIR)$(ENGINESDIR)/" ++ @[ -z "$(INSTALL_ENGINES)" ] || $(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(ENGINESDIR)/ + @$(ECHO) "*** Installing engines" + @set -e; for e in dummy $(INSTALL_ENGINES); do \ + if [ "$$e" = "dummy" ]; then continue; fi; \ +@@ -847,7 +847,7 @@ uninstall_engines: + + install_modules: _install_modules_deps + @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1) +- @$(PERL) $(SRCDIR)/util/mkdir-p.pl "$(DESTDIR)$(MODULESDIR)/" ++ @[ -z "$(INSTALL_MODULES)" ] || $(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(MODULESDIR)/ + @$(ECHO) "*** Installing modules" + @set -e; for e in dummy $(INSTALL_MODULES); do \ + if [ "$$e" = "dummy" ]; then continue; fi; \ diff --git a/vcpkg/ports/openssl/unix/no-static-libs-for-shared.patch b/vcpkg/ports/openssl/unix/no-static-libs-for-shared.patch new file mode 100644 index 0000000..d6aa34c --- /dev/null +++ b/vcpkg/ports/openssl/unix/no-static-libs-for-shared.patch @@ -0,0 +1,12 @@ +diff --git a/Configurations/unix-Makefile.tmpl b/Configurations/unix-Makefile.tmpl +index fc982df..10f1c54 100644 +--- a/Configurations/unix-Makefile.tmpl ++++ b/Configurations/unix-Makefile.tmpl +@@ -713,6 +713,7 @@ install_dev: install_runtime_libs + done + @$(PERL) $(SRCDIR)/util/mkdir-p.pl "$(DESTDIR)$(libdir)" + @set -e; for l in $(INSTALL_LIBS); do \ ++ if [ -n "$(INSTALL_SHLIBS)" ] ; then continue ; fi ; \ + fn=`basename $$l`; \ + $(ECHO) "install $$l -> $(DESTDIR)$(libdir)/$$fn"; \ + cp $$l "$(DESTDIR)$(libdir)/$$fn.new"; \ diff --git a/vcpkg/ports/openssl/unix/portfile.cmake b/vcpkg/ports/openssl/unix/portfile.cmake new file mode 100644 index 0000000..9127824 --- /dev/null +++ b/vcpkg/ports/openssl/unix/portfile.cmake @@ -0,0 +1,172 @@ +if (VCPKG_TARGET_IS_LINUX) + message(NOTICE [[ +openssl requires Linux kernel headers from the system package manager. + They can be installed on Alpine systems via `apk add linux-headers`. + They can be installed on Ubuntu systems via `apt install linux-libc-dev`. +]]) +endif() + +if(VCPKG_HOST_IS_WINDOWS) + vcpkg_acquire_msys(MSYS_ROOT PACKAGES make perl) + set(MAKE "${MSYS_ROOT}/usr/bin/make.exe") + set(PERL "${MSYS_ROOT}/usr/bin/perl.exe") +else() + find_program(MAKE make) + if(NOT MAKE) + message(FATAL_ERROR "Could not find make. Please install it through your package manager.") + endif() + vcpkg_find_acquire_program(PERL) +endif() +set(INTERPRETER "${PERL}") + +execute_process( + COMMAND "${PERL}" -e "use IPC::Cmd;" + RESULT_VARIABLE perl_ipc_cmd_result +) +if(NOT perl_ipc_cmd_result STREQUAL "0") + message(FATAL_ERROR "\nPerl cannot find IPC::Cmd. Please install it through your system package manager.\n") +endif() + +# Ideally, OpenSSL should use `CC` from vcpkg as is (absolute path). +# But in reality, OpenSSL expects to locate the compiler via `PATH`, +# and it makes its own choices e.g. for Android. +vcpkg_cmake_get_vars(cmake_vars_file) +include("${cmake_vars_file}") +cmake_path(GET VCPKG_DETECTED_CMAKE_C_COMPILER PARENT_PATH compiler_path) +cmake_path(GET VCPKG_DETECTED_CMAKE_C_COMPILER FILENAME compiler_name) +find_program(compiler_in_path NAMES "${compiler_name}" PATHS ENV PATH NO_DEFAULT_PATH) +if(NOT compiler_in_path) + vcpkg_host_path_list(APPEND ENV{PATH} "${compiler_path}") +elseif(NOT compiler_in_path STREQUAL VCPKG_DETECTED_CMAKE_C_COMPILER) + vcpkg_host_path_list(PREPEND ENV{PATH} "${compiler_path}") +endif() + +vcpkg_list(SET MAKEFILE_OPTIONS) +if(VCPKG_TARGET_IS_ANDROID) + set(ENV{ANDROID_NDK_ROOT} "${VCPKG_DETECTED_CMAKE_ANDROID_NDK}") + set(OPENSSL_ARCH "android-${VCPKG_DETECTED_CMAKE_ANDROID_ARCH}") + if(VCPKG_DETECTED_CMAKE_ANDROID_ARCH STREQUAL "arm" AND NOT VCPKG_DETECTED_CMAKE_ANDROID_ARM_NEON) + vcpkg_list(APPEND CONFIGURE_OPTIONS no-asm) + endif() +elseif(VCPKG_TARGET_IS_LINUX) + if(VCPKG_TARGET_ARCHITECTURE MATCHES "arm64") + set(OPENSSL_ARCH linux-aarch64) + elseif(VCPKG_TARGET_ARCHITECTURE MATCHES "arm") + set(OPENSSL_ARCH linux-armv4) + elseif(VCPKG_TARGET_ARCHITECTURE MATCHES "x64") + set(OPENSSL_ARCH linux-x86_64) + elseif(VCPKG_TARGET_ARCHITECTURE MATCHES "x86") + set(OPENSSL_ARCH linux-x86) + else() + set(OPENSSL_ARCH linux-generic32) + endif() +elseif(VCPKG_TARGET_IS_IOS) + if(VCPKG_TARGET_ARCHITECTURE MATCHES "arm64") + set(OPENSSL_ARCH ios64-xcrun) + elseif(VCPKG_TARGET_ARCHITECTURE MATCHES "arm") + set(OPENSSL_ARCH ios-xcrun) + elseif(VCPKG_TARGET_ARCHITECTURE MATCHES "x86" OR VCPKG_TARGET_ARCHITECTURE MATCHES "x64") + set(OPENSSL_ARCH iossimulator-xcrun) + else() + message(FATAL_ERROR "Unknown iOS target architecture: ${VCPKG_TARGET_ARCHITECTURE}") + endif() + # disable that makes linkage error (e.g. require stderr usage) + list(APPEND CONFIGURE_OPTIONS no-ui no-asm) +elseif(VCPKG_TARGET_IS_TVOS OR VCPKG_TARGET_IS_WATCHOS) + set(OPENSSL_ARCH iphoneos-cross) + # disable that makes linkage error (e.g. require stderr usage) + list(APPEND CONFIGURE_OPTIONS no-ui no-asm) +elseif(VCPKG_TARGET_IS_OSX) + if(VCPKG_TARGET_ARCHITECTURE MATCHES "arm64") + set(OPENSSL_ARCH darwin64-arm64) + else() + set(OPENSSL_ARCH darwin64-x86_64) + endif() +elseif(VCPKG_TARGET_IS_BSD) + set(OPENSSL_ARCH BSD-nodef-generic64) +elseif(VCPKG_TARGET_IS_SOLARIS) + if(VCPKG_TARGET_ARCHITECTURE STREQUAL "x64") + set(OPENSSL_ARCH solaris64-x86_64-gcc) + else() + set(OPENSSL_ARCH solaris-x86-gcc) + endif() +elseif(VCPKG_TARGET_IS_MINGW) + if(VCPKG_TARGET_ARCHITECTURE STREQUAL "x64") + set(OPENSSL_ARCH mingw64) + elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "arm64") + set(OPENSSL_ARCH mingwarm64) + else() + set(OPENSSL_ARCH mingw) + endif() +elseif(VCPKG_TARGET_IS_EMSCRIPTEN) + set(OPENSSL_ARCH linux-x32) + vcpkg_list(APPEND CONFIGURE_OPTIONS + no-engine + no-asm + no-sse2 + no-srtp + --cross-compile-prefix= + ) + # Cf. https://emscripten.org/docs/porting/pthreads.html: + # For Pthreads support, not just openssl but everything + # must be compiled and linked with `-pthread`. + # This makes it a triplet/toolchain-wide setting. + if(NOT " ${VCPKG_DETECTED_CMAKE_C_FLAGS} " MATCHES " -pthread ") + vcpkg_list(APPEND CONFIGURE_OPTIONS no-threads) + endif() +else() + message(FATAL_ERROR "Unknown platform") +endif() + +file(MAKE_DIRECTORY "${SOURCE_PATH}/vcpkg") +file(COPY "${CMAKE_CURRENT_LIST_DIR}/configure" DESTINATION "${SOURCE_PATH}/vcpkg") +vcpkg_configure_make( + SOURCE_PATH "${SOURCE_PATH}" + PROJECT_SUBPATH "vcpkg" + NO_ADDITIONAL_PATHS + OPTIONS + "${INTERPRETER}" + "${SOURCE_PATH}/Configure" + ${OPENSSL_ARCH} + ${CONFIGURE_OPTIONS} + "--openssldir=/etc/ssl" + "--libdir=lib" + OPTIONS_DEBUG + --debug +) +vcpkg_install_make( + ${MAKEFILE_OPTIONS} + BUILD_TARGET build_inst_sw +) +vcpkg_fixup_pkgconfig() + +if("tools" IN_LIST FEATURES) + file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/tools/${PORT}") + file(RENAME "${CURRENT_PACKAGES_DIR}/bin/c_rehash" "${CURRENT_PACKAGES_DIR}/tools/${PORT}/c_rehash") + file(REMOVE "${CURRENT_PACKAGES_DIR}/debug/bin/c_rehash") + vcpkg_copy_tools(TOOL_NAMES openssl AUTO_CLEAN) +elseif(VCPKG_LIBRARY_LINKAGE STREQUAL "static" OR NOT VCPKG_TARGET_IS_WINDOWS) + file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/bin" "${CURRENT_PACKAGES_DIR}/debug/bin") + file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/etc/ssl/misc") +endif() + +file(TOUCH "${CURRENT_PACKAGES_DIR}/etc/ssl/certs/.keep") +file(TOUCH "${CURRENT_PACKAGES_DIR}/etc/ssl/private/.keep") + +file(REMOVE_RECURSE + "${CURRENT_PACKAGES_DIR}/debug/etc" + "${CURRENT_PACKAGES_DIR}/debug/include" + "${CURRENT_PACKAGES_DIR}/debug/share" +) + +# For consistency of mingw build with nmake build +file(GLOB engines "${CURRENT_PACKAGES_DIR}/lib/ossl-modules/*.dll") +if(NOT engines STREQUAL "") + file(COPY ${engines} DESTINATION "${CURRENT_PACKAGES_DIR}/bin") + file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/lib/ossl-modules") +endif() +file(GLOB engines "${CURRENT_PACKAGES_DIR}/debug/lib/ossl-modules/*.dll") +if(NOT engines STREQUAL "") + file(COPY ${engines} DESTINATION "${CURRENT_PACKAGES_DIR}/debug/bin") + file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/lib/ossl-modules") +endif() diff --git a/vcpkg/ports/openssl/unix/remove-deps.cmake b/vcpkg/ports/openssl/unix/remove-deps.cmake new file mode 100644 index 0000000..a57c70f --- /dev/null +++ b/vcpkg/ports/openssl/unix/remove-deps.cmake @@ -0,0 +1,7 @@ +file(GLOB_RECURSE MAKEFILES ${DIR}/*/Makefile)
+foreach(MAKEFILE ${MAKEFILES})
+ message("removing deps from ${MAKEFILE}")
+ file(READ "${MAKEFILE}" _contents)
+ string(REGEX REPLACE "\n# DO NOT DELETE THIS LINE.*" "" _contents "${_contents}")
+ file(WRITE "${MAKEFILE}" "${_contents}")
+endforeach()
|