1#!/bin/sh 2echo "Script to invoke Jam and then package the binary release." 3 4# Must use this rather than "jam -q" to ensure builtin libraries are used. 5 6# Set the environment string VERSION from the #define, ie 1.0.0 7VERSION=`grep ARGYLL_VERSION_STR h/aconfig.h | head -1 | sed 's/# define ARGYLL_VERSION_STR //' | sed 's/"//g'` 8 9# Typical environment variables: 10# (NOTE some systems don't export these ENV vars. by default !!!) 11# 12# Platform $OSTYPE $MACHTYPE $HOSTTYPE 13# 14# Win2K [CMD.EXE] (none) (none) (none) 15# 16# Cygwin Win2K [bash] cygwin i686-pc-cygwin i686 17# 18# OS X PPC 10.3 [zsh] darwin7.0 powerpc (none) 19# 20# OS X i386 10.4 [bash] darwin8.0 i386-apple-darwin8.0 i386 21# 22# OS X i386 10.5 [bash] darwin9.0 i386-apple-darwin9.0 i386 23# 24# OS X i386 10.6 [bash] darwin10.0 x86_64-apple-darwin10.0 x86_64 25# 26# OS X i386 10.7 [bash] darwin11 x86_64-apple-darwin11 x86_64 27# 28# Linux RH 4.0 [bash] linux-gnu i686-redhat-linux-gnu i686 29# 30# Linux Fedora 7.1 [bash] linux-gnu i386-redhat-linux-gnu i386 31# Linux Ubuntu ??7 linux-gnu i486-pc-linux-gnu i686 32# 33# Linux Fedora 7.1 64 bit [bash] linux-gnu x86_64-redhat-linux-gnu x86_64 34# Ubuntu 12.10 64 bit [bash] linux-gnu x86_64-pc-linux-gnu x86_64 35# 36# FreeBSD 9.1 64 bit [bash] freebsd9.1 amd64-portbld-freebsd9.1 amd64 37# 38 39echo "About to make Argyll binary distribution $VERSION" 40 41TOPDIR=Argyll_V$VERSION 42 43if [ X$OS != "XWindows_NT" ] ; then 44 # Fixup issues with the .zip format 45 chmod +x *.sh 46fi 47 48# Make sure that some environment variable are visible to Jam: 49export OSTYPE MACHTYPE HOSTTYPE 50unset USETARPREFIX 51 52# .sp come from profile, .cht from scanin and .ti3 from spectro 53rm -f bin/*.exe bin/*.dll 54rm -f ref/*.sp ref/*.cht ref/*.ti2 55 56# Make sure it's built and installed 57if ! jam -q -fJambase -j${NUMBER_OF_PROCESSORS:-2} -sBUILTIN_TIFF=true -sBUILTIN_JPEG=true -sBUILTIN_PNG=true -sBUILTIN_Z=true -sBUILTIN_SSL=true install ; then 58 echo "Build failed!" 59 exit 1 60fi 61 62# Maybe we could get Jam to do the following ? 63 64if [ X$OS = "XWindows_NT" ] ; then 65 echo "We're on MSWindows!" 66 # Hack cross comile 67 if [ X$COMPILER = "XMINGW64" ] ; then 68 echo "We're cross compiling to MSWin 64 bit !" 69 PACKAGE=Argyll_V${VERSION}_win64_exe.zip 70 USBDIRS="usb" 71 USBBINFILES="binfiles.msw" 72 unset USETAR 73 else 74 # ~~ should detect native 64 bit here ~~ 75 echo "We're on MSWin 32 bit !" 76 PACKAGE=Argyll_V${VERSION}_win32_exe.zip 77 USBDIRS="usb" 78 USBBINFILES="binfiles.msw" 79 unset USETAR 80 fi 81else if [ X$OSTYPE = "Xdarwin7.0" ] ; then 82 echo "We're on OSX 10.3 PPC!" 83 PACKAGE=Argyll_V${VERSION}_osx10.3_ppc_bin.tgz 84 USBDIRS="usb" 85 USBBINFILES="binfiles.osx" 86 USETAR=true 87else if [ X$OSTYPE = "Xdarwin8.0" ] ; then 88 if [ X$MACHTYPE = "Xi386-apple-darwin8.0" ] ; then 89 echo "We're on OSX 10.4 i386!" 90 PACKAGE=Argyll_V${VERSION}_osx10.4_i86_bin.tgz 91 else if [ X$MACHTYPE = "Xpowerpc-apple-darwin8.0" ] ; then 92 echo "We're on OSX 10.4 PPC!" 93 PACKAGE=Argyll_V${VERSION}_osx10.4_ppc_bin.tgz 94 fi 95 fi 96 USBDIRS="usb" 97 USBBINFILES="binfiles.osx" 98 USETAR=true 99else if [ X$OSTYPE = "Xdarwin10.0" \ 100 -o X$OSTYPE = "Xdarwin11" ] ; then 101 if [ X$HOSTTYPE = "Xx86_64" ] ; then 102 echo "We're on OSX 10.6 x86_64!" 103 PACKAGE=Argyll_V${VERSION}_osx10.6_x86_64_bin.tgz 104 fi 105 USBDIRS="usb" 106 USBBINFILES="binfiles.osx" 107 USETAR=true 108 USETARPREFIX=true 109else if [ X$OSTYPE = "Xlinux-gnu" ] ; then 110 if [[ "$MACHTYPE" = x86_64-*-linux-gnu ]] ; then 111 echo "We're on Linux x86_64!" 112 PACKAGE=Argyll_V${VERSION}_linux_x86_64_bin.tgz 113 else if [[ "$MACHTYPE" = *86-*-linux-gnu ]] ; then 114 echo "We're on Linux x86!" 115 PACKAGE=Argyll_V${VERSION}_linux_x86_bin.tgz 116 fi 117 fi 118 USBDIRS="usb" 119 USBBINFILES="binfiles.lx" 120 USETAR=true 121fi 122fi 123fi 124fi 125fi 126 127if [ X$PACKAGE = "X" ] ; then 128 echo "Unknown host - build failed!" 129 exit 1 130fi 131 132echo "Making GNU Argyll binary distribution $PACKAGE for Version $VERSION" 133 134rm -rf $TOPDIR 135mkdir $TOPDIR 136 137# Collect the names of all the files that we're going to package 138unset topfiles; for i in `cat binfiles`; do topfiles="$topfiles ${i}"; done 139unset docfiles; for i in `cat doc/afiles`; do docfiles="$docfiles doc/${i}"; done 140unset usbfiles; 141for j in ${USBDIRS}; do 142 if [ ${j} ]; then 143 for i in `cat ${j}/${USBBINFILES}`; do usbfiles="$usbfiles ${j}/${i}"; done 144 fi 145done 146 147allfiles="${topfiles} bin/* ref/* ${docfiles} ${usbfiles}" 148 149# Copy all the files to the package top directory 150for i in ${allfiles}; do 151 path=${i%/*} # extract path without filename 152 file=${i##*/} # extract filename 153 if [ $path = $i ] ; then 154 path= 155 fi 156 if [ X$path != "X" ] ; then 157 mkdir -p $TOPDIR/${path} 158 fi 159 cp $i $TOPDIR/$i 160done 161 162# Create the package 163rm -f $PACKAGE 164if [ X$USETAR = "Xtrue" ] ; then 165 if [ X$USETARPREFIX = "Xtrue" ] ; then 166 # Don't save ._* files... 167 COPYFILE_DISABLE=1 tar -czvf $PACKAGE $TOPDIR 168 else 169 tar -czvf $PACKAGE $TOPDIR 170 fi 171 # tar -xzf to extract 172 # tar -tzf to list 173 # Should we use "COPYFILE_DISABLE=1 tar .." on OS X ?? 174else 175 zip -9 -r $PACKAGE $TOPDIR 176 # unzip to extract 177 # unzip -l to list 178fi 179rm -rf $TOPDIR 180echo "Done GNU Argyll binary distribution $PACKAGE" 181 182exit 0 183 184