source: git/ @ 9699215

Last change on this file since 9699215 was 9699215, checked in by Olly Betts <olly@…>, 5 months ago

Update PROJ project name and website

The name is now "PROJ" (all caps and no ".4" suffix) and the website

  • Property mode set to 100755
File size: 10.2 KB
[9d49627]3# You'll need some development tools which aren't installed by default.  To
4# get these you can install Xcode (which is a free download from Apple):
[9d49627]8# To build, open a terminal ( in the "Utils" folder in
9# "Applications") and unpack the downloaded survex source code. E.g. for
10# 1.2.17:
[9d49627]12#   tar xf survex-1.2.17.tar.gz
14# Then change directory into the unpacked sources:
16#   cd survex-1.2.17
18# And then run this script:
[2032841]20#   ./
[1aa20f9]22# This will automatically download and temporarily install wxWidgets,
[9699215]23# PROJ and FFmpeg in subdirectories of the source tree (this script is smart
[1aa20f9]24# enough not to re-download or re-build these if it already has).
[9699215]26# If you already have wxWidgets, PROJ and/or FFmpeg installed permanently,
[1aa20f9]27# you can disable these by passing one or more extra options - e.g. to build
28# none of them, use:
[f55cbeb]30#   ./ --no-install-wx --no-install-proj --no-install-ffmpeg
[1324d6c]32# If wxWidgets is installed somewhere such that wx-config isn't on your
[6df03c1]33# PATH you need to indicate where wx-config is by running this script
34# something like this:
[b7510ee]36#   env WX_CONFIG=/path/to/wx-config ./
[2032841]38# (If you set WX_CONFIG, there's no need to pass --no-install-wx).
[1324d6c]40# If using a pre-installed wxWidgets, note that it must satisfy the
[b72f4b5]41# following requirements:
[b72f4b5]43#   - It must be built with OpenGL support (--with-opengl).
[e840570]44#   - It must be wxWidgets >= 3.0
46# This script builds diskimages which are known to work at least as far back
47# as OS X 10.6.8.  A build of wxWidgets 3.0.2 with the options we pass will
48# default to assuming at least OS X 10.5, but we've not heard from anyone
49# trying with such an old version.
51# Mac OS X support "fat" binaries which contain code for more than one
52# processor, but the wxWidgets build system doesn't seem to allow creating
53# these, so we have to choose what processor family to build for.  By default
[5e6717d]54# we build for the architecture of the version of OS X the build machine is
55# running, which on a modern Mac will be x86_64, producing a build which will
56# only work on 64-bit Intel Macs (but that's probably all machines modern
57# enough to worry about).
[5e6717d]59# You can specify an arch explicitly on the command-line, e.g. to force a
60# build for 64-bit Intel Macs:
62#   ./ x86_64
64# Or if you want a build which also works on older 32 bit Intel Macs, then run
65# this script passing i386 on the command line, like so (assuming your compiler
66# supports this):
68#   ./ i386
[5e6717d]70# Or to build for much older machines with a Power PC processor, use (again
71# assuming your compiler supports this):
73#   ./ ppc
75set -e
[9d49627]80while [ "$#" != 0 ] ; do
81  case $1 in
82    --no-install-wx)
83      install_wx=no
84      shift
85      ;;
86    --no-install-proj)
87      install_proj=no
88      shift
89      ;;
[f55cbeb]90    --no-install-ffmpeg)
91      install_ffmpeg=no
[1aa20f9]92      shift
93      ;;
[9d49627]94    --help|-h)
[f55cbeb]95      echo "Usage: $0 [--no-install-wx] [--no-install-proj] [--no-install-ffmpeg] [ppc|i386|x86_86]"
[9d49627]96      exit 0
97      ;;
98    -*)
99      echo "Unknown option - try --help" >&2
100      exit 1
101      ;;
102    *)
103      break
104      ;;
105  esac
109if [ -z "$arch" ] ; then
110  arch=`uname -m`
112arch_flags="-arch $arch"
[0a287d2]114# UDBZ means the resultant disk image will only open on OS X 10.4 or above.
115# UDZO works on 10.1 and later, but is larger,  UDCO works on 10.0 as well,
116# but is larger still.
[9d49627]128if [ -z "${WX_CONFIG+set}" ] && [ "$install_wx" != no ] ; then
[0580c6a]129  if test -x WXINSTALL/bin/wx-config ; then
130    :
131  else
[deb58b87]132    prefix=`pwd`/WXINSTALL
[766e858]133    wxtarball=wxWidgets-$WX_VERSION.tar.bz2
[56980d4]134    test -f "$wxtarball" || \
[766e858]135      curl -L -O "$WX_VERSION/$wxtarball"
[d752afd]136    if echo "$WX_SHA256  $wxtarball" | shasum -a256 -c ; then
137      : # OK
138    else
139      echo "Checksum of downloaded file '$wxtarball' is incorrect, aborting."
140      exit 1
141    fi
[56980d4]142    echo "+++ Extracting $wxtarball"
[e576111]143    test -d "wxWidgets-$WX_VERSION" || tar xf "$wxtarball"
[976a038]144    test -d "wxWidgets-$WX_VERSION/BUILD" || mkdir "wxWidgets-$WX_VERSION/BUILD"
145    cd "wxWidgets-$WX_VERSION/BUILD"
[4df1235]146    # Compilation of wx 3.0.2 fails on OS X 10.10.1 with webview enabled.
[1fce809]147    # A build with liblzma enabled doesn't work on OS X 10.6.8.
148    ../configure --disable-shared --prefix="$prefix" \
[cf9156d]149        --with-opengl --enable-display \
[1fce809]150        --disable-webview --without-liblzma \
151        CC="gcc $arch_flags" CXX="g++ $arch_flags"
[0580c6a]152    make -s
153    make -s install
154    cd ../..
155  fi
[b7510ee]156  WX_CONFIG=`pwd`/WXINSTALL/bin/wx-config
[1c80bef]159[ -n "${WX_CONFIG}" ] || WX_CONFIG=`which wx-config 2>/dev/null`
160if [ -z "${WX_CONFIG}" ] ; then
161  echo "wx-config not found in PATH."
162  echo
163  echo "If wxWidgets is installed, you can specify its location by setting environment variable WX_CONFIG:"
164  echo
165  echo "WX_CONFIG=/opt/bin/wx-config sh ./"
166  exit 1
[fb880024]168CC=`$WX_CONFIG --cc`
169CXX=`$WX_CONFIG --cxx`
[9d49627]171if [ "$install_proj" != no ] ; then
[fb880024]172  if test -f PROJINSTALL/include/proj_api.h ; then
173    :
174  else
175    prefix=`pwd`/PROJINSTALL
176    projtarball=proj-$PROJ_VERSION.tar.gz
177    test -f "$projtarball" || \
178      curl -O "$projtarball"
179    if echo "$PROJ_SHA256  $projtarball" | shasum -a256 -c ; then
180      : # OK
181    else
182      echo "Checksum of downloaded file '$projtarball' is incorrect, aborting."
183      exit 1
184    fi
185    echo "+++ Extracting $projtarball"
[e576111]186    test -d "proj-$PROJ_VERSION" || tar xf "$projtarball"
[976a038]187    test -d "proj-$PROJ_VERSION/BUILD" || mkdir "proj-$PROJ_VERSION/BUILD"
188    cd "proj-$PROJ_VERSION/BUILD"
[fb880024]189    ../configure --disable-shared --prefix="$prefix" CC="$CC" CXX="$CXX"
190    make -s
191    make -s install
192    cd ../..
193  fi
[f55cbeb]196if [ "$install_ffmpeg" != no ] ; then
197  if test -f FFMPEGINSTALL/include/libavcodec/avcodec.h ; then
[1aa20f9]198    :
199  else
[f55cbeb]200    prefix=`pwd`/FFMPEGINSTALL
201    ffmpegtarball=ffmpeg-$FFMPEG_VERSION.tar.xz
202    test -f "$ffmpegtarball" || \
203      curl -O "$ffmpegtarball"
204    if echo "$FFMPEG_SHA256  $ffmpegtarball" | shasum -a256 -c ; then
[1aa20f9]205      : # OK
206    else
[f55cbeb]207      echo "Checksum of downloaded file '$ffmpegtarball' is incorrect, aborting."
[1aa20f9]208      exit 1
209    fi
[f55cbeb]210    echo "+++ Extracting $ffmpegtarball"
211    test -d "ffmpeg-$FFMPEG_VERSION" || tar xf "$ffmpegtarball"
212    test -d "ffmpeg-$FFMPEG_VERSION/BUILD" || mkdir "ffmpeg-$FFMPEG_VERSION/BUILD"
213    cd "ffmpeg-$FFMPEG_VERSION/BUILD"
214    FFMPEG_CONFIGURE_OPTS='--disable-shared --disable-programs --disable-network --disable-bsfs --disable-protocols --disable-devices'
[6835e68]215    # We don't need to decode video, but disabling these causes a link failure
216    # when linking aven:
217    # --disable-decoders --disable-demuxers
[82901f0]218    if ! nasm -hf|grep -q macho64 ; then
[1aa20f9]219      # nasm needs to support macho64, at least for x86_64 builds.
[f55cbeb]220      FFMPEG_CONFIGURE_OPTS="$FFMPEG_CONFIGURE_OPTS --disable-yasm"
[1aa20f9]221    fi
[f55cbeb]222    ../configure --prefix="$prefix" --cc="$CC" $FFMPEG_CONFIGURE_OPTS
[1aa20f9]223    make -s
224    make -s install
225    cd ../..
226  fi
[b7510ee]229test -n "$WX_CONFIG" || WX_CONFIG=`which wx-config`
230if test -z "$WX_CONFIG" ; then
231  echo "WX_CONFIG not set and wx-config not on your PATH"
[6df03c1]232  exit 1
[1324d6c]234# Force static linking so the user doesn't need to install wxWidgets.
[b7510ee]235WX_CONFIG=$WX_CONFIG' --static'
[0580c6a]236rm -rf *.dmg Survex macosxtmp
[f678705]241export PKG_CONFIG_PATH
[1aa20f9]242./configure --prefix="$D" --bindir="$D" --mandir="$T" \
[f678705]243    WX_CONFIG="$WX_CONFIG" CC="$CC" CXX="$CXX"
245make install
246#mv Survex/survex Survex/Survex
[b72f4b5]248# Construct the Aven application bundle.
[2ed64d4]249make create-aven-app APP_PATH=Survex/
[09dfd18]250mv Survex/share/doc/survex Survex/Docs
251rmdir Survex/share/doc
[47eeb112]252mv Survex/share/survex/images Survex/
253mv Survex/share/survex/unifont.pixelfont Survex/
254ln Survex/share/survex/*.msg Survex/
[b72f4b5]255mv Survex/aven Survex/
[c0a3f6a9]256ln Survex/cavern Survex/extend Survex/
[47eeb112]257rm -rf Survex/share/applications Survex/share/icons Survex/share/mime-info
[278e305]258mkdir Survex/share/survex/proj
259cp -p PROJINSTALL/share/proj/epsg PROJINSTALL/share/proj/esri Survex/share/survex/proj
260mkdir Survex/
261ln Survex/share/survex/proj/* Survex/
[6df03c1]263size=`du -s Survex|sed 's/[^0-9].*//'`
[1aa20f9]264# Allow 1500 extra sectors for various overheads (1000 wasn't enough).
265sectors=`expr 1500 + "$size"`
[6df03c1]266# Partition needs to be at least 4M and sectors are 512 bytes.
[56980d4]267if test "$sectors" -lt 8192 ; then
[6df03c1]268  sectors=8192
270echo "Creating new blank image survex-macosx.dmg of $sectors sectors"
[0580c6a]271# This creates the diskimage file and initialises it as an HFS+ volume.
[56980d4]272hdiutil create -sectors "$sectors" survex-macosx -layout NONE -fs HFS+ -volname Survex
[b72f4b5]274echo "Presenting image to the filesystems for mounting."
[6df03c1]275# This will mount the image onto the Desktop.
[ab66f3c]276# Get the name of the device it is mounted on and the mount point.
278# man hdiutil says:
279# "The output of [hdiutil] attach has been stable since OS X 10.0 (though it
280# was called hdid(8) then) and is intended to be program-readable.  It consists
281# of the /dev node, a tab, a content hint (if applicable), another tab, and a
282# mount point (if any filesystems were mounted)."
284# In reality, it seems there are also some spaces before each tab character.
[ab66f3c]285hdid_output=`hdid survex-macosx.dmg|tail -1`
286echo "Last line of hdid output was: $hdid_output"
[f04ae51]287dev=`echo "$hdid_output"|sed 's!/dev/\([^        ]*\).*!\1!'`
[fc4d068]288mount_point=`echo "$hdid_output"|sed 's!.*      !!'`
290echo "Device $dev mounted on $mount_point, copying files into image."
291ditto -rsrcFork Survex "$mount_point/Survex"
292ditto lib/INSTALL.OSX "$mount_point/INSTALL"
[0580c6a]294echo "Detaching image."
[56980d4]295hdiutil detach "$dev"
[d260645]297version=`sed 's/^VERSION *= *//p;d' Makefile`
[6df03c1]299echo "Compressing image file survex-macosx.dmg to $file"
[0a287d2]300hdiutil convert survex-macosx.dmg -format "$dmg_format" -o "$file"
[0580c6a]301rm survex-macosx.dmg
303echo "$file created successfully."
Note: See TracBrowser for help on using the repository browser.