Changeset 90dd91b in git


Ignore:
Timestamp:
20/09/11 07:08:31 (8 years ago)
Author:
Olly Betts <olly@…>
Branches:
svn/1.0, svn/tags/1.0.40
Children:
ea08a83
Parents:
145ed2f
Message:

Backport changes from 1.2.0:
buildmacosx.sh: Sync useful changes from 1.2.0.

git-svn-id: file:///home/survex-svn/survex/branches/1.0@3672 4b37db11-9a0c-4f06-9ece-9ab7cdaee568

Files:
2 edited

Legend:

Unmodified
Added
Removed
  • ChangeLog

    r145ed2f r90dd91b  
     1Tue Sep 20 06:08:01 GMT 2011  Olly Betts <olly@survex.com>
     2
     3        * Backport changes from 1.2.0:
     4        * buildmacosx.sh: Sync useful changes from 1.2.0.
     5
    16Mon Jun 21 17:07:13 GMT 2010  Olly Betts <olly@survex.com>
    27
  • buildmacosx.sh

    r145ed2f r90dd91b  
    44# which require MacOS X 10.1 or greater to install.
    55#
    6 # Run from the unpacked survex-1.0.X directory like so:
     6# Currently (at least if built on 10.6) at least 10.6 is required to run.
    77#
    8 #   ./buildmacosx.sh --install-wx
     8# You probably need to have Xcode installed - you can download this for free
     9# from Apple: http://developer.apple.com/xcode/
     10#
     11# Run from the unpacked survex-1.1.X directory like so:
     12#
     13#   ./buildmacosx.sh
    914#
    1015# This will automatically download and temporarily install wxWidgets
     
    1419# If you already have wxWidgets installed permanently, use:
    1520#
    16 #   ./buildmacosx.sh
     21#   ./buildmacosx.sh --no-install-wx
    1722#
    1823# If wxWidgets is installed somewhere such that wx-config isn't on your
     
    2025# something like this:
    2126#
    22 #   env WXCONFIG=/path/to/wx-config ./buildmacosx.sh
     27#   env WX_CONFIG=/path/to/wx-config ./buildmacosx.sh
     28#
     29# (If you set WX_CONFIG, there's no need to pass --no-install-wx).
     30#
     31# If using a pre-installed wxWidgets, note that it must satisfy the
     32# following requirements:
     33#   - It must be built with OpenGL support (--with-opengl).
     34#   - It must be the Carbon version.
     35#   - It probably should be a "Unicode" build (--enable-unicode).
    2336
    2437set -e
    2538
    26 if test "x$1" = "x--install-wx" ; then
     39# 2.8.12 doesn't work:
     40# /bin/sh: line 0: cd: ../build/bakefiles/wxpresets/presets: No such file or directory
     41# cp: wx.bkl: No such file or directory
     42# [...]
     43WXVERSION=2.8.11
     44
     45# Sadly, you can only specify one arch via -arch at a time (a restriction of
     46# the wxWidgets build system).
     47#
     48# Using -arch i386 produces a build which will also work on 64-bit Intel Macs.
     49# If you want a build which *only* works on 64 bit Intel Macs, then use
     50# arch_flags='-arch x86_64' instead.
     51#
     52# To build for older machines with a ppc CPU, you want arch_flags='-arch ppc'
     53# instead.
     54arch_flags='-arch i386'
     55if [ -z "${WX_CONFIG+set}" ] && [ "x$1" != "x--no-install-wx" ] ; then
    2756  if test -x WXINSTALL/bin/wx-config ; then
    2857    :
    2958  else
    3059    prefix=`pwd`/WXINSTALL
    31     test -f wxMac-2.4.2.tar.gz || \
    32       wget ftp://biolpc22.york.ac.uk/pub/2.4.2/wxMac-2.4.2.tar.gz
    33     test -d wxMac-2.4.2 || tar zxvf wxMac-2.4.2.tar.gz
    34     test -d wxMac-2.4.2/build || mkdir wxMac-2.4.2/build
    35     cd wxMac-2.4.2/build
    36     ../configure --disable-shared --prefix="$prefix"
     60    wxtarball=wxWidgets-$WXVERSION.tar.bz2
     61    test -f "$wxtarball" || \
     62      curl -O "ftp://ftp.wxwidgets.org/pub/$WXVERSION/$wxtarball"
     63    echo "+++ Extracting $wxtarball"
     64    test -d "wxWidgets-$WXVERSION" || tar jxf "$wxtarball"
     65    test -d "wxWidgets-$WXVERSION/build" || "mkdir wxWidgets-$WXVERSION/build"
     66    cd "wxWidgets-$WXVERSION/build"
     67    ../configure --disable-shared --prefix="$prefix" --with-opengl --disable-unicode CC="gcc $arch_flags" CXX="g++ $arch_flags"
    3768    make -s
    3869    make -s install
    3970    cd ../..
    4071  fi
    41   WXCONFIG=`pwd`/WXINSTALL/bin/wx-config
     72  WX_CONFIG=`pwd`/WXINSTALL/bin/wx-config
    4273fi
    4374
    44 test -n "$WXCONFIG" || WXCONFIG=`which wx-config`
    45 if test -z "$WXCONFIG" ; then
    46   echo "WXCONFIG not set and wx-config not on your PATH"
     75test -n "$WX_CONFIG" || WX_CONFIG=`which wx-config`
     76if test -z "$WX_CONFIG" ; then
     77  echo "WX_CONFIG not set and wx-config not on your PATH"
    4778  exit 1
    4879fi
    4980# Force static linking so the user doesn't need to install wxWidgets.
    50 WXCONFIG=$WXCONFIG' --static'
    51 export WXCONFIG
     81WX_CONFIG=$WX_CONFIG' --static'
    5282rm -rf *.dmg Survex macosxtmp
    5383D=`pwd`/Survex
    5484T=`pwd`/macosxtmp
    55 ./configure --prefix="$D" --bindir="$D" --mandir="$T" CFLAGS=-DMACOSX_BUNDLE
     85./configure --prefix="$D" --bindir="$D" --mandir="$T" CFLAGS=-DMACOSX_BUNDLE WX_CONFIG="$WX_CONFIG" CC="gcc $arch_flags" CXX="g++ $arch_flags"
    5686make
    5787make install
    5888#mv Survex/survex Survex/Survex
    5989
     90# Construct the Aven application bundle.
     91mkdir Survex/Aven.app
     92mkdir Survex/Aven.app/Contents
     93mkdir Survex/Aven.app/Contents/MacOS
     94mkdir Survex/Aven.app/Contents/Resources
     95cp lib/Info.plist Survex/Aven.app/Contents
     96printf APPLAVEN > Survex/Aven.app/Contents/PkgInfo
     97cp -r "$D"/share/survex/* Survex/Aven.app/Contents/Resources/
     98# FIXME: Generate Survex/Aven.app/Resources/Aven.icns
     99mv Survex/aven Survex/Aven.app/Contents/MacOS/
     100rm -rf Survex/share/survex/icons
     101
    60102size=`du -s Survex|sed 's/[^0-9].*//'`
    61103# Allow 1000 extra sectors for various overheads (500 wasn't enough).
    62 sectors=`expr 1000 + $size`
     104sectors=`expr 1000 + "$size"`
    63105# Partition needs to be at least 4M and sectors are 512 bytes.
    64 if test $sectors -lt 8192 ; then
     106if test "$sectors" -lt 8192 ; then
    65107  sectors=8192
    66108fi
    67109echo "Creating new blank image survex-macosx.dmg of $sectors sectors"
    68110# This creates the diskimage file and initialises it as an HFS+ volume.
    69 hdiutil create -sectors $sectors survex-macosx -layout NONE -fs HFS+ -volname Survex
     111hdiutil create -sectors "$sectors" survex-macosx -layout NONE -fs HFS+ -volname Survex
    70112
    71 echo "Present image to the filesystems for mounting."
     113echo "Presenting image to the filesystems for mounting."
    72114# This will mount the image onto the Desktop.
    73 # Get the name of the device we mounted it on...
    74 dev=`hdid survex-macosx.dmg|tail -1|sed 's!/dev/\([!-~]*\).*!\1!;'`
    75 echo "Mounted on device $dev, copying files into image."
    76 ditto -rsrcFork Survex /Volumes/Survex/Survex
    77 ditto lib/INSTALL.OSX /Volumes/Survex/INSTALL
     115# Get the name of the device it is mounted on and the mount point.
     116
     117# man hdiutil says:
     118# "The output of [hdiutil] attach has been stable since OS X 10.0 (though it
     119# was called hdid(8) then) and is intended to be program-readable.  It consists
     120# of the /dev node, a tab, a content hint (if applicable), another tab, and a
     121# mount point (if any filesystems were mounted)."
     122#
     123# In reality, it seems there are also some spaces before each tab character.
     124hdid_output=`hdid survex-macosx.dmg|tail -1`
     125echo "Last line of hdid output was: $hdid_output"
     126dev=`echo "$hdid_output"|sed 's!/dev/\([^        ]*\).*!\1!'`
     127mount_point=`echo "$hdid_output"|sed 's!.*[      ]!!'`
     128
     129echo "Device $dev mounted on $mount_point, copying files into image."
     130ditto -rsrcFork Survex "$mount_point/Survex"
     131ditto lib/INSTALL.OSX "$mount_point/INSTALL"
     132
    78133echo "Detaching image."
    79 hdiutil detach $dev
     134hdiutil detach "$dev"
    80135
    81136version=`sed 's/.*AM_INIT_AUTOMAKE([^,]*, *\([0-9.]*\).*/\1/p;d' configure.in`
    82 file=survex-macosx-`echo $version`.dmg
     137file=survex-macosx-$version.dmg
    83138echo "Compressing image file survex-macosx.dmg to $file"
    84139# This needs MacOS X 10.1 or above for unpacking - change UDZO to UDCO to allow
Note: See TracChangeset for help on using the changeset viewer.