Browse Source

IOS-2882 gpm iOS working

IOS-2882
Andreas Buff 2 months ago
parent
commit
0a4b441689
8 changed files with 302 additions and 0 deletions
  1. +58
    -0
      CommonPEPDependencies/CommonPEPDependencies.xcodeproj/project.pbxproj
  2. +67
    -0
      CommonPEPDependencies/CommonPEPDependencies.xcodeproj/xcshareddata/xcschemes/build_gmp_iOS.xcscheme
  3. +2
    -0
      CommonPEPDependencies/config.plist
  4. +2
    -0
      _config/pEp_versions.plist
  5. +85
    -0
      build-ios_dependency.template
  6. +30
    -0
      buildcode/gmp.code
  7. +46
    -0
      generate_and_run_ios_dependency_build_script.sh
  8. +12
    -0
      get-config-ios-deployment-target.sh

+ 58
- 0
CommonPEPDependencies/CommonPEPDependencies.xcodeproj/project.pbxproj View File

@ -18,6 +18,17 @@
name = CLEAN_ALL_iOS;
productName = "libetpan-dependencies_macOS";
};
152E498D26A9B252009BD3CE /* build_gmp_iOS */ = {
isa = PBXAggregateTarget;
buildConfigurationList = 152E498F26A9B252009BD3CE /* Build configuration list for PBXAggregateTarget "build_gmp_iOS" */;
buildPhases = (
152E498E26A9B252009BD3CE /* Build */,
);
dependencies = (
);
name = build_gmp_iOS;
productName = "libetpan-dependencies_macOS";
};
1585EE16269DCEA600B822E1 /* build-pEpMIME-dependencies_macOS */ = {
isa = PBXAggregateTarget;
buildConfigurationList = 1585EE17269DCEA600B822E1 /* Build configuration list for PBXAggregateTarget "build-pEpMIME-dependencies_macOS" */;
@ -402,6 +413,7 @@
1585F04A26A1D2BE00B822E1 /* build-pEp4ThunderbirdInstaller-dependencies_macOS */,
1585EEFC26A0432A00B822E1 /* CLEAN_ALL_macOS */,
1585F04126A1C14C00B822E1 /* CLEAN_PEP */,
152E498D26A9B252009BD3CE /* build_gmp_iOS */,
1585EF0526A0479800B822E1 /* build_sequoia_iOS */,
152E47C626A5B7C2009BD3CE /* CLEAN_ALL_iOS */,
);
@ -428,6 +440,25 @@
shellScript = "SCRIPTS_DIR=\"${PROJECT_DIR}/..\"\nPREFIX=\"${PROJECT_DIR}/$(${SCRIPTS_DIR}/get-config-prefix.sh)\"\nBUILD_SCRIPT=\"${SCRIPTS_DIR}/clean_all_iOS.sh\" \nsh \"${BUILD_SCRIPT}\" \"${PREFIX}\"\n";
showEnvVarsInLog = 0;
};
152E498E26A9B252009BD3CE /* Build */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
);
inputPaths = (
);
name = Build;
outputFileListPaths = (
);
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = "/bin/sh -l";
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_ios_dependency_build_script.sh\" \nsh \"${BUILD_SCRIPT}\" $LIB_NAME \"${PREFIX}\"\n";
showEnvVarsInLog = 0;
};
1585EE28269DD87700B822E1 /* Build */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
@ -803,6 +834,24 @@
};
name = Release;
};
152E499026A9B252009BD3CE /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = NQLYU6MGPN;
PRODUCT_NAME = "$(TARGET_NAME)";
};
name = Debug;
};
152E499126A9B252009BD3CE /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = NQLYU6MGPN;
PRODUCT_NAME = "$(TARGET_NAME)";
};
name = Release;
};
1585EE0F269DC6DD00B822E1 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
@ -1151,6 +1200,15 @@
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
152E498F26A9B252009BD3CE /* Build configuration list for PBXAggregateTarget "build_gmp_iOS" */ = {
isa = XCConfigurationList;
buildConfigurations = (
152E499026A9B252009BD3CE /* Debug */,
152E499126A9B252009BD3CE /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
1585EE0E269DC6DD00B822E1 /* Build configuration list for PBXProject "CommonPEPDependencies" */ = {
isa = XCConfigurationList;
buildConfigurations = (


+ 67
- 0
CommonPEPDependencies/CommonPEPDependencies.xcodeproj/xcshareddata/xcschemes/build_gmp_iOS.xcscheme View File

@ -0,0 +1,67 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1250"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "152E498D26A9B252009BD3CE"
BuildableName = "build_gmp_iOS"
BlueprintName = "build_gmp_iOS"
ReferencedContainer = "container:CommonPEPDependencies.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "152E498D26A9B252009BD3CE"
BuildableName = "build_gmp_iOS"
BlueprintName = "build_gmp_iOS"
ReferencedContainer = "container:CommonPEPDependencies.xcodeproj">
</BuildableReference>
</MacroExpansion>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>

+ 2
- 0
CommonPEPDependencies/config.plist View File

@ -2,6 +2,8 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IOS_DEPLOYMENT</key>
<string>12.0</string>
<key>MACOSX_DEPLOYMENT_x86_64</key>
<string>10.10</string>
<key>MACOSX_DEPLOYMENT_M1</key>


+ 2
- 0
_config/pEp_versions.plist View File

@ -2,6 +2,8 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>GMP_VERSION</key>
<string>6.2.1</string>
<key>SEQUOIA_4_iOS_VERSION</key>
<string>v2.1.6</string>
<key>SEQUOIA_4_MAC_OS_VERSION</key>


+ 85
- 0
build-ios_dependency.template View File

@ -0,0 +1,85 @@
# Builds fat lib for macOS (ARM64 & x86_64).
# Pass PREFIX as argument. If not passed, "local/" is used as deafult.
# Exit on errors
set -e
SCRIPT_DIR=$(dirname "$0")
PREFIX=$1
# Get Absolute Paths & Setup
SCRIPT_DIR=$(dirname "$0")
pushd "${SCRIPT_DIR}"
SCRIPT_DIR=$(pwd)
popd
if [ "${PREFIX}" = "" ]; then
PREFIX="${SCRIPT_DIR}/local"
fi
mkdir -p "${PREFIX}"
pushd "${PREFIX}"
PREFIX=$(pwd)
popd
TMP_DIR="${SCRIPT_DIR}/tmp"
INCLUDE_DIR="${PREFIX}/include"
LIB_DIR="${PREFIX}/lib"
BIN_DIR="${PREFIX}/bin"
mkdir -p "${INCLUDE_DIR}"
mkdir -p "${LIB_DIR}"
mkdir -p "${TMP_DIR}"
IOS_DEPLOYMENT_TARGET=$(sh "${SCRIPT_DIR}"/get-config-ios-deployment-target.sh)
# Funcs
buildLib()
{
ARCH=$1
TARGET=$2
HOST=$3
SDK=$4
SDK_PATH=`xcrun -sdk ${SDK} --show-sdk-path`
CURRENT_LIB_DIR="${TMP_DIR}/${ARCH}"
mkdir -p "${CURRENT_LIB_DIR}/lib"
mkdir -p "${CURRENT_LIB_DIR}/include"
mkdir -p "${CURRENT_LIB_DIR}/bin"
# START: Lib Specific Code
BUILD_CODE
# END: Lib Specific Code
}
cleanup()
{
rm -rf "${TMP_DIR}/x86_64"
rm -rf "${TMP_DIR}/arm64"
}
# Setup
cleanup
mkdir -p "${TMP_DIR}"
mkdir -p "${PREFIX}"
# Build
pushd "${TMP_DIR}"
buildLib "arm64" "aarch64-apple-ios" "aarch64-apple-darwin" "iphoneos"
buildLib "x86_64" "x86_64-apple-ios" "x86_64-apple-darwin" "iphonesimulator"
popd
# Make Fat Lib
sh "${SCRIPT_DIR}/build-fat-libs.sh" "${TMP_DIR}/arm64/lib" "${TMP_DIR}/x86_64/lib" "${LIB_DIR}"
# Copy Headers If Currently Building Lib
ARM64_INCLUDE_DIR="${TMP_DIR}/arm64/include"
cp -r "${ARM64_INCLUDE_DIR}"/* "${INCLUDE_DIR}" 2>/dev/null || :
# Cleanup
cleanup

+ 30
- 0
buildcode/gmp.code View File

@ -0,0 +1,30 @@
GMP_VERSION=$(sh "${SCRIPT_DIR}"/get-pEp-version.sh "GMP_VERSION")
GMP_NAME="gmp-${GMP_VERSION}"
OUTPUT_DIR=${SCRIPT_DIR}/build
# Exit on errors
set -e
if [ -f "${LIB_DIR}/libgmp.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}/${GMP_NAME}"
if [ ! -d "${GMP_DIR}" ]; then
# GMP snapshot must be used until released
wget -nc https://gmplib.org/download/gmp/$GMP_NAME.tar.bz2
tar xvf ${GMP_NAME}.tar.bz2
fi
export CFLAGS="-arch ${ARCH} -isysroot ${SDK_PATH} -miphoneos-version-min=${IOS_DEPLOYMENT_TARGET} -std=c99"
export LDFLAGS="-arch ${ARCH}"
export CC="$(xcrun --sdk ${SDK} -f clang) -arch ${ARCH} -isysroot ${SDK_PATH}"
pushd gmp-$GMP_VERSION
PKG_CONFIG_ALLOW_CROSS=1 PKG_CONFIG_PATH=${CURRENT_LIB_DIR}/lib/pkgconfig ./configure --host=${HOST} --prefix=${CURRENT_LIB_DIR} --disable-assembly
make clean
make -j4
make install
popd

+ 46
- 0
generate_and_run_ios_dependency_build_script.sh View File

@ -0,0 +1,46 @@
# Builds fat lib for macOS (ARM64 & x86_64).
# Pass PREFIX as argument. If not passed, "local/" is used as deafult.
# Exit on errors
set -e
SCRIPT_DIR=$(dirname "$0")
LIB_NAME=$1
PREFIX=$2
# Get Absolute Paths
pushd "${SCRIPT_DIR}"
SCRIPT_DIR=$(pwd)
popd
mkdir -p "${PREFIX}"
pushd "${PREFIX}"
PREFIX=$(pwd)
popd
GENERATED_SCRIPT="${SCRIPT_DIR}/generated.sh"
exitAndPrintHelp()
{
echo "Must be called passing \`LIB_NAME`\` (mandatory). \`PREFIX\` can also be passed (optional).\nSample:\n\`generate_and_run_ios_dependency_build_script \$LIB_NAME\`\n`generate_and_run_ios_dependency_build_script \$LIB_NAME \$PREFIX\`"
exit 1
}
if [ "${LIB_NAME}" = "" ]; then
exitAndPrintHelp
fi
# Say Hello
echo "#####################################################"
echo "#Generating buildscript for ${LIB_NAME}"
echo "#####################################################"
# Generate Actual Script
BUILD_CODE_FILE="${SCRIPT_DIR}/buildcode/${LIB_NAME}.code"
BUILD_SCRIPT_TEMPLATE_FILE="${SCRIPT_DIR}/build-ios_dependency.template"
SEARCH_STRING="BUILD_CODE"
#Replaces ${SEARCH_STRING} in file ${BUILD_SCRIPT_TEMPLATE_FILE} with content of ${BUILD_CODE_FILE}
/opt/local/bin/gsed -e "/${SEARCH_STRING}/r ${BUILD_CODE_FILE}" -e "/${SEARCH_STRING}/d" ${BUILD_SCRIPT_TEMPLATE_FILE} > "${GENERATED_SCRIPT}"
sh ${GENERATED_SCRIPT} ${PREFIX}
# Cleanup
rm -rf "${TMP_DIR}"

+ 12
- 0
get-config-ios-deployment-target.sh View File

@ -0,0 +1,12 @@
# returns the default IOS_DEPLOYMENT TARGET
SCRIPT_DIR=$(dirname $0)
# Get Absolute Paths
pushd "${SCRIPT_DIR}" >/dev/null
SCRIPT_DIR=$(pwd)
popd >/dev/null
CONFIG_PLIST="${SCRIPT_DIR}/CommonPEPDependencies/config.plist"
RESULT=$(/usr/libexec/PlistBuddy -c "Print IOS_DEPLOYMENT" "${CONFIG_PLIST}")
echo ${RESULT}

Loading…
Cancel
Save