SwiftGit2/script/update_libgit2_ios
Tom Booth cb5daab309 Bring script/ directory up to date
These scripts were borrowed from the objective-git project and utilized
in the branch that I am taking inspiration from
(https://github.com/SwiftGit2/SwiftGit2/pull/44). Bringing these up to
date includes some fixes for working with iOS. The changelog is as
follows:

Currently unmerged PR fixing script/cibuild for iphonesimulator:

https://github.com/libgit2/objective-git/pull/552

commit 24b2a886c0b61cf1dca0d55cac900b26616e50b9
Author: Ben Chatelain <ben@octop.ad>
Date:   Mon Nov 9 21:49:13 2015 -0700

    Fix libssh2 inclusion in libgit2 iOS build script

    - Added CMAKE_PREFIX_PATH to arch-specific libssh2 root dir
    - Added PKG_CONFIG_USE_CMAKE_PREFIX_PATH so things actually make
      sense
    - Removed unused LIBSSH2_INCLUDE_DIRS

commit dca46ad12a958095aca6ee431de842ca62857b11
Author: joe DeCapo <joe@polka.cat>
Date:   Wed Sep 23 05:26:43 2015 -0500

    Disable code signing during build

    Attempting solution from:
http://stackoverflow.com/questions/27671854/travis-ci-fails-to-build-with-a-code-signing-error

commit 0dc6c60dc0c13ecb088b2a93a9ad24b9c72a9b99
Merge: 4447e70 c9da387
Author: Josh Abernathy <joshaber@gmail.com>
Date:   Wed Sep 2 09:36:05 2015 -0400

    Merge pull request #484 from phatblat/ben/ios-test-target

    iOS Test target

commit 4447e700413adf920a665b138149a20344bc9c87
Merge: b7b2549 aa6dd45
Author: Josh Abernathy <joshaber@gmail.com>
Date:   Mon Aug 31 11:53:55 2015 -0500

    Merge pull request #497 from phatblat/ben/bootstrap

    Just install any missing tools in bootstrap

commit 15f906ca2efa9d5ba67744d25a825c9bc75ad9e7
Author: Ben Chatelain <ben@octop.ad>
Date:   Mon Aug 24 15:25:38 2015 -0600

    Quote sdkflag

commit 2712c2a2beb294cd81ae44f733fdc9f17eb1a259
Author: Ben Chatelain <ben@octop.ad>
Date:   Mon Aug 24 14:17:33 2015 -0600

    Add specific iOS simulator destination

    Specifying the destionation works around the following issue with
xctool. Can also hard-code the architecture, but this seems more
future-proof.

    ```
    Failed to query the list of test cases in the test bundle:
2015-08-24 10:57:11.740 sim[50821:2746840]
/Applications/Xcode6.4.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/sim:
No simulator devices appear to be running.  Setting data directories to
/var/empty.
    2015-08-24 10:57:11.741 sim[50821:2746840] DYLD_INSERT_LIBRARIES
contains possible bad values.  Caller beware:
/usr/local/Cellar/xctool/0.2.4/libexec/lib/otest-query-lib-ios.dylib
    dlopen(/Volumes/DerivedData/ObjectiveGitFramework-drtqacfhlqybdcdpqayztrrwneun/Build/Products/Debug-iphonesimulator/ObjectiveGit-iOSTests.xctest/ObjectiveGit-iOSTests,
1): Library not loaded: @rpath/ObjectiveGit.framework/ObjectiveGit
      Referenced from:
/Volumes/DerivedData/ObjectiveGitFramework-drtqacfhlqybdcdpqayztrrwneun/Build/Products/Debug-iphonesimulator/ObjectiveGit-iOSTests.xctest/ObjectiveGit-iOSTests
      Reason: no suitable image found.  Did find:
        /Volumes/DerivedData/ObjectiveGitFramework-drtqacfhlqybdcdpqayztrrwneun/Build/Products/Debug-iphonesimulator/ObjectiveGit.framework/ObjectiveGit:
mach-o, but wrong architecture
    ```

    Indeed, the "wrong architecture" message is correct as the framework
was built for a different architecture than the test binary:

    ```
    lipo -info ObjectiveGit.framework/ObjectiveGit
ObjectiveGit-iOSTests.xctest/ObjectiveGit-iOSTests
2015-08-24 11:03
    Non-fat file: ObjectiveGit.framework/ObjectiveGit is architecture:
i386
    Non-fat file: ObjectiveGit-iOSTests.xctest/ObjectiveGit-iOSTests is
architecture: x86_64
    ```

commit aa6dd4531cf3380250045c3bb19839d3a40934f1
Author: Ben Chatelain <ben@octop.ad>
Date:   Mon Aug 24 12:31:31 2015 -0600

    /user -> /usr

commit b8efb3224393d12d720cbbbd348c2cb4ec066d6d
Author: Ben Chatelain <ben@octop.ad>
Date:   Mon Aug 24 09:51:51 2015 -0600

    Abort script if Homebrew is not installed

commit e7b8e1aa4bf6aa20de09ff4b112ec688570914d1
Author: Ben Chatelain <ben@octop.ad>
Date:   Mon Aug 24 09:42:17 2015 -0600

    Move check_deps to after update_submodules

commit 27473a0e8e92a47266664271ed4513806937efda
Author: Ben Chatelain <ben@octop.ad>
Date:   Mon Aug 24 09:34:21 2015 -0600

    Wrap long git submodule command chain for readability

commit 7724e36e7ca1666f535c8967c7534e04664d457e
Author: Ben Chatelain <ben@octop.ad>
Date:   Sun Aug 9 09:12:56 2015 -0600

    Update script comments

commit 768f033f0bf95c01793a941311cdbf45a7fb975c
Author: Ben Chatelain <ben@octop.ad>
Date:   Sat Aug 8 22:51:14 2015 -0600

    Fix iPhone SDK version detection in Xcode 7

commit cb0c5c12f9865e1aa270ed523ce0aeaf72c2be21
Author: Ben Chatelain <benchatelain@gmail.com>
Date:   Tue Jul 28 22:44:01 2015 -0600

    Just install any missing tools in bootstrap

    Now REQUIRED_TOOLS is a mix of commands and libraries

commit 8dda480f788e006277767810b29d8a760028ce8b
Author: Piet Brauer <piet@nerdishbynature.com>
Date:   Wed Jul 22 17:10:45 2015 +0200

    Prebuild OpenSSL in order to workaround Travis timouts

commit 6c66e65c539e3b53db6c5531743dcfecdb116c55
Author: Ben Chatelain <ben@octop.ad>
Date:   Mon Jul 20 21:45:01 2015 -0600

    Stop letting cmake determine which clang to use

commit 2ea1bd02d33ed7fcd0604404dc98693ad89f3815
Author: joshaber <joshaber@gmail.com>
Date:   Fri Jul 10 12:39:52 2015 -0400

    Include pkg-config in our dependencies.

commit c906271f580d6901a1200fc4795df250aca47cfc
Author: Ben Chatelain <ben@octop.ad>
Date:   Mon Jul 6 20:09:34 2015 -0600

    Disable CURL in libgit2 iOS build

commit 549717d138fd4cd1828c7e67fb810523794f1ecb
Author: Ben Chatelain <ben@octop.ad>
Date:   Mon Jul 6 20:09:16 2015 -0600

    Remove obsolete OPENSSL_ defines from libgit2 iOS build

commit aed2cc39c831697102ac6aff317990729b55dd2c
Author: Ben Chatelain <ben@octop.ad>
Date:   Thu Jun 25 21:16:56 2015 -0600

    Fix LIBSSH2_INCLUDE_DIRS define

commit 5ba578ac115974f0981d49b7c79072e867ef804b
Author: Ben Chatelain <benchatelain@gmail.com>
Date:   Tue Feb 17 17:10:32 2015 -0700

    Fix libgit2 Mac build (again)

    LIBSSH2_INCLUDE_DIR = /usr/local/include/

commit b0b011a9da2c784ef25e793a638c28c3b6387fd0
Author: Ben Chatelain <benchatelain@gmail.com>
Date:   Mon Feb 16 16:25:15 2015 -0700

    Revert "Fix libgit2 (Mac) build"

    This reverts commit fd67e2bc2fc40171b06df88b627a636bdcf102cb.

commit fd67e2bc2fc40171b06df88b627a636bdcf102cb
Author: Ben Chatelain <benchatelain@gmail.com>
Date:   Tue Feb 10 07:39:25 2015 -0700

    Fix libgit2 (Mac) build

commit b817e13e4c29bea355044e316d9214fbc955ac8f
Author: Ben Chatelain <benchatelain@gmail.com>
Date:   Mon Feb 9 08:40:20 2015 -0700

    Fix libgit2-ios build

    Set LIBSSH2_INCLUDE_DIR so that libssh2.h can be found

commit da4608b8a5bb87c3c75c7acdcc453fd69c6b8672
Author: Justin Spahr-Summers <Justin.SpahrSummers@gmail.com>
Date:   Thu Nov 6 15:10:33 2014 -0800

    Update objc-build-scripts to stop cleaning automatically

commit f8ff8a60bd0ca6dbfa7b170658c0be8f5f589cd6
Author: Alan Rogers <alanjrogers@me.com>
Date:   Tue Oct 28 15:51:29 2014 +1100

    Don't try and link .a's in the External folder.

commit 1e02f02ddcaf946f153449d604a0d60e2197aab8
Author: Alan Rogers <alanjrogers@me.com>
Date:   Tue Oct 28 15:51:15 2014 +1100

    Remove set -e because lol.

commit c32fe343651aacf91cbe3cf7d513c612f62b235e
Author: Alan Rogers <alanjrogers@me.com>
Date:   Tue Oct 28 14:41:47 2014 +1100

    Skip installing man pages to avoid too many symlink errors.

commit 88ee2eb305d3aeb1ece99c654f12da1fe2eadc40
Author: Justin Spahr-Summers <Justin.SpahrSummers@gmail.com>
Date:   Wed Oct 22 11:51:32 2014 -0700

    Update to jspahrsummers/objc-build-scripts@a54782c

commit 2c337c688a2779b51e6d4178cbace23750f3fde7
Author: Justin Spahr-Summers <jspahrsummers@github.com>
Date:   Tue May 27 09:21:55 2014 -0700

    Enable libgit2 thread safety for iOS

    No idea why this was ever disabled.

    Resolves libgit2/libgit2#2384.

    /cc @carlosmn @SquaredTiki

commit 19392f8a036dc603f115b6ced0d03f580dee0f47
Author: Justin Spahr-Summers <Justin.SpahrSummers@gmail.com>
Date:   Mon Nov 11 11:47:33 2013 -0800

    Add cmake as a required tool

commit 5b6cc97a958caedcc4dcbda18d1a193ed58a2ad6
Author: Justin Spahr-Summers <Justin.SpahrSummers@gmail.com>
Date:   Mon Nov 11 11:37:54 2013 -0800

    Update objc-build-scripts
2016-02-16 16:50:36 +00:00

76 lines
1.8 KiB
Bash
Executable File

#!/bin/bash
set -e
# source the common build functions
SCRIPT_DIR=$(dirname "$0")
source "${SCRIPT_DIR}/ios_build_functions.sh"
function setup ()
{
if [ "${ROOT_PATH}/External/libgit2-ios/libgit2-ios.a" -nt "${ROOT_PATH}/External/libgit2" ]
then
echo "No update needed."
exit 0
fi
LIBRARY_NAME="libgit2"
LIB_PATH="${ROOT_PATH}/External/libgit2-ios"
rm -rf "${LIB_PATH}"
pushd "${ROOT_PATH}/External/libgit2" > /dev/null
}
function build_libgit2 ()
{
rm -rf "build"
mkdir "build"
pushd "build" > /dev/null
# LOL Cmake
if [ "${ARCH}" != "i386" ] && [ "${ARCH}" != "x86_64" ]
then
SYS_ROOT="-DCMAKE_OSX_SYSROOT=${SDKROOT}"
fi
# install the each built arch somewhere sane
INSTALL_PREFIX="${LIB_PATH}/${SDKNAME}-${ARCH}.sdk"
mkdir -p "${INSTALL_PREFIX}"
LOG="${INSTALL_PREFIX}/build-libgit2.log"
echo "$LOG"
cmake \
-DCMAKE_C_COMPILER_WORKS:BOOL=ON \
-DBUILD_SHARED_LIBS:BOOL=OFF \
-DCMAKE_PREFIX_PATH:PATH="${ROOT_PATH}/External/libssh2-ios/bin/${SDKNAME}-${ARCH}.sdk" \
-DPKG_CONFIG_USE_CMAKE_PREFIX_PATH:BOOL=ON \
-DCMAKE_INSTALL_PREFIX:PATH="${INSTALL_PREFIX}/" \
-DBUILD_CLAR:BOOL=OFF \
-DTHREADSAFE:BOOL=ON \
-DCURL:BOOL=OFF \
"${SYS_ROOT}" \
-DCMAKE_OSX_ARCHITECTURES:STRING="${ARCH}" \
.. >> "${LOG}" 2>&1
cmake --build . --target install >> "${LOG}" 2>&1
# push the built library into the list
BUILT_LIB_PATHS+=("${INSTALL_PREFIX}/lib/libgit2.a")
popd > /dev/null
}
function fat_binary ()
{
echo "Building fat binary..."
lipo -create "${BUILT_LIB_PATHS[@]}" -output "${ROOT_PATH}/External/libgit2-ios/libgit2-ios.a"
echo "Building done."
popd > /dev/null
}
build_all_archs setup build_libgit2 fat_binary