From 7af3ffee250c3b9a46ffccd013417a34c00fb0b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20Hohnst=C3=A4dt?= Date: Sat, 24 Apr 2021 11:00:17 +0200 Subject: [PATCH] Make the macOS SDK release a configure option Write the Release to LSMinimumSystemVersion Pick the macos animal-name and add it as extra version Re-add building OpenSSL and libtool with the correct macos SDK version. Now after having called build-mac.sh script, building with "make" in the xca-macbuild dir works as expected. --- Local.mak.in | 1 + OpenSSL.version | 2 +- configure.ac | 20 ++++++++++++++++++++ misc/Info.plist.in | 2 ++ misc/build-mac.sh | 45 +++++++++++++++++++++++++++++++++++++++++++-- 5 files changed, 67 insertions(+), 3 deletions(-) diff --git a/Local.mak.in b/Local.mak.in index 24c058c1..1e4166b9 100644 --- a/Local.mak.in +++ b/Local.mak.in @@ -9,6 +9,7 @@ export HOST=@HOST@ CPPFLAGS+=-Wall -Wextra -DXCA_PREFIX=\"${xca_prefix}\" -DETC=\"@sysconfdir@\" -DDOCDIR=\"@docdir@\" CFLAGS+=-O2 -ggdb -std=c++11 @CXXFLAGS@ LIBS=@LIBS@ +EXTRA_VERSION=@EXTRA_VERSION@ MOC=@QT_MOC@ UIC=@QT_UIC@ diff --git a/OpenSSL.version b/OpenSSL.version index 7b0e5723..4668eba7 100644 --- a/OpenSSL.version +++ b/OpenSSL.version @@ -1 +1 @@ -openssl-1.1.1g +openssl-1.1.1k diff --git a/configure.ac b/configure.ac index 4ffa49e6..d84b9085 100644 --- a/configure.ac +++ b/configure.ac @@ -19,6 +19,26 @@ AC_CHECK_TOOL(WINDRES, [windres], [:]) VERSIONHASH="$(echo "${PACKAGE_VERSION}" | shasum | cut -b -12)" AC_SUBST([VERSIONHASH]) +AC_ARG_WITH([macos-version], + AS_HELP_STRING([--with-macos-version], [Select macOS minimum SDK version]), + [ MACOS_VERSION="$withval" + CXXFLAGS="${CXXFLAGS} -mmacosx-version-min=$MACOS_VERSION" + case "$withval" in + 10.10) EXTRA_VERSION=-Yosemite ;; + 10.11) EXTRA_VERSION=-El-Capitan ;; + 10.12) EXTRA_VERSION=-Sierra ;; + 10.13) EXTRA_VERSION=-High-Sierra ;; + 10.14) EXTRA_VERSION=-Mojave ;; + 10.15) EXTRA_VERSION=-Catalina ;; + 11.00) EXTRA_VERSION=-Big-Sur ;; + *) echo "Unknown macOS Version $withval" + exit 1 ;; + esac + ] +) +AC_SUBST([EXTRA_VERSION]) +AC_SUBST([MACOS_VERSION]) + if test -d "$INSTALL_DIR"; then AC_MSG_NOTICE([Using INSTALL_DIR $INSTALL_DIR]) test -d "${INSTALL_DIR}/include" && CXXFLAGS="${CXXFLAGS} -I${INSTALL_DIR}/include" diff --git a/misc/Info.plist.in b/misc/Info.plist.in index ac61ab6c..8ee2c44b 100644 --- a/misc/Info.plist.in +++ b/misc/Info.plist.in @@ -28,6 +28,8 @@ LSApplicationCategoryType public.app-category.utilities + LSMinimumSystemVersion + @MACOS_VERSION@.0 CFBundleDocumentTypes diff --git a/misc/build-mac.sh b/misc/build-mac.sh index d59d0126..15ee210f 100755 --- a/misc/build-mac.sh +++ b/misc/build-mac.sh @@ -1,10 +1,51 @@ #!/bin/sh -e +do_openssl() +{ +set -x +read openssl < "`dirname $0`/../OpenSSL.version" +test -f "$openssl".tar.gz || curl https://www.openssl.org/source/"$openssl".tar.gz > "$openssl".tar.gz +tar zxf "$openssl".tar.gz +(cd $openssl + ./Configure darwin64-x86_64-cc shared --prefix=$INSTALL_DIR $CFLAGS + #./config shared --prefix=$INSTALL_DIR + make && make install_sw +) +chmod 755 $INSTALL_DIR/lib/*.dylib +} + +do_libtool() +{( +read libtool < "`dirname $0`/../Libtool.version" +test -f "$libtool".tar.gz || curl http://ftp.gnu.org/gnu/libtool/"$libtool".tar.gz > "$libtool".tar.gz +tar zxf "$libtool".tar.gz +cd "$libtool" +#export CFLAGS="-arch i386" +./configure --prefix ${INSTALL_DIR} +make && make install +)} + XCA_DIR="`dirname $0`" XCA_DIR="`cd $XCA_DIR/.. && pwd`" +# define the installation dir and the path to the new library +# it will be installed locally in the home directory +export INSTALL_DIR="`pwd`"/install +export DYLD_LIBRARY_PATH=$INSTALL_DIR/lib +export CPPFLAGS="$CPPFLAGS -I${INSTALL_DIR}/include" +export LDFLAGS="-L${INSTALL_DIR}/lib" + export CFLAGS="-mmacosx-version-min=10.13" -export EXTRA_VERSION="-High-Sierra" + +if test -f build-libs; then + mkdir -p "$INSTALL_DIR" + do_libtool + do_openssl +fi +unset CFLAGS + +XCA_DIR="`dirname $0`" +XCA_DIR="`cd $XCA_DIR/.. && pwd`" XCA_BUILD="xca-macbuild" #rm -rf "$XCA_BUILD" @@ -12,7 +53,7 @@ mkdir -p "$XCA_BUILD" cd "$XCA_BUILD" (cd $XCA_DIR && ./bootstrap) -$XCA_DIR/configure +$XCA_DIR/configure --with-macos-version=10.13 --with-openssl="$INSTALL_DIR" make -j5 cp *.dmg ..