Fix compiling with IBM XL C on AIX.
[xz/debian.git] / macosx / build.sh
blobd48ee61bd163c01bf9dd052207f061a2eb7b91ac
1 #!/bin/sh
3 ###############################################################################
4 # Author: Anders F Björklund <afb@users.sourceforge.net>
6 # This file has been put into the public domain.
7 # You can do whatever you want with this file.
8 ###############################################################################
10 mkdir -p Root
11 mkdir -p Resources
13 # Abort immediately if something goes wrong.
14 set -e
16 # Clean up if it was already configured.
17 [ -f Makefile ] && make distclean
19 # Build the regular fat program
21 CC="gcc-4.0" \
22 CFLAGS="-O2 -g -arch ppc -arch ppc64 -arch i386 -arch x86_64 -isysroot /Developer/SDKs/MacOSX10.4u.sdk -mmacosx-version-min=10.4" \
23 ../configure --disable-dependency-tracking --disable-xzdec --disable-lzmadec i686-apple-darwin8
25 make
27 make check
29 make DESTDIR=`pwd`/Root install
31 make distclean
33 # Build the size-optimized program
35 CC="gcc-4.0" \
36 CFLAGS="-Os -g -arch ppc -arch i386 -isysroot /Developer/SDKs/MacOSX10.4u.sdk -mmacosx-version-min=10.4" \
37 ../configure --disable-dependency-tracking --disable-shared --disable-nls --disable-encoders --enable-small --disable-threads i686-apple-darwin8
39 make -C src/liblzma
40 make -C src/xzdec
41 make -C src/xzdec DESTDIR=`pwd`/Root install
43 cp -a ../extra Root/usr/local/share/doc/xz
45 make distclean
47 # Strip debugging symbols and make relocatable
49 for bin in xz lzmainfo xzdec lzmadec; do
50 strip -S Root/usr/local/bin/$bin
51 install_name_tool -change /usr/local/lib/liblzma.5.dylib @executable_path/../lib/liblzma.5.dylib Root/usr/local/bin/$bin
52 done
54 for lib in liblzma.5.dylib; do
55 strip -S Root/usr/local/lib/$lib
56 install_name_tool -id @executable_path/../lib/liblzma.5.dylib Root/usr/local/lib/$lib
57 done
59 strip -S Root/usr/local/lib/liblzma.a
60 rm -f Root/usr/local/lib/liblzma.la
62 # Include pkg-config while making relocatable
64 sed -e 's|prefix=/usr/local|prefix=${pcfiledir}/../..|' < Root/usr/local/lib/pkgconfig/liblzma.pc > Root/liblzma.pc
65 mv Root/liblzma.pc Root/usr/local/lib/pkgconfig/liblzma.pc
67 # Create tarball, but without the HFS+ attrib
69 rmdir debug lib po src/liblzma/api src/liblzma src/lzmainfo src/scripts src/xz src/xzdec src tests
71 ( cd Root/usr/local; COPY_EXTENDED_ATTRIBUTES_DISABLE=true COPYFILE_DISABLE=true tar cvjf ../../../XZ.tbz * )
73 # Include documentation files for package
75 cp -p ../README Resources/ReadMe.txt
76 cp -p ../COPYING Resources/License.txt
78 # Make an Installer.app package
80 ID="org.tukaani.xz"
81 VERSION=`cd ..; sh build-aux/version.sh`
82 PACKAGEMAKER=/Developer/Applications/Utilities/PackageMaker.app/Contents/MacOS/PackageMaker
83 $PACKAGEMAKER -r Root/usr/local -l /usr/local -e Resources -i $ID -n $VERSION -t XZ -o XZ.pkg -g 10.4 --verbose
85 # Put the package in a disk image
87 hdiutil create -fs HFS+ -format UDZO -quiet -srcfolder XZ.pkg -ov XZ.dmg
88 hdiutil internet-enable -yes -quiet XZ.dmg
90 echo
91 echo "Build completed successfully."
92 echo