Merge branch 'PEMA-40'

master
Dirk Zimmermann 1 week ago
commit f35b6e79ee
  1. 2
      .gitignore
  2. 99
      CommonPEPDependencies/CommonPEPDependencies.xcodeproj/project.pbxproj
  3. 67
      CommonPEPDependencies/CommonPEPDependencies.xcodeproj/xcshareddata/xcschemes/build_pEpengine_iOS.xcscheme
  4. 2
      build-ios_dependency.template
  5. 4
      build-macos_dependency.template
  6. 70
      build-pEpEngine-iOS.sh
  7. 8
      buildcode/gmp.code
  8. 1
      buildcode/iconv.code
  9. 15
      buildcode/sequoia.code
  10. 22787
      buildcode/sequoia_resources/nettle-bindings.rs
  11. 13
      generate_and_run_ios_dependency_build_script.sh
  12. 6
      generate_and_run_mac_dependency_build_script.sh

2
.gitignore vendored

@ -1,4 +1,4 @@
generated*
*_generated.sh
tmp
*build/*

@ -312,6 +312,19 @@
name = build_capnProto_macOS;
productName = "libetpan-dependencies_macOS";
};
43B332C428D086BD00D62996 /* build_pEpengine_iOS */ = {
isa = PBXAggregateTarget;
buildConfigurationList = 43B332CA28D086BD00D62996 /* Build configuration list for PBXAggregateTarget "build_pEpengine_iOS" */;
buildPhases = (
43B332C928D086BD00D62996 /* Build */,
);
dependencies = (
43B332C528D086BD00D62996 /* PBXTargetDependency */,
43B332CE28D086DC00D62996 /* PBXTargetDependency */,
);
name = build_pEpengine_iOS;
productName = "libetpan-dependencies_macOS";
};
/* End PBXAggregateTarget section */
/* Begin PBXContainerItemProxy section */
@ -483,6 +496,20 @@
remoteGlobalIDString = 1585EED4269EF98B00B822E1;
remoteInfo = "build_build-macOSAdapter";
};
43B332C628D086BD00D62996 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 1585EE0B269DC6DD00B822E1 /* Project object */;
proxyType = 1;
remoteGlobalIDString = 1585EEA5269EDA1E00B822E1;
remoteInfo = build_asn1cexecutable;
};
43B332CD28D086DC00D62996 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 1585EE0B269DC6DD00B822E1 /* Project object */;
proxyType = 1;
remoteGlobalIDString = 1585EF0526A0479800B822E1;
remoteInfo = build_sequoia_iOS;
};
/* End PBXContainerItemProxy section */
/* Begin PBXGroup section */
@ -518,15 +545,19 @@
projectRoot = "";
targets = (
1585EE27269DD87700B822E1 /* build_libiconv_macOS */,
152E49AB26A9CFD4009BD3CE /* build_libiconv_iOS */,
1585EE39269EC90100B822E1 /* build_boost_macOS */,
1585EE3E269EC9BB00B822E1 /* build_openssl_macOS */,
1585EE48269ECB8700B822E1 /* build_cryptopp_macOS */,
1585EEA5269EDA1E00B822E1 /* build_asn1cexecutable */,
152E499426A9B88E009BD3CE /* build_gmp_macOS */,
152E498D26A9B252009BD3CE /* build_gmp_iOS */,
152E49A226A9CEE0009BD3CE /* build_nettle_macOS */,
1585EECA269EF0F100B822E1 /* build_sequoia_macOS */,
1585EF0526A0479800B822E1 /* build_sequoia_iOS */,
1585EE43269ECB2500B822E1 /* build_pEpwebserver_macOS */,
1585EEAA269EDAE200B822E1 /* build_pEpengine_macOS */,
43B332C428D086BD00D62996 /* build_pEpengine_iOS */,
1585EE4D269ECFA900B822E1 /* build_pEpAdapter_macOS */,
1585EE93269ED57700B822E1 /* build_pEpminijsonadapter_macOS */,
1585EED4269EF98B00B822E1 /* build_build-macOSAdapter */,
@ -536,10 +567,7 @@
1585F04A26A1D2BE00B822E1 /* build-pEp4ThunderbirdInstaller-dependencies_macOS */,
1585EEFC26A0432A00B822E1 /* CLEAN_ALL_macOS */,
1585F04126A1C14C00B822E1 /* CLEAN_PEP_macOS */,
152E498D26A9B252009BD3CE /* build_gmp_iOS */,
152E499926A9BC94009BD3CE /* build_nettle_iOS */,
152E49AB26A9CFD4009BD3CE /* build_libiconv_iOS */,
1585EF0526A0479800B822E1 /* build_sequoia_iOS */,
153AFC9F26AAFF4000177147 /* build-libetpan-dependencies_iOS */,
152E47C626A5B7C2009BD3CE /* CLEAN_ALL_iOS */,
15A75B6227469C4E006A33B8 /* build_capnProto_macOS */,
@ -658,8 +686,8 @@
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "LIB_NAME=\"iconv\"\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";
shellPath = "/bin/sh -l";
shellScript = "# Note: `-l` (login shell) is needed to find `wget\n\nLIB_NAME=\"iconv\"\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 */ = {
@ -947,6 +975,24 @@
shellScript = "LIB_NAME=\"capnp\"\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;
};
43B332C928D086BD00D62996 /* Build */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
);
inputPaths = (
);
name = Build;
outputFileListPaths = (
);
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "SCRIPTS_DIR=\"${PROJECT_DIR}/..\"\nPREFIX=\"${PROJECT_DIR}/$(${SCRIPTS_DIR}/get-config-prefix.sh)\"\nBUILD_SCRIPT=\"${SCRIPTS_DIR}/build-pEpEngine-iOS.sh\" \nsh \"${BUILD_SCRIPT}\" \"${PREFIX}\" \"${CONFIGURATION}\"\n";
};
/* End PBXShellScriptBuildPhase section */
/* Begin PBXTargetDependency section */
@ -1070,6 +1116,16 @@
target = 1585EED4269EF98B00B822E1 /* build_build-macOSAdapter */;
targetProxy = 1585F05626A1D2F500B822E1 /* PBXContainerItemProxy */;
};
43B332C528D086BD00D62996 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = 1585EEA5269EDA1E00B822E1 /* build_asn1cexecutable */;
targetProxy = 43B332C628D086BD00D62996 /* PBXContainerItemProxy */;
};
43B332CE28D086DC00D62996 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = 1585EF0526A0479800B822E1 /* build_sequoia_iOS */;
targetProxy = 43B332CD28D086DC00D62996 /* PBXContainerItemProxy */;
};
/* End PBXTargetDependency section */
/* Begin XCBuildConfiguration section */
@ -1100,6 +1156,7 @@
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = NQLYU6MGPN;
PRODUCT_NAME = "$(TARGET_NAME)";
SUPPORTED_PLATFORMS = "iphonesimulator iphoneos";
};
name = Debug;
};
@ -1110,6 +1167,7 @@
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = NQLYU6MGPN;
PRODUCT_NAME = "$(TARGET_NAME)";
SUPPORTED_PLATFORMS = "iphonesimulator iphoneos";
};
name = Release;
};
@ -1566,6 +1624,7 @@
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = NQLYU6MGPN;
PRODUCT_NAME = "$(TARGET_NAME)";
SUPPORTED_PLATFORMS = "iphonesimulator iphoneos";
};
name = Debug;
};
@ -1576,6 +1635,7 @@
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = NQLYU6MGPN;
PRODUCT_NAME = "$(TARGET_NAME)";
SUPPORTED_PLATFORMS = "iphonesimulator iphoneos";
};
name = Release;
};
@ -1659,6 +1719,26 @@
};
name = Release;
};
43B332CB28D086BD00D62996 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
CLANG_ENABLE_OBJC_WEAK = YES;
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = NQLYU6MGPN;
PRODUCT_NAME = "$(TARGET_NAME)";
};
name = Debug;
};
43B332CC28D086BD00D62996 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
CLANG_ENABLE_OBJC_WEAK = YES;
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = NQLYU6MGPN;
PRODUCT_NAME = "$(TARGET_NAME)";
};
name = Release;
};
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
@ -1905,6 +1985,15 @@
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
43B332CA28D086BD00D62996 /* Build configuration list for PBXAggregateTarget "build_pEpengine_iOS" */ = {
isa = XCConfigurationList;
buildConfigurations = (
43B332CB28D086BD00D62996 /* Debug */,
43B332CC28D086BD00D62996 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
rootObject = 1585EE0B269DC6DD00B822E1 /* Project object */;

@ -0,0 +1,67 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1330"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "43B332C428D086BD00D62996"
BuildableName = "build_pEpengine_iOS"
BlueprintName = "build_pEpengine_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 = "43B332C428D086BD00D62996"
BuildableName = "build_pEpengine_iOS"
BlueprintName = "build_pEpengine_iOS"
ReferencedContainer = "container:CommonPEPDependencies.xcodeproj">
</BuildableReference>
</MacroExpansion>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>

@ -88,7 +88,7 @@ mkdir -p "${PREFIX}"
# Build
pushd "${TMP_DIR}"
buildLib "arm64" "aarch64-apple-ios" "aarch64-apple-darwin" "iphoneos"
buildLib "arm64" "aarch64-apple-ios" "x86_64-apple-darwin" "iphoneos"
buildLib "x86_64" "x86_64-apple-ios" "x86_64-apple-darwin" "iphonesimulator"
popd

@ -92,6 +92,10 @@ pushd "${TMP_DIR}"
buildLib "arm64" "arm64-apple-macos11.1" "aarch64-apple-darwin" "macosx"
popd
# Create directories, just in case
mkdir -p "${TMP_DIR}/arm64/bin"
mkdir -p "${TMP_DIR}/x86_64/bin"
# Make Fat Lib
sh "${SCRIPT_DIR}/build-fat-libs.sh" "${TMP_DIR}/arm64/lib" "${TMP_DIR}/x86_64/lib" "${LIB_DIR}"
# Make Fat Bin

@ -0,0 +1,70 @@
# Builds fat lib for iOS (ARM64 & x86_64).
# Pass PREFIX as argument. If not passed, "local/" is used as deafult. Config can also be passed.
# Sample:
# `sh build-pEpEngine-iOS.sh $MyPREFIX [RELEASE|DEBUG]
# Exit on errors
set -e
SCRIPT_DIR=$(dirname "$0")
PREFIX=$1
CONFIG=$2
if [ "${CONFIG}" = "" ]; then
CONFIG="RELEASE"
fi
VERSION=$(sh "${SCRIPT_DIR}/get-pEp-version.sh" "PEP_ENGINE_VERSION")
# Get Absolute Paths & Setup
pushd "${SCRIPT_DIR}"
SCRIPT_DIR=$(pwd)
popd
if [ "${PREFIX}" = "" ]; then
PREFIX="${SCRIPT_DIR}/local"
fi
mkdir -p "${PREFIX}"
pushd "${PREFIX}"
PREFIX=$(pwd)
popd
PARENT_DIR="${SCRIPT_DIR}/.."
if [ -f "${PREFIX}/lib/libpEpEngine.a" ]; then
echo "lib exists already in ${PREFIX}/lib. If you want to rebuild it, delete the existing one."
exit 0
fi
# libpEpEngine
pushd "${PARENT_DIR}"
PEP_ENGINE_DIR="${PARENT_DIR}/pEpEngine"
if [ ! -d "${PEP_ENGINE_DIR}" ]; then
git clone -b "${VERSION}" https://gitea.pep.foundation/pEp.foundation/pEpEngine
fi
PEP_TRANSPORT_DIR="${PARENT_DIR}/libpEpTransport"
if [ ! -d "${PEP_TRANSPORT_DIR}" ]; then
git clone -b "master" https://gitea.pep.foundation/pEp.foundation/libpEpTransport.git
# build with Engine Xcode project
fi
LIBETPAN_DIR="${PARENT_DIR}/libetpan"
if [ ! -d "${LIBETPAN_DIR}" ]; then
# git clone -b "master" https://gitea.pep.foundation/pep.foundation/libetpan.git
git clone -b "master" https://gitea.pep.foundation/buff/libetpan.git
# build with Engine Xcode project
fi
XCODE_PROJECT_DIR="${PEP_ENGINE_DIR}/build-mac"
pushd ${XCODE_PROJECT_DIR}
xcodebuild -project "pEpEngine.xcodeproj" -scheme "pEpEngine_macOS" -configuration ${CONFIG}
popd
# Copy Artefacts
cp "${XCODE_PROJECT_DIR}/build/libpEpEngine.a" "${PREFIX}/lib/libpEpEngine.a"
cp "${XCODE_PROJECT_DIR}/Subprojects/pEpASN1/build/libpEpASN1_macOS.a" "${PREFIX}/lib/libasn1.a"
cp "${PARENT_DIR}/libetpan/build-mac/build/libetpan.a" "${PREFIX}/lib"
# Copy Headers
cp -r "${XCODE_PROJECT_DIR}/build/include"/* "${PREFIX}/include"
cp -r "${XCODE_PROJECT_DIR}/Subprojects/pEpASN1/build/include"/* "${PREFIX}/include"
popd
# Cleanup
export MACOSX_DEPLOYMENT_TARGET=10.10

@ -21,8 +21,14 @@ fi
export LDFLAGS="-arch ${ARCH}"
export CC="$(xcrun --sdk ${SDK} -f clang) -arch ${ARCH} -isysroot ${SDK_PATH}"
CLANG_MACOS="$(xcrun --sdk macosx --find clang)"
SDK_PATH_MACOS="$(xcrun --sdk macosx --show-sdk-path)"
# The following command must compile code for macOS, even if all the environment is set up for iOS.
CC_FOR_BUILD="$CLANG_MACOS -isysroot $SDK_PATH_MACOS -mmacosx-version-min=12"
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
PKG_CONFIG_ALLOW_CROSS=1 PKG_CONFIG_PATH=${CURRENT_LIB_DIR}/lib/pkgconfig CC_FOR_BUILD=$CC_FOR_BUILD ./configure --host=${HOST} --prefix=${CURRENT_LIB_DIR} --disable-assembly
make clean
make -j4
make install

@ -4,6 +4,7 @@ if [ -f "${LIB_DIR}/libiconv.a" ]; then
fi
ICONV_DIR="${TMP_DIR}/libiconv"
if [ ! -d "${ICONV_DIR}" ]; then
git clone -b "v1.16_without_lib_prefix_defines" https://gitea.pep.foundation/buff/libiconv.git
fi

@ -5,15 +5,21 @@ fi
VERSION=$(sh "${SCRIPT_DIR}/get-pEp-version.sh" "SEQUOIA_VERSION")
SEQUOIA_DIR="${TMP_DIR}/sequoia-ffi"
SEQUOIA_DIR="${TMP_DIR}/pEpEngineSequoiaBackend"
if [ ! -d "${SEQUOIA_DIR}" ]; then
git clone -b ${VERSION} --depth 1 https://gitlab.com/sequoia-pgp/sequoia-ffi.git
git clone -b ${VERSION} --depth 1 https://gitea.pep.foundation/dirk/pEpEngineSequoiaBackend.git
fi
# NOTE: Needed only for iOS, macOS can generate these automatically.
# TODO: Update these if you update nettle.
NETTLE_BINDINGS="${SCRIPT_DIR}/buildcode/sequoia_resources/nettle-bindings.rs"
PKG_CONFIG_PATH=$OUTPUT_DIR/${ARCH}/lib/pkgconfig
build_ios()
{
cargo update
PKG_CONFIG_ALLOW_CROSS=1 RUST_BACKTRACE=1 PKG_CONFIG_PATH=$OUTPUT_DIR/${ARCH}/lib/pkgconfig RUSTFLAGS="-L ${PREFIX}/lib" cargo build --target ${TARGET} -p sequoia-openpgp-ffi --release
NETTLE_PREGENERATED_BINDINGS="${NETTLE_BINDINGS}" PKG_CONFIG_ALLOW_CROSS=1 RUST_BACKTRACE=1 PKG_CONFIG_PATH=$PKG_CONFIG_PATH RUSTFLAGS="-L ${PREFIX}/lib" cargo build --target ${TARGET} --release
# copy artefacts
cp "${SEQUOIA_DIR}/target/${TARGET}/release"/*.a "${CURRENT_LIB_DIR}/lib"
}
@ -38,5 +44,4 @@ pushd ${SEQUOIA_DIR}
fi
popd
# copy headers
cp -R "${SEQUOIA_DIR}/openpgp-ffi/include"/* "${CURRENT_LIB_DIR}/include/"
# no headers anymore for this backend

File diff suppressed because it is too large Load Diff

@ -1,6 +1,6 @@
# Generates a build script for building fat lib for iOS (ARM64 & x86_64).
# Pass PREFIX as argument. If not passed, "local/" is used as deafult.
# To generate the script the specific `buildcode/$NAME_OF_LIB_TO_BUILD.code` is merged into the commont `build-ios_dependency.template` and saved to `generated.sh`
# To generate the script the specific `buildcode/$NAME_OF_LIB_TO_BUILD.code` is merged into the common `build-ios_dependency.template` and saved to `generated.sh`
# Exit on errors
set -e
@ -17,7 +17,8 @@ mkdir -p "${PREFIX}"
pushd "${PREFIX}"
PREFIX=$(pwd)
popd
GENERATED_SCRIPT="${SCRIPT_DIR}/generated.sh"
GENERATED_SCRIPT="${SCRIPT_DIR}/${LIB_NAME}_generated.sh"
exitAndPrintHelp()
{
@ -45,3 +46,11 @@ sh ${GENERATED_SCRIPT} ${PREFIX}
# Cleanup
rm -rf "${TMP_DIR}"
rm ${GENERATED_SCRIPT}
unset PREFIX
unset CXXFLAGS
unset CXX
unset CFLAGS
unset LDFLAGS
unset CC

@ -1,6 +1,6 @@
# Generates a build script for building fat lib for macOS (ARM64 & x86_64).
# Pass PREFIX as argument. If not passed, "local/" is used as deafult.
# To generate the script the specific `buildcode/$NAME_OF_LIB_TO_BUILD.code` is merged into the commont `build-macos_dependency.template` and saved to `generated.sh`
# To generate the script the specific `buildcode/$NAME_OF_LIB_TO_BUILD.code` is merged into the common `build-macos_dependency.template` and saved to `generated.sh`
# Exit on errors
set -e
@ -17,7 +17,8 @@ mkdir -p "${PREFIX}"
pushd "${PREFIX}"
PREFIX=$(pwd)
popd
GENERATED_SCRIPT="${SCRIPT_DIR}/generated.sh"
GENERATED_SCRIPT="${SCRIPT_DIR}/${LIB_NAME}_generated.sh"
exitAndPrintHelp()
{
@ -45,6 +46,7 @@ sh ${GENERATED_SCRIPT} ${PREFIX}
# Cleanup
rm -rf "${TMP_DIR}"
rm ${GENERATED_SCRIPT}
unset PREFIX
unset CXXFLAGS

Loading…
Cancel
Save