From 95e343caf32383348baee96b81bad164dc66f593 Mon Sep 17 00:00:00 2001 From: Roberto Santacroce Martins Date: Mon, 6 Jul 2020 15:34:10 +0200 Subject: [PATCH] added script to compile the lib to iphone sdk >= 13.5 --- RELICENSE/mileschet.md | 6 +++ builds/ios/build_ios.sh | 101 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 107 insertions(+) create mode 100644 RELICENSE/mileschet.md create mode 100755 builds/ios/build_ios.sh diff --git a/RELICENSE/mileschet.md b/RELICENSE/mileschet.md new file mode 100644 index 00000000..facf4f64 --- /dev/null +++ b/RELICENSE/mileschet.md @@ -0,0 +1,6 @@ +Permission to Relicense under MPLv2 or any other OSI approved license chosen by the current ZeroMQ BDFL +This is a statement by Roberto Santacroce Martins that grants permission to relicense its copyrights in the libzmq C++ library (ZeroMQ) under the Mozilla Public License v2 (MPLv2) or any other Open Source Initiative approved license chosen by the current ZeroMQ BDFL (Benevolent Dictator for Life). + +A portion of the commits made by the Github handle "mileschet", with commit author "Roberto Santacroce Martins miles.chet@gmail.com", are copyright of Roberto Santacroce Martins. This document hereby grants the libzmq project team to relicense libzmq, including all past, present and future contributions of the author listed above. + +Roberto Santacroce Martins 2020/07/06 diff --git a/builds/ios/build_ios.sh b/builds/ios/build_ios.sh new file mode 100755 index 00000000..1eb944e6 --- /dev/null +++ b/builds/ios/build_ios.sh @@ -0,0 +1,101 @@ +#!/bin/sh +# This is a first attempt to create a script to libzmq for iOS >= 13.5, including arm64 +# inspired on https://raw.githubusercontent.com/drewcrawford/libzmq-ios/master/libzmq.sh + +ARCHS=${ARCHS:-"armv7 armv7s arm64 x86_64"} +DEVELOPER=$(xcode-select -print-path) +SCRIPTDIR=$( (cd -P $(dirname $0) && pwd) ) +DISTLIBDIR="${SCRIPTDIR}/lib" +DSTDIR=${SCRIPTDIR} +BUILDDIR="${DSTDIR}/libzmq_build" +DISTDIR="${DSTDIR}/libzmq_dist" +LIBDIR=$(dirname $(dirname ${SCRIPTDIR})) +${LIBDIR}/autogen.sh + +# http://libwebp.webm.googlecode.com/git/iosbuild.sh +# Extract the latest SDK version from the final field of the form: iphoneosX.Y +SDK=$(xcodebuild -showsdks \ + | grep iphoneos | sort | tail -n 1 | awk '{print substr($NF, 9)}' + ) + +IOS_VERSION_MIN=8.0 +OTHER_LDFLAGS="" +OTHER_CFLAGS="-Os -Qunused-arguments" +OTHER_CXXFLAGS="-Os" + +for ARCH in $ARCHS +do + BUILDARCHDIR="$BUILDDIR/$ARCH" + mkdir -p ${BUILDARCHDIR} + + case ${ARCH} in + armv7) + PLATFORM="iPhoneOS" + HOST="${ARCH}-apple-darwin" + export BASEDIR="${DEVELOPER}/Platforms/${PLATFORM}.platform/Developer" + export ISDKROOT="${BASEDIR}/SDKs/${PLATFORM}${SDK}.sdk" + export CXXFLAGS="${OTHER_CXXFLAGS}" + export CPPFLAGS="-arch ${ARCH} -isysroot ${ISDKROOT} -mios-version-min=${IOS_VERSION_MIN} ${OTHER_CPPFLAGS}" + export LDFLAGS="-arch ${ARCH} -isysroot ${ISDKROOT} ${OTHER_LDFLAGS}" + ;; + + armv7s) + PLATFORM="iPhoneOS" + HOST="${ARCH}-apple-darwin" + export BASEDIR="${DEVELOPER}/Platforms/${PLATFORM}.platform/Developer" + export ISDKROOT="${BASEDIR}/SDKs/${PLATFORM}${SDK}.sdk" + export CXXFLAGS="${OTHER_CXXFLAGS}" + export CPPFLAGS="-arch ${ARCH} -isysroot ${ISDKROOT} -mios-version-min=${IOS_VERSION_MIN} ${OTHER_CPPFLAGS}" + export LDFLAGS="-arch ${ARCH} -isysroot ${ISDKROOT} ${OTHER_LDFLAGS}" + ;; + + arm64) + PLATFORM="iPhoneOS" + HOST="arm-apple-darwin" + export BASEDIR="${DEVELOPER}/Platforms/${PLATFORM}.platform/Developer" + export ISDKROOT="${BASEDIR}/SDKs/${PLATFORM}${SDK}.sdk" + export CXXFLAGS="${OTHER_CXXFLAGS}" + export CPPFLAGS="-arch ${ARCH} -isysroot ${ISDKROOT} -mios-version-min=${IOS_VERSION_MIN} ${OTHER_CPPFLAGS}" + export LDFLAGS="-arch ${ARCH} -isysroot ${ISDKROOT} ${OTHER_LDFLAGS}" + ;; + + x86_64) + PLATFORM="iPhoneSimulator" + HOST="${ARCH}-apple-darwin" + export BASEDIR="${DEVELOPER}/Platforms/${PLATFORM}.platform/Developer" + export ISDKROOT="${BASEDIR}/SDKs/${PLATFORM}${SDK}.sdk" + export CXXFLAGS="${OTHER_CXXFLAGS}" + export CPPFLAGS="-arch ${ARCH} -isysroot ${ISDKROOT} -mios-version-min=${IOS_VERSION_MIN} ${OTHER_CPPFLAGS}" + export LDFLAGS="-arch ${ARCH} ${OTHER_LDFLAGS}" + echo "LDFLAGS $LDFLAGS" + ;; + *) + echo "Unsupported architecture ${ARCH}" + exit 1 + ;; + esac + + export PATH="${DEVELOPER}/Toolchains/XcodeDefault.xctoolchain/usr/bin:${DEVELOPER}/Toolchains/XcodeDefault.xctoolchain/usr/sbin:$PATH" + + echo "Configuring for ${ARCH}..." + set +e + cd ${LIBDIR} + set -e + ${LIBDIR}/configure \ + --prefix=${BUILDARCHDIR} \ + --disable-shared \ + --enable-static \ + --host=${HOST}\ + --with-libsodium=${LIBSODIUM_DIST} + + echo "Building ${LIBNAME} for ${ARCH}..." + cd ${LIBDIR} + + make -j8 V=0 + make install + + LIBLIST+="${BUILDARCHDIR}/lib/${LIBNAME} " +done + +echo "Done !" +echo ${LIBLIST} \ No newline at end of file