add p7zip sdk packaging method (closes #33)

This commit is contained in:
Thomas Pöchtrager 2015-06-21 14:01:49 +02:00
parent b8594af6a8
commit 4450f62e1a
4 changed files with 119 additions and 5 deletions

View File

@ -4,6 +4,8 @@ changed:
* improved and colorized wrapper error/warning/debug/info messages
added:
* p7zip sdk packaging script
* a minimalistic xcrun tool
* support for ccache symlinks
* darling-dmg sdk packaging script
* include path warnings for /usr/include and /usr/local/include

View File

@ -79,7 +79,7 @@ You can turn this behavior off with `OSXCROSS_GCC_NO_STATIC_RUNTIME=1` (env).
4. Copy the packaged SDK (\*.tar.\* or \*.pkg) on a USB Stick
5. (On Linux/BSD) Copy or move the SDK into the tarballs/ directory of OSXCross
\*\* Xcode 4.6, 5.0+, 6.0, and the 6.1 Betas are known to work.
\*\* Xcode up to 6.3.x is known to work; 7.x is not working (yet).
\*\*\* If you get a dialog with a crossed circle, ignore it, you don't need to install Xcode.
Step 1. and 2. can be skipped if you have Xcode installed.
@ -104,6 +104,13 @@ Step 1. and 2. can be skipped if you have Xcode installed.
3. Run `./gen_sdk_package_darling_dmg.sh <xcode>.dmg`
4. Copy or move the SDK into the tarballs/ directory
##### Packing the SDK on Linux (and others), Method 3 (works with Xcode >= 4.3): #####
1. Download Xcode like described in 'Packaging the SDK on Mac OS X'
2. Ensure you have `clang` and `make` installed
3. Run `./gen_sdk_package_darling_p7zip.sh <xcode>.dmg`
4. Copy or move the SDK into the tarballs/ directory
### USAGE EXAMPLES: ###
##### Let's say you want to compile a file called test.cpp, then you can do this by running: #####

View File

@ -17,9 +17,13 @@ mkdir -p $BUILD_DIR
require git
require cmake
require $MAKE
require modinfo
require fusermount
[ -n "$CC" ] && require $CC
[ -n "$CXX" ] && require $CXX
set +e
modinfo fuse &>/dev/null
@ -34,7 +38,7 @@ set -e
pushd $BUILD_DIR &>/dev/null
if [ ! -f $TARGET_DIR/bin/darling-dmg ]; then
if [ ! -f $TARGET_DIR/SDK/tools/bin/darling-dmg ]; then
rm -f have_darling_dmg
fi
@ -45,8 +49,8 @@ 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
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=$TARGET_DIR/SDK/tools
$MAKE -j $JOBS install
popd &>/dev/null
popd &>/dev/null
@ -65,5 +69,5 @@ function cleanup() {
trap cleanup EXIT
$TARGET_DIR/bin/darling-dmg $1 $TMP
$TARGET_DIR/SDK/tools/bin/darling-dmg $1 $TMP
XCODEDIR=$TMP ./tools/gen_sdk_package.sh

101
tools/gen_sdk_package_p7zip.sh Executable file
View File

@ -0,0 +1,101 @@
#!/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 <xcode.dmg>" 1>&2
exit 1
fi
case $1 in
/*) XCODEDMG="$1" ;;
*) XCODEDMG="$PWD/$1" ;;
esac
mkdir -p $BUILD_DIR
require git
require $MAKE
[ -n "$CC" ] && require $CC
[ -n "$CXX" ] && require $CXX
pushd $BUILD_DIR &>/dev/null
if [ ! -f $TARGET_DIR/SDK/tools/bin/7z ]; then
rm -f have_p7zip
fi
if [ ! -f "have_p7zip" ]; then
rm -rf p7zip*
git clone https://github.com/tpoechtrager/p7zip.git
pushd p7zip &>/dev/null
if [ -n "$CC" ] && [ -n "$CXX" ]; then
[[ $CC == *clang* ]] && CC="$CC -Qunused-arguments"
[[ $CXX == *clang* ]] && CXX="$CXX -Qunused-arguments"
$MAKE 7z -j $JOBS CC="$CC" CXX="$CXX"
else
$MAKE 7z -j $JOBS
fi
$MAKE install DEST_HOME=$TARGET_DIR/SDK/tools
find $TARGET_DIR/SDK/tools/share -type f -exec chmod 0664 {} \;
popd &>/dev/null
touch "have_p7zip"
fi
popd &>/dev/null
#/tmp is prone to run out of space
#TMP=$(mktemp -d /tmp/XXXXXXXXX)
for i in {1..100}; do
TMP="tmp_$RANDOM"
[ -e $TMP ] && continue
mkdir $TMP && break
done
if [ ! -d $TMP ]; then
echo "cannot create $PWD/$TMP directory" 1>&2
exit 1
fi
function cleanup() {
popd &>/dev/null || true
rm -rf $TMP
}
trap cleanup EXIT
pushd $TMP &>/dev/null
set +e
$TARGET_DIR/SDK/tools/bin/7z x \
$XCODEDMG \
"*/Xcode.app/Contents/Developer/Platforms/MacOSX.platform" \
"*/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain"
[ $? -ne 0 -a $? -ne 2 ] && exit 1
if [ -z "$(ls -A)" ]; then
$TARGET_DIR/SDK/tools/bin/7z x $XCODEDMG "*/Packages/MacOSX*.pkg"
[ $? -ne 0 -a $? -ne 2 ] && exit 1
fi
[ -z "$(ls -A)" ] && exit 1
set -e
popd &>/dev/null
XCODEDIR="$TMP/$(ls $TMP | grep "code" | head -n1)" \
./tools/gen_sdk_package.sh