diff --git a/CommonPEPDependencies/CommonPEPDependencies.xcodeproj/project.pbxproj b/CommonPEPDependencies/CommonPEPDependencies.xcodeproj/project.pbxproj index 465a1e5..f66494e 100644 --- a/CommonPEPDependencies/CommonPEPDependencies.xcodeproj/project.pbxproj +++ b/CommonPEPDependencies/CommonPEPDependencies.xcodeproj/project.pbxproj @@ -40,6 +40,18 @@ name = build_gmp_macOS; productName = "libetpan-dependencies_macOS"; }; + 152E499926A9BC94009BD3CE /* build_nettle_iOS */ = { + isa = PBXAggregateTarget; + buildConfigurationList = 152E499B26A9BC94009BD3CE /* Build configuration list for PBXAggregateTarget "build_nettle_iOS" */; + buildPhases = ( + 152E499A26A9BC94009BD3CE /* Build */, + ); + dependencies = ( + 152E499F26A9C62B009BD3CE /* PBXTargetDependency */, + ); + name = build_nettle_iOS; + productName = "libetpan-dependencies_macOS"; + }; 1585EE16269DCEA600B822E1 /* build-pEpMIME-dependencies_macOS */ = { isa = PBXAggregateTarget; buildConfigurationList = 1585EE17269DCEA600B822E1 /* Build configuration list for PBXAggregateTarget "build-pEpMIME-dependencies_macOS" */; @@ -262,6 +274,13 @@ remoteGlobalIDString = 152E498D26A9B252009BD3CE; remoteInfo = build_gmp_iOS; }; + 152E499E26A9C62B009BD3CE /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 1585EE0B269DC6DD00B822E1 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 152E498D26A9B252009BD3CE; + remoteInfo = build_gmp_iOS; + }; 1585EE35269EC8DD00B822E1 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = 1585EE0B269DC6DD00B822E1 /* Project object */; @@ -434,6 +453,7 @@ 1585EEFC26A0432A00B822E1 /* CLEAN_ALL_macOS */, 1585F04126A1C14C00B822E1 /* CLEAN_PEP */, 152E498D26A9B252009BD3CE /* build_gmp_iOS */, + 152E499926A9BC94009BD3CE /* build_nettle_iOS */, 1585EF0526A0479800B822E1 /* build_sequoia_iOS */, 152E47C626A5B7C2009BD3CE /* CLEAN_ALL_iOS */, ); @@ -498,6 +518,25 @@ shellScript = "LIB_NAME=\"gmp\"\n\nSCRIPTS_DIR=\"${PROJECT_DIR}/..\"\nPREFIX=\"${PROJECT_DIR}/$(${SCRIPTS_DIR}/get-config-prefix.sh)\"\n\nBUILD_SCRIPT=\"${SCRIPTS_DIR}/generate_and_run_mac_dependency_build_script.sh\" \nsh \"${BUILD_SCRIPT}\" $LIB_NAME \"${PREFIX}\"\n"; showEnvVarsInLog = 0; }; + 152E499A26A9BC94009BD3CE /* Build */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + ); + name = Build; + outputFileListPaths = ( + ); + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = "/bin/sh -l"; + shellScript = "LIB_NAME=\"nettle\"\n\nSCRIPTS_DIR=\"${PROJECT_DIR}/..\"\nPREFIX=\"${PROJECT_DIR}/$(${SCRIPTS_DIR}/get-config-prefix.sh)\"\n\nBUILD_SCRIPT=\"${SCRIPTS_DIR}/generate_and_run_ios_dependency_build_script.sh\" \nsh \"${BUILD_SCRIPT}\" $LIB_NAME \"${PREFIX}\"\n"; + showEnvVarsInLog = 0; + }; 1585EE28269DD87700B822E1 /* Build */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; @@ -772,6 +811,11 @@ target = 152E498D26A9B252009BD3CE /* build_gmp_iOS */; targetProxy = 152E499226A9B88A009BD3CE /* PBXContainerItemProxy */; }; + 152E499F26A9C62B009BD3CE /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 152E498D26A9B252009BD3CE /* build_gmp_iOS */; + targetProxy = 152E499E26A9C62B009BD3CE /* PBXContainerItemProxy */; + }; 1585EE36269EC8DD00B822E1 /* PBXTargetDependency */ = { isa = PBXTargetDependency; target = 1585EE27269DD87700B822E1 /* build_libiconv_macOS */; @@ -914,6 +958,24 @@ }; name = Release; }; + 152E499C26A9BC94009BD3CE /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_TEAM = NQLYU6MGPN; + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Debug; + }; + 152E499D26A9BC94009BD3CE /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_TEAM = NQLYU6MGPN; + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Release; + }; 1585EE0F269DC6DD00B822E1 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { @@ -1280,6 +1342,15 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; + 152E499B26A9BC94009BD3CE /* Build configuration list for PBXAggregateTarget "build_nettle_iOS" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 152E499C26A9BC94009BD3CE /* Debug */, + 152E499D26A9BC94009BD3CE /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; 1585EE0E269DC6DD00B822E1 /* Build configuration list for PBXProject "CommonPEPDependencies" */ = { isa = XCConfigurationList; buildConfigurations = ( diff --git a/CommonPEPDependencies/CommonPEPDependencies.xcodeproj/xcshareddata/xcschemes/build_gmp_iOS.xcscheme b/CommonPEPDependencies/CommonPEPDependencies.xcodeproj/xcshareddata/xcschemes/build_gmp_iOS.xcscheme index 966b546..1a0c07a 100644 --- a/CommonPEPDependencies/CommonPEPDependencies.xcodeproj/xcshareddata/xcschemes/build_gmp_iOS.xcscheme +++ b/CommonPEPDependencies/CommonPEPDependencies.xcodeproj/xcshareddata/xcschemes/build_gmp_iOS.xcscheme @@ -3,8 +3,8 @@ LastUpgradeVersion = "1250" version = "1.3"> + parallelizeBuildables = "NO" + buildImplicitDependencies = "NO"> + parallelizeBuildables = "NO" + buildImplicitDependencies = "NO"> + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/_config/pEp_versions.plist b/_config/pEp_versions.plist index 5e48b0b..5000060 100644 --- a/_config/pEp_versions.plist +++ b/_config/pEp_versions.plist @@ -2,6 +2,8 @@ + NETTLE_VERSION + 3.7.3 GMP_VERSION 6.2.1 SEQUOIA_4_iOS_VERSION diff --git a/build-ios_dependency.template b/build-ios_dependency.template index 0bb42fa..32c91b9 100644 --- a/build-ios_dependency.template +++ b/build-ios_dependency.template @@ -48,11 +48,29 @@ buildLib() mkdir -p "${CURRENT_LIB_DIR}/include" mkdir -p "${CURRENT_LIB_DIR}/bin" + # Set CFLAGS that fit most targets. Can be overrriden in .code file + if [[ $TARGET == *"ios"* ]]; then + export CFLAGS="-arch ${ARCH} -isysroot ${SDK_PATH} -std=c99 -miphoneos-version-min=${IOS_DEPLOYMENT_TARGET}" + else + if [[ $ARCH == "arm64" ]]; then + export CFLAGS="-arch ${ARCH} -isysroot ${SDK_PATH} -std=c99 -mmacosx-version-min=${MACOSX_DEPLOYMENT_TARGET_ARM}" + elif [[ $ARCH == "x86_64" ]]; then + export CFLAGS="-arch ${ARCH} -isysroot ${SDK_PATH} -std=c99 -mmacosx-version-min=${MACOSX_DEPLOYMENT_TARGET_INTEL}" + else + echo "Unhandled arch" + exit 1 + fi +fi + # START: Lib Specific Code BUILD_CODE # END: Lib Specific Code + + unset CFLAGS + unset LDFLAGS + unset CC } cleanup() diff --git a/buildcode/gmp.code b/buildcode/gmp.code index eb86451..ef0397c 100644 --- a/buildcode/gmp.code +++ b/buildcode/gmp.code @@ -18,7 +18,6 @@ if [ ! -d "${GMP_DIR}" ]; then tar xvf ${GMP_NAME}.tar.bz2 fi -export CFLAGS="-arch ${ARCH} -isysroot ${SDK_PATH} -std=c99" export LDFLAGS="-arch ${ARCH}" export CC="$(xcrun --sdk ${SDK} -f clang) -arch ${ARCH} -isysroot ${SDK_PATH}" diff --git a/buildcode/iconv.code b/buildcode/iconv.code index 1c35e10..34a7fc6 100644 --- a/buildcode/iconv.code +++ b/buildcode/iconv.code @@ -8,7 +8,6 @@ if [ ! -d "${ICONV_DIR}" ]; then git clone -b "v1.16_without_lib_prefix_defines" https://gitea.pep.foundation/buff/libiconv.git fi pushd "${ICONV_DIR}" - export CFLAGS="-arch ${ARCH} -isysroot ${SDK_PATH} -std=c99" export LDFLAGS="-arch ${ARCH}" export CC="$(xcrun --sdk ${SDK} -f clang) -arch ${ARCH} -isysroot ${SDK_PATH}" diff --git a/buildcode/nettle.code b/buildcode/nettle.code new file mode 100644 index 0000000..ea16253 --- /dev/null +++ b/buildcode/nettle.code @@ -0,0 +1,30 @@ +NETTLE_VERSION=$(sh "${SCRIPT_DIR}"/get-pEp-version.sh "NETTLE_VERSION") +NETTLE_NAME="nettle-${NETTLE_VERSION}" + +OUTPUT_DIR=${SCRIPT_DIR}/build + +# Exit on errors +set -e + +if [ -f "${LIB_DIR}/libnettle.a" ]; then + echo "lib exists already in ${LIB_DIR}. If you want to rebuild it, delete the existing one." + exit 0 +fi + +GMP_DIR="${TMP_DIR}/${NETTLE_NAME}" +if [ ! -d "${GMP_DIR}" ]; then + wget -nc https://ftp.gnu.org/gnu/nettle/${NETTLE_NAME}.tar.gz + tar xvf ${NETTLE_NAME}.tar.gz +fi + +export LDFLAGS="-arch ${ARCH}" +export CC="$(xcrun --sdk ${SDK} -f clang) -arch ${ARCH} -isysroot ${SDK_PATH}" + +pushd ${NETTLE_NAME} + PKG_CONFIG_ALLOW_CROSS=1 PKG_CONFIG_PATH=$PREFIX/lib/pkgconfig CC_FOR_BUILD="$(whereis gcc)" ./configure --host=${HOST} --prefix=${CURRENT_LIB_DIR} --with-lib-path=${PREFIX}/lib --with-include-path=${PREFIX}/include --disable-assembler --disable-arm-neon --disable-documentation --verbose + make clean + make -j4 + make install +popd + +rm -rf *.gz