source: git/buildmacosx.sh @ 2032841

RELEASE/1.2debug-cidebug-ci-sanitisersstereowalls-datawalls-data-hanging-as-warning
Last change on this file since 2032841 was 2032841, checked in by Olly Betts <olly@…>, 14 years ago

buildmacosx.sh,configure.in,lib/Info.plist.in: Make buildmacosx.sh
work.

git-svn-id: file:///home/survex-svn/survex/trunk@3514 4b37db11-9a0c-4f06-9ece-9ab7cdaee568

  • Property mode set to 100755
File size: 4.1 KB
RevLine 
[6df03c1]1#!/bin/sh
2#
[0580c6a]3# Note: this script requires MacOS X 10.2 or greater, and builds diskimages
4# which require MacOS X 10.1 or greater to install.
5#
[2032841]6# Currently (at least is built on 10.6) 10.6 is required to run.
7#
[b72f4b5]8# Run from the unpacked survex-1.1.X directory like so:
[6df03c1]9#
[2032841]10#   ./buildmacosx.sh
[0580c6a]11#
[1324d6c]12# This will automatically download and temporarily install wxWidgets
[0580c6a]13# (this script is smart enough not to download or build it if it already
14# has).
15#
[1324d6c]16# If you already have wxWidgets installed permanently, use:
[0580c6a]17#
[2032841]18#   ./buildmacosx.sh --no-install-wx
[6df03c1]19#
[1324d6c]20# If wxWidgets is installed somewhere such that wx-config isn't on your
[6df03c1]21# PATH you need to indicate where wx-config is by running this script
22# something like this:
23#
[b7510ee]24#   env WX_CONFIG=/path/to/wx-config ./buildmacosx.sh
[b72f4b5]25#
[2032841]26# (If you set WX_CONFIG, there's no need to pass --no-install-wx).
27#
[1324d6c]28# If using a pre-installed wxWidgets, note that it must satisfy the
[b72f4b5]29# following requirements:
30#   - It must be built with OpenGL support (--with-opengl).
31#   - It must be the Carbon version.
[b7510ee]32#   - It probably should be a "Unicode" build (--enable-unicode).
[6df03c1]33
34set -e
[0580c6a]35
[b7510ee]36WXVERSION=2.8.11
[b72f4b5]37
[2032841]38# Fix to work for ppc too...
39#arch_flags='-arch i386 -arch ppc'
40arch_flags='-arch i386'
41if [ -z "${WX_CONFIG+set}" ] && [ "x$1" != "x--no-install-wx" ] ; then
[0580c6a]42  if test -x WXINSTALL/bin/wx-config ; then
43    :
44  else
[deb58b87]45    prefix=`pwd`/WXINSTALL
[b72f4b5]46    test -f wxWidgets-$WXVERSION.tar.bz2 || \
[deb58b87]47      curl -O ftp://ftp.wxwidgets.org/pub/$WXVERSION/wxWidgets-$WXVERSION.tar.bz2
[b72f4b5]48    test -d wxWidgets-$WXVERSION || tar jxvf wxWidgets-$WXVERSION.tar.bz2
49    test -d wxWidgets-$WXVERSION/build || mkdir wxWidgets-$WXVERSION/build
50    cd wxWidgets-$WXVERSION/build
[2032841]51    ../configure --disable-shared --prefix="$prefix" --with-opengl --enable-unicode CC="gcc $arch_flags" CXX="g++ $arch_flags"
[0580c6a]52    make -s
53    make -s install
54    cd ../..
55  fi
[b7510ee]56  WX_CONFIG=`pwd`/WXINSTALL/bin/wx-config
[0580c6a]57fi
58
[b7510ee]59test -n "$WX_CONFIG" || WX_CONFIG=`which wx-config`
60if test -z "$WX_CONFIG" ; then
61  echo "WX_CONFIG not set and wx-config not on your PATH"
[6df03c1]62  exit 1
63fi
[1324d6c]64# Force static linking so the user doesn't need to install wxWidgets.
[b7510ee]65WX_CONFIG=$WX_CONFIG' --static'
[0580c6a]66rm -rf *.dmg Survex macosxtmp
[deb58b87]67D=`pwd`/Survex
68T=`pwd`/macosxtmp
[2032841]69./configure --prefix="$D" --bindir="$D" --mandir="$T" WX_CONFIG="$WX_CONFIG" CC="gcc $arch_flags" CXX="g++ $arch_flags"
[6df03c1]70make
71make install
72#mv Survex/survex Survex/Survex
73
[b72f4b5]74# Construct the Aven application bundle.
[2032841]75mkdir Survex/Aven.app
76mkdir Survex/Aven.app/Contents
77mkdir Survex/Aven.app/Contents/MacOS
78mkdir Survex/Aven.app/Contents/Resources
79cp lib/Info.plist Survex/Aven.app/Contents
80printf APPLAVEN > Survex/Aven.app/Contents/PkgInfo
[b72f4b5]81cp -r $D/share/survex/* Survex/Aven.app/Contents/Resources/
[2032841]82# FIXME: Generate Survex/Aven.app/Resources/Aven.icns
[b72f4b5]83mv Survex/aven Survex/Aven.app/Contents/MacOS/
84rm -f Survex/share/survex/aven.txf
85rm -rf Survex/share/survex/icons
86
[6df03c1]87size=`du -s Survex|sed 's/[^0-9].*//'`
88# Allow 1000 extra sectors for various overheads (500 wasn't enough).
89sectors=`expr 1000 + $size`
90# Partition needs to be at least 4M and sectors are 512 bytes.
91if test $sectors -lt 8192 ; then
92  sectors=8192
93fi
94echo "Creating new blank image survex-macosx.dmg of $sectors sectors"
[0580c6a]95# This creates the diskimage file and initialises it as an HFS+ volume.
96hdiutil create -sectors $sectors survex-macosx -layout NONE -fs HFS+ -volname Survex
[6df03c1]97
[b72f4b5]98echo "Presenting image to the filesystems for mounting."
[6df03c1]99# This will mount the image onto the Desktop.
[0580c6a]100# Get the name of the device we mounted it on...
101dev=`hdid survex-macosx.dmg|tail -1|sed 's!/dev/\([!-~]*\).*!\1!;'`
102echo "Mounted on device $dev, copying files into image."
[6df03c1]103ditto -rsrcFork Survex /Volumes/Survex/Survex
104ditto lib/INSTALL.OSX /Volumes/Survex/INSTALL
[0580c6a]105echo "Detaching image."
106hdiutil detach $dev
[6df03c1]107
[deb58b87]108version=`sed 's/.*AM_INIT_AUTOMAKE([^,]*, *\([0-9.]*\).*/\1/p;d' configure.in`
109file=survex-macosx-`echo $version`.dmg
[6df03c1]110echo "Compressing image file survex-macosx.dmg to $file"
[0580c6a]111# This needs MacOS X 10.1 or above for unpacking - change UDZO to UDCO to allow
112# the dmg to be unpacked on 10.0 as well:
113hdiutil convert survex-macosx.dmg -format UDZO -o "$file"
114rm survex-macosx.dmg
[6df03c1]115
116echo "$file created successfully."
Note: See TracBrowser for help on using the repository browser.