diff --git a/CHANGELOG b/CHANGELOG index 755e084..81bdaba 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -4,6 +4,7 @@ changed: * improved and colorized wrapper error/warning/debug/info messages added: +* darling-dmg sdk packaging script * include path warnings for /usr/include and /usr/local/include (can be switched off via 'OSXCROSS_NO_INCLUDE_PATH_WARNINGS=1') * an option to silence osxcross extension warnings diff --git a/README.md b/README.md index 6a61bc6..1c7d162 100644 --- a/README.md +++ b/README.md @@ -71,10 +71,6 @@ You can turn this behavior off with `OSXCROSS_GCC_NO_STATIC_RUNTIME=1` (env). ### PACKAGING THE SDK: ### -If you need a recent SDK, then you must do the SDK packaging on OS X. -Recent Xcode images are compressed, but the Linux kernel does not -support HFS+ compression. - ##### Packaging the SDK on Mac OS X: ##### 1. [Download [Xcode](https://developer.apple.com/downloads/index.action?name=Xcode%205.1.1) \*\*] @@ -101,19 +97,12 @@ Step 1. and 2. can be skipped if you have Xcode installed. \*\* SHA1 Sum: 1a06882638996dfbff65ea6b4c6625842903ead3. -##### Packing the SDK on Linux, Method 2 (*UNSUPPORTED* - but works with Xcode >= 4.3): ##### +##### Packing the SDK on Linux, Method 2 (works with Xcode >= 4.3): ##### 1. Download Xcode like described in 'Packaging the SDK on Mac OS X' -2. Download and build [HFSExplorer](http://www.catacombae.org/hfsexplorer/) - (you will need `openjdk` and `ant`) -3. Open the HFSExplorer GUI (do *NOT* use the command line utility) -4. Open the Xcode image -5. Right click on the Xcode (not Xcode.app) folder and choose 'extract data' -6. Answer the 'Follow Symlinks' dialog with 'No' -7. Click on '>>' and choose 'Quiet mode' -8. Click away all the annoying Java errors -9. Run: `XCODEDIR=/path/to/extracted-xcode/Xcode ./tools/gen_sdk_package.sh` -10. Copy or move the SDK into the tarballs/ directory +2. Install `cmake`, `libxml2-dev` and `fuse` +3. run `./gen_sdk_package_darling_dmg.sh .dmg` +4. Copy or move the SDK into the tarballs/ directory ### USAGE EXAMPLES: ### diff --git a/build.sh b/build.sh index 36d3bfc..de988aa 100755 --- a/build.sh +++ b/build.sh @@ -76,15 +76,8 @@ if [ -z "$OSX_VERSION_MIN" ]; then fi fi -# Don't change this OSXCROSS_VERSION=0.10 -TARBALL_DIR=$BASE_DIR/tarballs -BUILD_DIR=$BASE_DIR/build -TARGET_DIR=$BASE_DIR/target -PATCH_DIR=$BASE_DIR/patches -SDK_DIR=$TARGET_DIR/SDK - if [ -z "$OSX_VERSION_MIN" ]; then OSX_VERSION_MIN="default" fi diff --git a/build_clang.sh b/build_clang.sh index 5cbf87c..e34cbe8 100755 --- a/build_clang.sh +++ b/build_clang.sh @@ -7,9 +7,6 @@ USESYSTEMCOMPILER=1 source tools/tools.sh -TARBALL_DIR=$BASE_DIR/tarballs -BUILD_DIR=$BASE_DIR/build - mkdir -p $BUILD_DIR if [ -z "$SKIP_GCC_CHECK" ]; then diff --git a/tools/gen_sdk_package.sh b/tools/gen_sdk_package.sh index e86049b..99cdd42 100755 --- a/tools/gen_sdk_package.sh +++ b/tools/gen_sdk_package.sh @@ -9,6 +9,10 @@ if [ $(uname -s) != "Darwin" ]; then echo "... Or with XCODEDIR=... on Linux" exit 1 else + case $XCODEDIR in + /*) ;; + *) XCODEDIR="$PWD/$XCODEDIR" ;; + esac XCODEDIR+="/$(ls "$XCODEDIR" | grep "^Xcode.*" | head -n1)" fi else @@ -27,7 +31,7 @@ else fi if [ ! -d $XCODEDIR ]; then - echo "cannot find Xcode (XCODEDIR=$XCODEDIR)" + echo "cannot find Xcode (XCODEDIR=$XCODEDIR)" 1>&2 exit 1 fi @@ -62,10 +66,12 @@ if [ -d "Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs" ]; then else if [ -d "../Packages" ]; then pushd "../Packages" &>/dev/null + elif [ -d "Packages" ]; then + pushd "Packages" &>/dev/null else if [ $? -ne 0 ]; then - echo "Xcode (or this script) is out of date" - echo "trying some magic to find the SDKs anyway ..." + echo "Xcode (or this script) is out of date" 1>&2 + echo "trying some magic to find the SDKs anyway ..." 1>&2 SDKDIR=$(find . -name SDKs -type d | grep MacOSX | head -n1) @@ -82,7 +88,7 @@ fi SDKS=$(ls | grep "^MacOSX10.*" | grep -v "Patch") if [ -z "$SDKS" ]; then - echo "No SDK found" + echo "No SDK found" 1>&2 exit 1 fi diff --git a/tools/gen_sdk_package_darling_dmg.sh b/tools/gen_sdk_package_darling_dmg.sh new file mode 100755 index 0000000..ab15640 --- /dev/null +++ b/tools/gen_sdk_package_darling_dmg.sh @@ -0,0 +1,69 @@ +#!/usr/bin/env bash + +pushd "${0%/*}/.." &>/dev/null +source tools/tools.sh + +if [ $PLATFORM == "Darwin" ]; then + echo "Use gen_sdk_package.sh on Mac OS X" 1>&2 + exit 1 +fi + +if [ $# -eq 0 ]; then + echo "Usage: $0 " 1>&2 + exit 1 +fi + +mkdir -p $BUILD_DIR + +require git +require cmake +require modinfo +require fusermount + +set +e + +modinfo fuse &>/dev/null + +if [ $? -ne 0 ]; then + echo "required kernel module 'fuse' not loaded" 1>&2 + echo "please run 'insmod fuse' as root" 1>&2 + exit 1 +fi + +set -e + +pushd $BUILD_DIR &>/dev/null + +if [ ! -f $TARGET_DIR/bin/darling-dmg ]; then + rm -f have_darling_dmg +fi + +if [ ! -f "have_darling_dmg" ]; then + +rm -rf darling-dmg* +git clone https://github.com/LubosD/darling-dmg.git +pushd darling-dmg &>/dev/null +mkdir -p build +pushd build &>/dev/null +cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=$TARGET_DIR +make -j $JOBS install +popd &>/dev/null +popd &>/dev/null + +touch "have_darling_dmg" + +fi + +popd &>/dev/null # build dir + +TMP=$(mktemp -d /tmp/XXXXXXXXX) + +function cleanup() { + fusermount -u $TMP || true + rm -rf $TMP +} + +trap cleanup EXIT + +$TARGET_DIR/bin/darling-dmg $1 $TMP +XCODEDIR=$TMP ./tools/gen_sdk_package.sh diff --git a/tools/tools.sh b/tools/tools.sh index 86324fe..eb0f664 100755 --- a/tools/tools.sh +++ b/tools/tools.sh @@ -1,8 +1,14 @@ #!/usr/bin/env bash +export LC_ALL="C" + BASE_DIR=$PWD -export LC_ALL="C" +TARBALL_DIR=$BASE_DIR/tarballs +BUILD_DIR=$BASE_DIR/build +TARGET_DIR=$BASE_DIR/target +PATCH_DIR=$BASE_DIR/patches +SDK_DIR=$TARGET_DIR/SDK if [ -z "$USESYSTEMCOMPILER" ]; then export CC=clang @@ -23,7 +29,9 @@ if [[ $SCRIPT != *wrapper/build.sh ]]; then JOBS=${JOBS:=`tools/get_cpu_count.sh`} if [ $SCRIPT != "build.sh" -a $SCRIPT != "build_clang.sh" -a \ - $SCRIPT != "mount_xcode_image.sh" ]; then + $SCRIPT != "mount_xcode_image.sh" -a \ + $SCRIPT != "gen_sdk_package_darling_dmg.sh" -a \ + $SCRIPT != "gen_sdk_package_p7zip.sh" ]; then `tools/osxcross_conf.sh` if [ $? -ne 0 ]; then