From e12e14ef030c7f9dc4d082eb6b7ea731973993d1 Mon Sep 17 00:00:00 2001 From: Maarten Billemont Date: Sun, 20 May 2018 14:24:58 -0400 Subject: [PATCH] Move library builds into /lib so they can be shared. Also made the library build script more generic. --- .gitmodules | 8 +- lib/bin/build_lib | 242 ++++++++++++++++++ lib/bin/build_libjson-c-ios | 8 + lib/bin/build_libjson-c-macos | 8 + lib/bin/build_libsodium-ios | 4 + lib/bin/build_libsodium-macos | 4 + {platform-darwin/External => lib}/libjson-c | 0 {platform-darwin/External => lib}/libsodium | 0 .../project.pbxproj | 21 +- .../project.pbxproj | 88 +++---- platform-darwin/Scripts/build_libjson-c-ios | 91 ------- platform-darwin/Scripts/build_libjson-c-osx | 32 --- platform-darwin/Scripts/build_libsodium-ios | 91 ------- platform-darwin/Scripts/build_libsodium-osx | 33 --- platform-darwin/Scripts/updateDependencies | 41 --- 15 files changed, 325 insertions(+), 346 deletions(-) create mode 100755 lib/bin/build_lib create mode 100755 lib/bin/build_libjson-c-ios create mode 100755 lib/bin/build_libjson-c-macos create mode 100755 lib/bin/build_libsodium-ios create mode 100755 lib/bin/build_libsodium-macos rename {platform-darwin/External => lib}/libjson-c (100%) rename {platform-darwin/External => lib}/libsodium (100%) delete mode 100755 platform-darwin/Scripts/build_libjson-c-ios delete mode 100755 platform-darwin/Scripts/build_libjson-c-osx delete mode 100755 platform-darwin/Scripts/build_libsodium-ios delete mode 100755 platform-darwin/Scripts/build_libsodium-osx delete mode 100755 platform-darwin/Scripts/updateDependencies diff --git a/.gitmodules b/.gitmodules index 8181780d..c10e5d70 100644 --- a/.gitmodules +++ b/.gitmodules @@ -19,11 +19,11 @@ [submodule "MasterPassword/Web/js/mpw-js"] path = platform-independent/web-js/js/mpw-js url = https://github.com/tmthrgd/mpw-js.git -[submodule "platform-darwin/External/libsodium"] - path = platform-darwin/External/libsodium +[submodule "lib/libsodium"] + path = lib/libsodium url = https://github.com/jedisct1/libsodium.git -[submodule "platform-darwin/External/libjson-c"] - path = platform-darwin/External/libjson-c +[submodule "lib/libjson-c"] + path = lib/libjson-c url = https://github.com/lhunath/json-c.git [submodule "public/site"] path = public/site diff --git a/lib/bin/build_lib b/lib/bin/build_lib new file mode 100755 index 00000000..445119a9 --- /dev/null +++ b/lib/bin/build_lib @@ -0,0 +1,242 @@ +#!/usr/bin/env bash +# +# Your build script should simply source this script, optionally override any build hooks and then invoke `build`. +# The build product should be available under `build-~/out`, under the library path. +# +# Hook lifecycle: +# - build +# - initialize +# - needs +# - clean +# - prepare +# - target +# - prepare +# - configure +# - build +# - finalize +# - merge +# - clean +# +# You can override any of these hooks to provide a custom implementation or call their underscore variant to delegate to the default implementation. +# For example: +# target_prepare() { make -s distclean; } +# target_configure() { _target_configure "$@" --enable-minimal; } +set -e + +# needs ... +# +# Utility for ensuring all tools needed by the script are installed prior to starting. +needs() { _needs "$@"; } +_needs() { + local failed=0 + for tool; do + hash "$tool" || { echo >&2 "Missing: $tool. Please install this tool."; (( failed++ )); } + done + + return $failed +} + +# initialize +# +# The build script invokes this once prior to all other actions if the user wants a clean slate. +initialize() { _initialize "$@"; } +_initialize() { + initialize_needs "$@" + initialize_clean "$@" +} + +# initialize_needs +# +# Check if all tools needed for the default implementations are available. +# +# By default, this will check for `automake` and `autoreconf`. +initialize_needs() { _initialize_needs "$@"; } +_initialize_needs() { + needs automake autoreconf +} + +# initialize_clean +# +# Perform any necessary clean-up of the library code prior to building. +# +# By default, this will run `make distclean`. +initialize_clean() { _initialize_clean "$@"; } +_initialize_clean() { + [[ ! -e Makefile ]] || make -s distclean +} + +# prepare [ ...] +# +# Configure the library for building the s on this machine. +# The build script invokes this once prior to building each of its targets. +# The has been newly created. +# +# By default, this will run `autoreconf`. +prepare() { _prepare "$@"; } +_prepare() { + local prefix=$1; shift 1 + + autoreconf --verbose --install --symlink 2> >(sed 's/^\([^:]*\):[0-9]\{1,\}: /\1: /') +} + +# target +# +# Build the library for the given and into the given . +# The build script invokes this function when it's ready to build the library's code. +# Generic platform-specific environment setup has been done. +target() { _target "$@"; } +_target() { + target_prepare "$@" + target_configure "$@" + target_build "$@" +} + +# target_prepare +# +# Prepare the library configuration for building the target. +# +# By default, this will run `make clean` if a Makefile is found. +target_prepare() { _target_prepare "$@"; } +_target_prepare() { + local prefix=$1 arch=$2 platform=$3; shift 3 + [[ ! -e Makefile ]] || make -s clean +} + +# target_configure [ ...] +# +# Configure the library for building the target. +# +# By default, this will run `./configure --host= --prefix=/ --disable-shared `. +target_configure() { _target_configure "$@"; } +_target_configure() { + local prefix=$1 arch=$2 platform=$3 cpu=$arch; shift 3 + [[ $cpu = *arm* ]] && cpu=arm + + ./configure ${cpu:+--host="$cpu"} --prefix="$prefix/$arch" --disable-shared "$@" +} + +# target_build +# +# Build the library code for the target. +# +# By default, this will run `make check install`. +target_build() { _target_build "$@"; } +_target_build() { + local prefix=$1 arch=$2 platform=$3; shift 3 + #make -j3 check + make -j3 install +} + +# finalize [ ... ] +# +# Prepare the final build product. +# The build script invokes this once after a successful build of all targets. +finalize() { _finalize "$@"; } +_finalize() { + finalize_merge "$@" + finalize_clean "$@" +} + +# finalize_merge [ ... ] +# +# Merge all targets into a product the application can use, available at `/out`. +# +# By default, this will copy the headers to `/out/include` and merge the libraries into `/out/lib`. +finalize_merge() { _finalize_merge "$@"; } +_finalize_merge() { + local prefix=$1; shift 1 + + mv -f -- "$prefix/$1/include" "$prefix/out/" + + mkdir -p "$prefix/out/lib" + for lib in "$prefix/$1/lib/"*; do + if lipo -info "$lib" >/dev/null 2>&1; then + local lib=("${lib##*/}") libs=("${@/#/$prefix/}") libs=("${libs[@]/%//lib/$lib}") + lipo -create "${libs[@]}" -output "$prefix/out/lib/$lib" + fi + done +} + +# finalize_clean [ ... ] +# +# Clean up the library after a successful build (eg. housekeeping of temporary files). +# +# By default, this will run `make distclean`. +finalize_clean() { _finalize_clean "$@"; } +_finalize_clean() { + [[ ! -e Makefile ]] || make -s distclean +} + +# build [] +# +# Build the library (found at ../) for platform (or "host" if unspecified). +build() { _build "$@"; } +_build() { + local name=$1 platform=${2:-host} + local path="../$name" + [[ $path = /* ]] || path="${BASH_SOURCE%/*}/$path" + cd "$path" + + if [[ $platform = host ]]; then + case "$(uname -s)" in + 'Darwin') platform='macos' archs=( "$(uname -m)" ) ;; + esac + fi + if (( ! ${#archs[@]} )); then + case "$platform" in + 'macos') archs=( 'x86_64' ) ;; + 'ios') archs=( 'i386' 'x86_64' 'armv7' 'armv7s' 'arm64' ) ;; + esac + fi + + local prefix="$PWD/build-$platform~" + initialize "$prefix" + + # "clean" argument wipes the prefix and exits. If lib exists in prefix, skip build. + if [[ ${BASH_ARGV[@]:(-1)} = clean ]]; then + rm -rf "$prefix" + exit + elif files=( "$prefix"/out/lib/* ) && [[ -e $files ]]; then + echo >&2 "Output product already exists: ${files[*]}. Skipping build." + exit + fi + + # Prepare the output location and build configuration. + mkdir -p "$prefix/out" + prepare "$prefix" "${archs[@]}" + + # Repeat the build for each individual architecture. + for arch in "${archs[@]}"; do ( + + # Set up a base environment for the platform. + case "$platform" in + 'macos') + SDKROOT="$(xcrun --show-sdk-path --sdk macosx)" + export PATH="$(xcrun --show-sdk-platform-path --sdk macosx)/usr/bin:$PATH" + export CFLAGS="-arch $arch -isysroot $SDKROOT -mmacosx-version-min=${MACOSX_DEPLOYMENT_TARGET:-10.8} -O2 -flto -g $CFLAGS" + export LDFLAGS="-arch $arch -isysroot $SDKROOT -mmacosx-version-min=${MACOSX_DEPLOYMENT_TARGET:-10.8} -flto $LDFLAGS" + export CPPFLAGS="$CFLAGS $CPPFLAGS" + ;; + 'ios') + if [[ $arch = *arm* ]]; then + SDKROOT="$(xcrun --show-sdk-path --sdk iphoneos)" + export PATH="$(xcrun --show-sdk-platform-path --sdk iphoneos)/usr/bin:$PATH" + export CFLAGS="-mthumb -arch $arch -isysroot $SDKROOT -mios-version-min=${IPHONEOS_DEPLOYMENT_TARGET:-8.0} -O2 -flto -g $CFLAGS" + export LDFLAGS="-mthumb -arch $arch -isysroot $SDKROOT -mios-version-min=${IPHONEOS_DEPLOYMENT_TARGET:-8.0} -flto $LDFLAGS" + export CPPFLAGS="$CFLAGS $CPPFLAGS" + else + SDKROOT="$(xcrun --show-sdk-path --sdk iphonesimulator)" + export PATH="$(xcrun --show-sdk-platform-path --sdk iphonesimulator)/usr/bin:$PATH" + export CFLAGS="-arch $arch -isysroot $SDKROOT -mios-simulator-version-min=${IPHONEOS_DEPLOYMENT_TARGET:-8.0} -O2 -flto -g $CFLAGS" + export LDFLAGS="-arch $arch -isysroot $SDKROOT -mios-simulator-version-min=${IPHONEOS_DEPLOYMENT_TARGET:-8.0} -flto $LDFLAGS" + export CPPFLAGS="$CFLAGS $CPPFLAGS" + fi + ;; + esac + + target "$prefix" "$arch" "$platform" + ); done + + finalize "$prefix" "${archs[@]}" +} + diff --git a/lib/bin/build_libjson-c-ios b/lib/bin/build_libjson-c-ios new file mode 100755 index 00000000..47b02a6d --- /dev/null +++ b/lib/bin/build_libjson-c-ios @@ -0,0 +1,8 @@ +#!/usr/bin/env bash +source "${BASH_SOURCE%/*}/build_lib" + +autoreconf() { + command autoreconf -Iautoconf-archive/m4 "$@" +} + +build libjson-c ios diff --git a/lib/bin/build_libjson-c-macos b/lib/bin/build_libjson-c-macos new file mode 100755 index 00000000..418f63bc --- /dev/null +++ b/lib/bin/build_libjson-c-macos @@ -0,0 +1,8 @@ +#!/usr/bin/env bash +source "${BASH_SOURCE%/*}/build_lib" + +autoreconf() { + command autoreconf -Iautoconf-archive/m4 "$@" +} + +build libjson-c macos diff --git a/lib/bin/build_libsodium-ios b/lib/bin/build_libsodium-ios new file mode 100755 index 00000000..b243d1d5 --- /dev/null +++ b/lib/bin/build_libsodium-ios @@ -0,0 +1,4 @@ +#!/usr/bin/env bash +source "${BASH_SOURCE%/*}/build_lib" + +build libsodium ios diff --git a/lib/bin/build_libsodium-macos b/lib/bin/build_libsodium-macos new file mode 100755 index 00000000..2c931357 --- /dev/null +++ b/lib/bin/build_libsodium-macos @@ -0,0 +1,4 @@ +#!/usr/bin/env bash +source "${BASH_SOURCE%/*}/build_lib" + +build libsodium macos diff --git a/platform-darwin/External/libjson-c b/lib/libjson-c similarity index 100% rename from platform-darwin/External/libjson-c rename to lib/libjson-c diff --git a/platform-darwin/External/libsodium b/lib/libsodium similarity index 100% rename from platform-darwin/External/libsodium rename to lib/libsodium diff --git a/platform-darwin/MasterPassword-iOS.xcodeproj/project.pbxproj b/platform-darwin/MasterPassword-iOS.xcodeproj/project.pbxproj index a92f2a19..52eb7dcb 100644 --- a/platform-darwin/MasterPassword-iOS.xcodeproj/project.pbxproj +++ b/platform-darwin/MasterPassword-iOS.xcodeproj/project.pbxproj @@ -1789,7 +1789,7 @@ DA0979151E9A81EE00F0BFE8 /* lib */, ); name = "libsodium-ios"; - path = "libsodium/libsodium-ios"; + path = "../../lib/libsodium/build-ios~/out"; sourceTree = ""; }; DA0978D91E9A81EE00F0BFE8 /* include */ = { @@ -2128,7 +2128,7 @@ DAB7AE751F3D755B00C856B1 /* lib */, ); name = "libjson-c-ios"; - path = "libjson-c/libjson-c-ios"; + path = "../../lib/libjson-c/build-ios~/out"; sourceTree = ""; }; DAB7AE5F1F3D755B00C856B1 /* include */ = { @@ -3389,7 +3389,7 @@ buildConfigurationList = DAB7AE411F3D464A00C856B1 /* Build configuration list for PBXLegacyTarget "libjson-c-ios" */; buildPhases = ( ); - buildToolPath = "Scripts/build_libjson-c-ios"; + buildToolPath = "../lib/bin/build_libjson-c-ios"; buildWorkingDirectory = ""; dependencies = ( ); @@ -3403,7 +3403,8 @@ buildConfigurationList = DAB7AE481F3D468300C856B1 /* Build configuration list for PBXLegacyTarget "libsodium-ios" */; buildPhases = ( ); - buildToolPath = "Scripts/build_libsodium-ios"; + buildToolPath = "../lib/bin/build_libsodium-ios"; + buildWorkingDirectory = ""; dependencies = ( ); name = "libsodium-ios"; @@ -4360,8 +4361,8 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; LIBRARY_SEARCH_PATHS = ( "$(inherited)", - "$(PROJECT_DIR)/External/libsodium/libsodium-ios/lib", - "$(PROJECT_DIR)/External/libjson-c/libjson-c-ios/lib", + "$(PROJECT_DIR)/../lib/libsodium/build-ios~/out/lib", + "$(PROJECT_DIR)/../lib/libjson-c/build-ios~/out/lib", ); OTHER_CFLAGS = ( "-DMPW_SODIUM=1", @@ -4685,8 +4686,8 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; LIBRARY_SEARCH_PATHS = ( "$(inherited)", - "$(PROJECT_DIR)/External/libsodium/libsodium-ios/lib", - "$(PROJECT_DIR)/External/libjson-c/libjson-c-ios/lib", + "$(PROJECT_DIR)/../lib/libsodium/build-ios~/out/lib", + "$(PROJECT_DIR)/../lib/libjson-c/build-ios~/out/lib", ); OTHER_CFLAGS = ( "-DMPW_SODIUM=1", @@ -4724,8 +4725,8 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; LIBRARY_SEARCH_PATHS = ( "$(inherited)", - "$(PROJECT_DIR)/External/libsodium/libsodium-ios/lib", - "$(PROJECT_DIR)/External/libjson-c/libjson-c-ios/lib", + "$(PROJECT_DIR)/../lib/libsodium/build-ios~/out/lib", + "$(PROJECT_DIR)/../lib/libjson-c/build-ios~/out/lib", ); OTHER_CFLAGS = ( "-DMPW_SODIUM=1", diff --git a/platform-darwin/MasterPassword-macOS.xcodeproj/project.pbxproj b/platform-darwin/MasterPassword-macOS.xcodeproj/project.pbxproj index 8bfe746c..236fde60 100644 --- a/platform-darwin/MasterPassword-macOS.xcodeproj/project.pbxproj +++ b/platform-darwin/MasterPassword-macOS.xcodeproj/project.pbxproj @@ -1203,14 +1203,14 @@ /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ - DA0979181E9A824700F0BFE8 /* libsodium-osx */ = { + DA0979181E9A824700F0BFE8 /* libsodium-macos */ = { isa = PBXGroup; children = ( DA0979191E9A824700F0BFE8 /* include */, DA0979551E9A824700F0BFE8 /* lib */, ); - name = "libsodium-osx"; - path = "libsodium/libsodium-osx"; + name = "libsodium-macos"; + path = "../../lib/libsodium/build-macos~/out"; sourceTree = ""; }; DA0979191E9A824700F0BFE8 /* include */ = { @@ -1944,14 +1944,14 @@ path = KCOrderedAccessorFix; sourceTree = ""; }; - DAB7AE781F3D757B00C856B1 /* libjson-c-osx */ = { + DAB7AE781F3D757B00C856B1 /* libjson-c-macos */ = { isa = PBXGroup; children = ( DAB7AE791F3D757B00C856B1 /* include */, DAB7AE8F1F3D757B00C856B1 /* lib */, ); - name = "libjson-c-osx"; - path = "libjson-c/libjson-c-osx"; + name = "libjson-c-macos"; + path = "../../lib/libjson-c/build-macos~/out"; sourceTree = ""; }; DAB7AE791F3D757B00C856B1 /* include */ = { @@ -2011,8 +2011,8 @@ DACA22121705DDC5002C6C22 /* External */ = { isa = PBXGroup; children = ( - DAB7AE781F3D757B00C856B1 /* libjson-c-osx */, - DA0979181E9A824700F0BFE8 /* libsodium-osx */, + DAB7AE781F3D757B00C856B1 /* libjson-c-macos */, + DA0979181E9A824700F0BFE8 /* libsodium-macos */, DACA29751705E2BD002C6C22 /* jrswizzle */, DAADCC6819FB007F00987B1D /* KCOrderedAccessorFix */, DA3B8449190FC5A900246EEA /* Mac */, @@ -2312,31 +2312,31 @@ /* End PBXHeadersBuildPhase section */ /* Begin PBXLegacyTarget section */ - DA5B0B611F3D416500B663F0 /* libsodium-osx */ = { + DA5B0B611F3D416500B663F0 /* libsodium-macos */ = { isa = PBXLegacyTarget; buildArgumentsString = "$(ACTION)"; - buildConfigurationList = DA5B0B621F3D416500B663F0 /* Build configuration list for PBXLegacyTarget "libsodium-osx" */; + buildConfigurationList = DA5B0B621F3D416500B663F0 /* Build configuration list for PBXLegacyTarget "libsodium-macos" */; buildPhases = ( ); - buildToolPath = "Scripts/build_libsodium-osx"; + buildToolPath = "../lib/bin/build_libsodium-macos"; buildWorkingDirectory = ""; dependencies = ( ); - name = "libsodium-osx"; + name = "libsodium-macos"; passBuildSettingsInEnvironment = 1; productName = "libsodium-osx"; }; - DAB7AE421F3D466D00C856B1 /* libjson-c-osx */ = { + DAB7AE421F3D466D00C856B1 /* libjson-c-macos */ = { isa = PBXLegacyTarget; buildArgumentsString = "$(ACTION)"; - buildConfigurationList = DAB7AE431F3D466D00C856B1 /* Build configuration list for PBXLegacyTarget "libjson-c-osx" */; + buildConfigurationList = DAB7AE431F3D466D00C856B1 /* Build configuration list for PBXLegacyTarget "libjson-c-macos" */; buildPhases = ( ); - buildToolPath = "Scripts/build_libjson-c-osx"; + buildToolPath = "../lib/bin/build_libjson-c-macos"; buildWorkingDirectory = ""; dependencies = ( ); - name = "libjson-c-osx"; + name = "libjson-c-macos"; passBuildSettingsInEnvironment = 1; productName = "libjson-c"; }; @@ -2553,8 +2553,8 @@ DA67743A1A474A03004F356A /* mpw-test */, DA1C7AC61F1A8FD8009A3551 /* mpw-bench */, DA1C7AA61F1A8F24009A3551 /* mpw-cli */, - DA5B0B611F3D416500B663F0 /* libsodium-osx */, - DAB7AE421F3D466D00C856B1 /* libjson-c-osx */, + DA5B0B611F3D416500B663F0 /* libsodium-macos */, + DAB7AE421F3D466D00C856B1 /* libjson-c-macos */, ); }; /* End PBXProject section */ @@ -2843,32 +2843,32 @@ /* Begin PBXTargetDependency section */ DAB7AE351F3D423600C856B1 /* PBXTargetDependency */ = { isa = PBXTargetDependency; - target = DA5B0B611F3D416500B663F0 /* libsodium-osx */; + target = DA5B0B611F3D416500B663F0 /* libsodium-macos */; targetProxy = DAB7AE341F3D423600C856B1 /* PBXContainerItemProxy */; }; DAB7AE371F3D423D00C856B1 /* PBXTargetDependency */ = { isa = PBXTargetDependency; - target = DA5B0B611F3D416500B663F0 /* libsodium-osx */; + target = DA5B0B611F3D416500B663F0 /* libsodium-macos */; targetProxy = DAB7AE361F3D423D00C856B1 /* PBXContainerItemProxy */; }; DAB7AE391F3D424200C856B1 /* PBXTargetDependency */ = { isa = PBXTargetDependency; - target = DA5B0B611F3D416500B663F0 /* libsodium-osx */; + target = DA5B0B611F3D416500B663F0 /* libsodium-macos */; targetProxy = DAB7AE381F3D424200C856B1 /* PBXContainerItemProxy */; }; DAB7AE3B1F3D424700C856B1 /* PBXTargetDependency */ = { isa = PBXTargetDependency; - target = DA5B0B611F3D416500B663F0 /* libsodium-osx */; + target = DA5B0B611F3D416500B663F0 /* libsodium-macos */; targetProxy = DAB7AE3A1F3D424700C856B1 /* PBXContainerItemProxy */; }; DAB7AE521F3D649400C856B1 /* PBXTargetDependency */ = { isa = PBXTargetDependency; - target = DAB7AE421F3D466D00C856B1 /* libjson-c-osx */; + target = DAB7AE421F3D466D00C856B1 /* libjson-c-macos */; targetProxy = DAB7AE511F3D649400C856B1 /* PBXContainerItemProxy */; }; DAB7AE581F3D64A600C856B1 /* PBXTargetDependency */ = { isa = PBXTargetDependency; - target = DAB7AE421F3D466D00C856B1 /* libjson-c-osx */; + target = DAB7AE421F3D466D00C856B1 /* libjson-c-macos */; targetProxy = DAB7AE571F3D64A600C856B1 /* PBXContainerItemProxy */; }; DABFA072176E3FDF00E83589 /* PBXTargetDependency */ = { @@ -3036,8 +3036,8 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks"; LIBRARY_SEARCH_PATHS = ( "$(inherited)", - "$(PROJECT_DIR)/External/libsodium/libsodium-osx/lib", - "$(PROJECT_DIR)/External/libjson-c/libjson-c-osx/lib", + "$(PROJECT_DIR)/../lib/libsodium/build-macos~/out/lib", + "$(PROJECT_DIR)/../lib/libjson-c/build-macos~/out/lib", ); OTHER_CFLAGS = ( "-DMPW_SODIUM=1", @@ -3094,7 +3094,7 @@ ); LIBRARY_SEARCH_PATHS = ( "$(inherited)", - "$(PROJECT_DIR)/External/libsodium/libsodium-osx/lib", + "$(PROJECT_DIR)/../lib/libsodium/build-macos~/out/lib", ); OTHER_CFLAGS = ( "-DMPW_SODIUM=1", @@ -3109,8 +3109,8 @@ CLANG_WARN_DOCUMENTATION_COMMENTS = NO; LIBRARY_SEARCH_PATHS = ( "$(inherited)", - "$(PROJECT_DIR)/External/libsodium/libsodium-osx/lib", - "$(PROJECT_DIR)/External/libjson-c/libjson-c-osx/lib", + "$(PROJECT_DIR)/../lib/libsodium/build-macos~/out/lib", + "$(PROJECT_DIR)/../lib/libjson-c/build-macos~/out/lib", ); OTHER_CFLAGS = ( "-DMPW_SODIUM=1", @@ -3128,8 +3128,8 @@ CLANG_WARN_DOCUMENTATION_COMMENTS = NO; LIBRARY_SEARCH_PATHS = ( "$(inherited)", - "$(PROJECT_DIR)/External/libsodium/libsodium-osx/lib", - "$(PROJECT_DIR)/External/libjson-c/libjson-c-osx/lib", + "$(PROJECT_DIR)/../lib/libsodium/build-macos~/out/lib", + "$(PROJECT_DIR)/../lib/libjson-c/build-macos~/out/lib", ); OTHER_CFLAGS = ( "-DMPW_SODIUM=1", @@ -3147,8 +3147,8 @@ CLANG_WARN_DOCUMENTATION_COMMENTS = NO; LIBRARY_SEARCH_PATHS = ( "$(inherited)", - "$(PROJECT_DIR)/External/libsodium/libsodium-osx/lib", - "$(PROJECT_DIR)/External/libjson-c/libjson-c-osx/lib", + "$(PROJECT_DIR)/../lib/libsodium/build-macos~/out/lib", + "$(PROJECT_DIR)/../lib/libjson-c/build-macos~/out/lib", ); OTHER_CFLAGS = ( "-DMPW_SODIUM=1", @@ -3166,7 +3166,7 @@ CLANG_WARN_DOCUMENTATION_COMMENTS = NO; LIBRARY_SEARCH_PATHS = ( "$(inherited)", - "$(PROJECT_DIR)/External/libsodium/libsodium-osx/lib", + "$(PROJECT_DIR)/../lib/libsodium/build-macos~/out/lib", ); OTHER_CFLAGS = ( "-DMPW_SODIUM=1", @@ -3182,7 +3182,7 @@ CLANG_WARN_DOCUMENTATION_COMMENTS = NO; LIBRARY_SEARCH_PATHS = ( "$(inherited)", - "$(PROJECT_DIR)/External/libsodium/libsodium-osx/lib", + "$(PROJECT_DIR)/../lib/libsodium/build-macos~/out/lib", ); OTHER_CFLAGS = ( "-DMPW_SODIUM=1", @@ -3198,7 +3198,7 @@ CLANG_WARN_DOCUMENTATION_COMMENTS = NO; LIBRARY_SEARCH_PATHS = ( "$(inherited)", - "$(PROJECT_DIR)/External/libsodium/libsodium-osx/lib", + "$(PROJECT_DIR)/../lib/libsodium/build-macos~/out/lib", ); OTHER_CFLAGS = ( "-DMPW_SODIUM=1", @@ -3499,8 +3499,8 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks"; LIBRARY_SEARCH_PATHS = ( "$(inherited)", - "$(PROJECT_DIR)/External/libsodium/libsodium-osx/lib", - "$(PROJECT_DIR)/External/libjson-c/libjson-c-osx/lib", + "$(PROJECT_DIR)/../lib/libsodium/build-macos~/out/lib", + "$(PROJECT_DIR)/../lib/libjson-c/build-macos~/out/lib", ); OTHER_CFLAGS = ( "-DMPW_SODIUM=1", @@ -3531,8 +3531,8 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks"; LIBRARY_SEARCH_PATHS = ( "$(inherited)", - "$(PROJECT_DIR)/External/libsodium/libsodium-osx/lib", - "$(PROJECT_DIR)/External/libjson-c/libjson-c-osx/lib", + "$(PROJECT_DIR)/../lib/libsodium/build-macos~/out/lib", + "$(PROJECT_DIR)/../lib/libjson-c/build-macos~/out/lib", ); OTHER_CFLAGS = ( "-DMPW_SODIUM=1", @@ -3555,7 +3555,7 @@ ); LIBRARY_SEARCH_PATHS = ( "$(inherited)", - "$(PROJECT_DIR)/External/libsodium/libsodium-osx/lib", + "$(PROJECT_DIR)/../lib/libsodium/build-macos~/out/lib", ); OTHER_CFLAGS = ( "-DMPW_SODIUM=1", @@ -3575,7 +3575,7 @@ ); LIBRARY_SEARCH_PATHS = ( "$(inherited)", - "$(PROJECT_DIR)/External/libsodium/libsodium-osx/lib", + "$(PROJECT_DIR)/../lib/libsodium/build-macos~/out/lib", ); OTHER_CFLAGS = ( "-DMPW_SODIUM=1", @@ -3734,7 +3734,7 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Test; }; - DA5B0B621F3D416500B663F0 /* Build configuration list for PBXLegacyTarget "libsodium-osx" */ = { + DA5B0B621F3D416500B663F0 /* Build configuration list for PBXLegacyTarget "libsodium-macos" */ = { isa = XCConfigurationList; buildConfigurations = ( DA5B0B631F3D416500B663F0 /* Debug */, @@ -3784,7 +3784,7 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Test; }; - DAB7AE431F3D466D00C856B1 /* Build configuration list for PBXLegacyTarget "libjson-c-osx" */ = { + DAB7AE431F3D466D00C856B1 /* Build configuration list for PBXLegacyTarget "libjson-c-macos" */ = { isa = XCConfigurationList; buildConfigurations = ( DAB7AE441F3D466D00C856B1 /* Debug */, diff --git a/platform-darwin/Scripts/build_libjson-c-ios b/platform-darwin/Scripts/build_libjson-c-ios deleted file mode 100755 index 3647916b..00000000 --- a/platform-darwin/Scripts/build_libjson-c-ios +++ /dev/null @@ -1,91 +0,0 @@ -#!/usr/bin/env bash -set -e - -hash automake || { echo >&2 "Missing automake."; exit 1; } -hash autoreconf || { echo >&2 "Missing autoconf."; exit 1; } -hash libtool || hash glibtool || { echo >&2 "Missing libtool."; exit 1; } - -cd "${BASH_SOURCE%/*}/../External/libjson-c" -[[ $1 = clean ]] && { [[ ! -e Makefile ]] || make -s distclean; exit; } -[[ -e "${prefix=$PWD/libjson-c-ios}/lib/libjson-c.a" ]] && exit - -# Prepare -autoreconf -Iautoconf-archive/m4 --verbose --install --symlink 2> >(sed 's/^\([^:]*\):[0-9]\{1,\}: /\1: /') -rm -rf "${prefix=$PWD/libjson-c-ios}" -mkdir -p "$prefix/lib" \ - "${prefix_i386=$prefix/tmp/i386}" \ - "${prefix_x86_64=$prefix/tmp/x86_64}" \ - "${prefix_armv7=$prefix/tmp/armv7}" \ - "${prefix_armv7s=$prefix/tmp/armv7s}" \ - "${prefix_arm64=$prefix/tmp/arm64}" - -# Targets -( - ## ARCH: i386 - SDKROOT="$(xcrun --show-sdk-path --sdk iphonesimulator)" - PATH="$(xcrun --show-sdk-platform-path --sdk iphonesimulator)/usr/bin:$PATH" - export CFLAGS="-arch i386 -isysroot $SDKROOT -mios-simulator-version-min=${IPHONEOS_DEPLOYMENT_TARGET:-8.0} -O2 -g $CFLAGS" - export LDFLAGS="-arch i386 -isysroot $SDKROOT -mios-simulator-version-min=${IPHONEOS_DEPLOYMENT_TARGET:-8.0} $LDFLAGS" - export CPPFLAGS="$CFLAGS $CPPFLAGS" - [[ -e Makefile ]] && make -s clean - ./configure --host=i686-apple --disable-shared --prefix="$prefix_i386" - make -j3 install -) -( - ## ARCH: x86_64 - SDKROOT="$(xcrun --show-sdk-path --sdk iphonesimulator)" - PATH="$(xcrun --show-sdk-platform-path --sdk iphonesimulator)/usr/bin:$PATH" - export CFLAGS="-arch x86_64 -isysroot $SDKROOT -mios-simulator-version-min=${IPHONEOS_DEPLOYMENT_TARGET:-8.0} -O2 -g $CFLAGS" - export LDFLAGS="-arch x86_64 -isysroot $SDKROOT -mios-simulator-version-min=${IPHONEOS_DEPLOYMENT_TARGET:-8.0} $LDFLAGS" - export CPPFLAGS="$CFLAGS $CPPFLAGS" - [[ -e Makefile ]] && make -s clean - ./configure --host=x86_64-apple --disable-shared --prefix="$prefix_x86_64" - make -j3 install -) -( - ## ARCH: armv7 - SDKROOT="$(xcrun --show-sdk-path --sdk iphoneos)" - PATH="$(xcrun --show-sdk-platform-path --sdk iphoneos)/usr/bin:$PATH" - export CFLAGS="-mthumb -arch armv7 -isysroot $SDKROOT -mios-version-min=${IPHONEOS_DEPLOYMENT_TARGET:-8.0} -O2 -g $CFLAGS" - export LDFLAGS="-mthumb -arch armv7 -isysroot $SDKROOT -mios-version-min=${IPHONEOS_DEPLOYMENT_TARGET:-8.0} $LDFLAGS" - export CPPFLAGS="$CFLAGS $CPPFLAGS" - [[ -e Makefile ]] && make -s clean - ./configure --host=x86_64-apple --target=arm-apple --disable-shared --prefix="$prefix_armv7" - make -j3 install -) -( - ## ARCH: armv7s - SDKROOT="$(xcrun --show-sdk-path --sdk iphoneos)" - PATH="$(xcrun --show-sdk-platform-path --sdk iphoneos)/usr/bin:$PATH" - export CFLAGS="-mthumb -arch armv7s -isysroot $SDKROOT -mios-version-min=${IPHONEOS_DEPLOYMENT_TARGET:-8.0} -O2 -g $CFLAGS" - export LDFLAGS="-mthumb -arch armv7s -isysroot $SDKROOT -mios-version-min=${IPHONEOS_DEPLOYMENT_TARGET:-8.0} $LDFLAGS" - export CPPFLAGS="$CFLAGS $CPPFLAGS" - [[ -e Makefile ]] && make -s clean - ./configure --host=x86_64-apple --target=arm-apple --disable-shared --prefix="$prefix_armv7s" - make -j3 install -) -( - ## ARCH: arm64 - SDKROOT="$(xcrun --show-sdk-path --sdk iphoneos)" - PATH="$(xcrun --show-sdk-platform-path --sdk iphoneos)/usr/bin:$PATH" - export CFLAGS="-mthumb -arch arm64 -isysroot $SDKROOT -mios-version-min=${IPHONEOS_DEPLOYMENT_TARGET:-8.0} -O2 -g $CFLAGS" - export LDFLAGS="-mthumb -arch arm64 -isysroot $SDKROOT -mios-version-min=${IPHONEOS_DEPLOYMENT_TARGET:-8.0} $LDFLAGS" - export CPPFLAGS="$CFLAGS $CPPFLAGS" - [[ -e Makefile ]] && make -s clean - ./configure --host=x86_64-apple --target=arm-apple --disable-shared --prefix="$prefix_arm64" - make -j3 install -) - -# Merge Binaries -mv -f -- "$prefix_arm64/include" "$prefix/" -lipo -create \ - "$prefix_i386/lib/libjson-c.a" \ - "$prefix_x86_64/lib/libjson-c.a" \ - "$prefix_armv7/lib/libjson-c.a" \ - "$prefix_armv7s/lib/libjson-c.a" \ - "$prefix_arm64/lib/libjson-c.a" \ - -output "$prefix/lib/libjson-c.a" - -# Cleanup -rm -rf -- "$prefix/tmp" -make -s really-clean diff --git a/platform-darwin/Scripts/build_libjson-c-osx b/platform-darwin/Scripts/build_libjson-c-osx deleted file mode 100755 index 41bc1c02..00000000 --- a/platform-darwin/Scripts/build_libjson-c-osx +++ /dev/null @@ -1,32 +0,0 @@ -#!/usr/bin/env bash -set -e - -hash automake || { echo >&2 "Missing automake."; exit 1; } -hash autoreconf || { echo >&2 "Missing autoconf."; exit 1; } -hash libtool || hash glibtool || { echo >&2 "Missing libtool."; exit 1; } - -cd "${BASH_SOURCE%/*}/../External/libjson-c" -[[ $1 = clean ]] && { [[ ! -e Makefile ]] || make -s distclean; exit; } -[[ -e "${prefix=$PWD/libjson-c-osx}/lib/libjson-c.a" ]] && exit - -# Prepare -autoreconf -Iautoconf-archive/m4 --verbose --install --symlink 2> >(sed 's/^\([^:]*\):[0-9]\{1,\}: /\1: /') -rm -rf "${prefix=$PWD/libjson-c-osx}" -mkdir -p "$prefix" - -# Targets -( - ## ARCH: x86_64 - SDKROOT="$(xcrun --show-sdk-path --sdk macosx)" - PATH="$(xcrun --show-sdk-platform-path --sdk macosx)/usr/bin:$PATH" - export CFLAGS="-arch x86_64 -isysroot $SDKROOT -mmacosx-version-min=${MACOSX_DEPLOYMENT_TARGET:-10.8} -O2 -g $CFLAGS" # -flto - export LDFLAGS="-arch x86_64 -isysroot $SDKROOT -mmacosx-version-min=${MACOSX_DEPLOYMENT_TARGET:-10.8} $LDFLAGS" # -flto - export CPPFLAGS="$CFLAGS $CPPFLAGS" - [[ -e Makefile ]] && make -s clean - ./configure --disable-shared --prefix="$prefix" - make -j3 check - make -j3 install -) - -# Cleanup -make -s really-clean diff --git a/platform-darwin/Scripts/build_libsodium-ios b/platform-darwin/Scripts/build_libsodium-ios deleted file mode 100755 index 721acfde..00000000 --- a/platform-darwin/Scripts/build_libsodium-ios +++ /dev/null @@ -1,91 +0,0 @@ -#!/usr/bin/env bash -set -e - -hash automake || { echo >&2 "Missing automake."; exit 1; } -hash autoreconf || { echo >&2 "Missing autoconf."; exit 1; } -hash libtool || hash glibtool || { echo >&2 "Missing libtool."; exit 1; } - -cd "${BASH_SOURCE%/*}/../External/libsodium" -[[ $1 = clean ]] && { [[ ! -e Makefile ]] || make -s distclean; exit; } -[[ -e "${prefix=$PWD/libsodium-ios}/lib/libsodium.a" ]] && exit - -# Prepare -autoreconf --verbose --install --symlink 2> >(sed 's/^\([^:]*\):[0-9]\{1,\}: /\1: /') -rm -rf "${prefix=$PWD/libsodium-ios}" -mkdir -p "$prefix/lib" \ - "${prefix_i386=$prefix/tmp/i386}" \ - "${prefix_x86_64=$prefix/tmp/x86_64}" \ - "${prefix_armv7=$prefix/tmp/armv7}" \ - "${prefix_armv7s=$prefix/tmp/armv7s}" \ - "${prefix_arm64=$prefix/tmp/arm64}" - -# Targets -( - ## ARCH: i386 - SDKROOT="$(xcrun --show-sdk-path --sdk iphonesimulator)" - PATH="$(xcrun --show-sdk-platform-path --sdk iphonesimulator)/usr/bin:$PATH" - export CFLAGS="-arch i386 -isysroot $SDKROOT -mios-simulator-version-min=${IPHONEOS_DEPLOYMENT_TARGET:-8.0} -O2 -g -flto $CFLAGS" - export LDFLAGS="-arch i386 -isysroot $SDKROOT -mios-simulator-version-min=${IPHONEOS_DEPLOYMENT_TARGET:-8.0} -flto $LDFLAGS" - export CPPFLAGS="$CFLAGS $CPPFLAGS" - [[ -e Makefile ]] && make -s distclean - ./configure --host=i686-apple --disable-shared --enable-minimal --prefix="$prefix_i386" - make -j3 install -) -( - ## ARCH: x86_64 - SDKROOT="$(xcrun --show-sdk-path --sdk iphonesimulator)" - PATH="$(xcrun --show-sdk-platform-path --sdk iphonesimulator)/usr/bin:$PATH" - export CFLAGS="-arch x86_64 -isysroot $SDKROOT -mios-simulator-version-min=${IPHONEOS_DEPLOYMENT_TARGET:-8.0} -O2 -g -flto $CFLAGS" - export LDFLAGS="-arch x86_64 -isysroot $SDKROOT -mios-simulator-version-min=${IPHONEOS_DEPLOYMENT_TARGET:-8.0} -flto $LDFLAGS" - export CPPFLAGS="$CFLAGS $CPPFLAGS" - [[ -e Makefile ]] && make -s distclean - ./configure --host=x86_64-apple --disable-shared --enable-minimal --prefix="$prefix_x86_64" - make -j3 install -) -( - ## ARCH: armv7 - SDKROOT="$(xcrun --show-sdk-path --sdk iphoneos)" - PATH="$(xcrun --show-sdk-platform-path --sdk iphoneos)/usr/bin:$PATH" - export CFLAGS="-mthumb -arch armv7 -isysroot $SDKROOT -mios-version-min=${IPHONEOS_DEPLOYMENT_TARGET:-8.0} -O2 -g -flto $CFLAGS" - export LDFLAGS="-mthumb -arch armv7 -isysroot $SDKROOT -mios-version-min=${IPHONEOS_DEPLOYMENT_TARGET:-8.0} -flto $LDFLAGS" - export CPPFLAGS="$CFLAGS $CPPFLAGS" - [[ -e Makefile ]] && make -s distclean - ./configure --host=x86_64-apple --target=arm-apple --disable-shared --enable-minimal --prefix="$prefix_armv7" - make -j3 install -) -( - ## ARCH: armv7s - SDKROOT="$(xcrun --show-sdk-path --sdk iphoneos)" - PATH="$(xcrun --show-sdk-platform-path --sdk iphoneos)/usr/bin:$PATH" - export CFLAGS="-mthumb -arch armv7s -isysroot $SDKROOT -mios-version-min=${IPHONEOS_DEPLOYMENT_TARGET:-8.0} -O2 -g -flto $CFLAGS" - export LDFLAGS="-mthumb -arch armv7s -isysroot $SDKROOT -mios-version-min=${IPHONEOS_DEPLOYMENT_TARGET:-8.0} -flto $LDFLAGS" - export CPPFLAGS="$CFLAGS $CPPFLAGS" - [[ -e Makefile ]] && make -s distclean - ./configure --host=x86_64-apple --target=arm-apple --disable-shared --enable-minimal --prefix="$prefix_armv7s" - make -j3 install -) -( - ## ARCH: arm64 - SDKROOT="$(xcrun --show-sdk-path --sdk iphoneos)" - PATH="$(xcrun --show-sdk-platform-path --sdk iphoneos)/usr/bin:$PATH" - export CFLAGS="-mthumb -arch arm64 -isysroot $SDKROOT -mios-version-min=${IPHONEOS_DEPLOYMENT_TARGET:-8.0} -O2 -g -flto $CFLAGS" - export LDFLAGS="-mthumb -arch arm64 -isysroot $SDKROOT -mios-version-min=${IPHONEOS_DEPLOYMENT_TARGET:-8.0} -flto $LDFLAGS" - export CPPFLAGS="$CFLAGS $CPPFLAGS" - [[ -e Makefile ]] && make -s distclean - ./configure --host=x86_64-apple --target=arm-apple --disable-shared --enable-minimal --prefix="$prefix_arm64" - make -j3 install -) - -# Merge Binaries -mv -f -- "$prefix_arm64/include" "$prefix/" -lipo -create \ - "$prefix_i386/lib/libsodium.a" \ - "$prefix_x86_64/lib/libsodium.a" \ - "$prefix_armv7/lib/libsodium.a" \ - "$prefix_armv7s/lib/libsodium.a" \ - "$prefix_arm64/lib/libsodium.a" \ - -output "$prefix/lib/libsodium.a" - -# Cleanup -rm -rf -- "$prefix/tmp" -make -s distclean diff --git a/platform-darwin/Scripts/build_libsodium-osx b/platform-darwin/Scripts/build_libsodium-osx deleted file mode 100755 index 93a718fe..00000000 --- a/platform-darwin/Scripts/build_libsodium-osx +++ /dev/null @@ -1,33 +0,0 @@ -#!/usr/bin/env bash -set -e - -hash automake || { echo >&2 "Missing automake."; exit 1; } -hash autoreconf || { echo >&2 "Missing autoconf."; exit 1; } -hash libtool || hash glibtool || { echo >&2 "Missing libtool."; exit 1; } - -cd "${BASH_SOURCE%/*}/../External/libsodium" -[[ $1 = clean ]] && { [[ ! -e Makefile ]] || make -s distclean; exit; } -[[ -e "${prefix=$PWD/libsodium-osx}/lib/libsodium.a" ]] && exit - -# Inspired by libsodium/dist-build/osx.sh -# Prepare -autoreconf --verbose --install --symlink 2> >(sed 's/^\([^:]*\):[0-9]\{1,\}: /\1: /') -rm -rf "${prefix=$PWD/libsodium-osx}" -mkdir -p "$prefix" - -# Targets -( - ## ARCH: x86_64 - SDKROOT="$(xcrun --show-sdk-path --sdk macosx)" - PATH="$(xcrun --show-sdk-platform-path --sdk macosx)/usr/bin:$PATH" - export CFLAGS="-arch x86_64 -isysroot $SDKROOT -mmacosx-version-min=${MACOSX_DEPLOYMENT_TARGET:-10.8} -O2 -g -flto $CFLAGS" - export LDFLAGS="-arch x86_64 -isysroot $SDKROOT -mmacosx-version-min=${MACOSX_DEPLOYMENT_TARGET:-10.8} -flto $LDFLAGS" - export CPPFLAGS="$CFLAGS $CPPFLAGS" - [[ -e Makefile ]] && make -s distclean - ./configure --disable-shared --enable-minimal --prefix="$prefix" - make -j3 check - make -j3 install -) - -# Cleanup -make -s distclean diff --git a/platform-darwin/Scripts/updateDependencies b/platform-darwin/Scripts/updateDependencies deleted file mode 100755 index 5856bb18..00000000 --- a/platform-darwin/Scripts/updateDependencies +++ /dev/null @@ -1,41 +0,0 @@ -#!/usr/bin/env bash -# This script should be in the 'Scripts' directory under the git repository's root. -cd "${BASH_SOURCE%/*}/.." -shopt -s extglob - - -## Submodules that need to be checked out. -dependencies=( External/{InAppSettingsKit,Pearl{,:External/jrswizzle,:External/uicolor-utilities},RHStatusItemView} ) - -## Custom migration. -# None yet. - - -################################################################################ -isCheckedOut() { - local modulePath=$1 - ! git submodule status | grep -q "^-[^ ]* $modulePath" -} - -# git submodule sync -- A bug causes this to init ALL external dependencies. -git submodule sync $(git submodule status | awk '/^ / { print $2 }') - - -# Check out our missing dependencies -for dependency in "${dependencies[@]}"; do - [[ $dependency = *:* ]] && root=${dependency%%:*} || root=. - path=${dependency#*:} - ( cd "$root"; git submodule update --init "$path" ) -done - - -# Update our modules -git submodule update - - -# Our modules may define a custom update script, if so, run it. -find !(Scripts)/ -name "${BASH_SOURCE##*/}" -exec {} \; - - -# Finally, for our modules that haven't got a custom update script, update them recursively. -git submodule update --recursive --rebase