diff --git a/.gitignore b/.gitignore index 4fce3b1..e19bdf7 100644 --- a/.gitignore +++ b/.gitignore @@ -95,4 +95,5 @@ examples/*.fits examples/*.xml examples/*.dat examples/ctools -pkgbuild +pkg_build +pkg_check diff --git a/Makefile.am b/Makefile.am index 28a9089..441b226 100644 --- a/Makefile.am +++ b/Makefile.am @@ -94,7 +94,7 @@ help: pkg: @case `uname -s` in \ Darwin*) \ - echo "Darwin supported"; \ + echo "Build Mac OS X installation image"; \ dev/pkgbuild-macosx.sh $(PACKAGE_VERSION); \ ;; \ Linux*) \ @@ -118,7 +118,8 @@ pkg: pkgcheck: @case `uname -s` in \ Darwin*) \ - echo "Darwin supported"; \ + echo "Check Mac OS X installation image"; \ + dev/pkgcheck-macosx.sh $(PACKAGE_VERSION); \ ;; \ Linux*) \ if type lsb_release >/dev/null 2>&1; then \ diff --git a/dev/pkgbuild-macosx.sh b/dev/pkgbuild-macosx.sh index 499640c..9987019 100755 --- a/dev/pkgbuild-macosx.sh +++ b/dev/pkgbuild-macosx.sh @@ -42,7 +42,7 @@ CTOOLS=ctools-$VERSION # ============== # # Set parameters # # ============== # -WRKDIR=$PWD/pkgbuild +WRKDIR=$PWD/pkg_build INSTALLDIR=$WRKDIR/install SRCDIR=$WRKDIR/src PKGDIR=$WRKDIR/pkg diff --git a/dev/pkgcheck-macosx.sh b/dev/pkgcheck-macosx.sh new file mode 100755 index 0000000..81ff37c --- /dev/null +++ b/dev/pkgcheck-macosx.sh @@ -0,0 +1,114 @@ +#!/bin/bash -f +# ========================================================================== +# ctools Mac OS X package validation +# +# Copyright (C) 2017 Juergen Knoedlseder +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +# ========================================================================== + +# ============================================= # +# Get ctools/GammaLib version from command line # +# ============================================= # +if [ $# -ne 1 ] ; then + echo "Please specify ctools/GammaLib version in the form x.y.z" + exit 1 +fi +VERSION=$1 + + +# =============================== # +# Set software component versions # +# =============================== # +#CFITSIO=cfitsio3410 +#NCURSES=ncurses-6.0 +#READLINE=readline-7.0 +#GAMMALIB=gammalib-$VERSION +CTOOLS=ctools-$VERSION + + +# ============== # +# Set parameters # +# ============== # +WRKDIR=$PWD/pkg_check +PKGDIR=$PWD/pkg_build + + +#INSTALLDIR=$WRKDIR/install +#SRCDIR=$WRKDIR/src +#PKGDIR=$WRKDIR/pkg +#PRODDIR=$WRKDIR/prod +#PLISTFILE=$PKGDIR/$CTOOLS-components.plist +#DISTFILE=$PRODDIR/$CTOOLS.dist +DMGFILE=$PKGDIR/$CTOOLS-macosx10.7.dmg + + +# ====================== # +# Clean package creation # +# ====================== # +umount $WRKDIR +rm -rf $WRKDIR + + +# ============================= # +# Create package directory tree # +# ============================= # +mkdir -p $WRKDIR + + +# ================================= # +# Create Mac OS X RAM disk (488 MB) # +# ================================= # +DEVICE=$(hdiutil attach ram://1000000 -nomount) +diskutil erasevolume HFS+ 'ctools-test' $DEVICE +umount -f /Volumes/ctools-test +#sudo diskutil enableOwnership $DEVICE # You must be root for this command +mount -t hfs $DEVICE $WRKDIR + + +# =============== # +# Install package # +# =============== # +echo $DMGFILE +hdiutil attach $DMGFILE +sudo installer -pkg /Volumes/$CTOOLS/$CTOOLS.pkg -target $WRKDIR # You must be root for this command +hdiutil detach /Volumes/$CTOOLS + + +# ================= # +# Configure package # +# ================= # +env +export GAMMALIB=$WRKDIR/usr/local/gamma +source $GAMMALIB/bin/gammalib-init.sh +export CTOOLS=$WRKDIR/usr/local/gamma +source $CTOOLS/bin/ctools-init.sh +echo +echo +env + + +# ============ # +# Test package # +# ============ # +python -c 'import gammalib; gammalib.test()' +python -c 'import ctools; ctools.test()' + + +# =============== # +# Detach RAM disk # +# =============== # +#hdiutil detach $WRKDIR + diff --git a/src/ctools-setup.in b/src/ctools-setup.in index f4359fb..2acf68b 100644 --- a/src/ctools-setup.in +++ b/src/ctools-setup.in @@ -26,8 +26,9 @@ fi # # Set parameters # ============== -prefix="@prefix@" -exec_prefix="@exec_prefix@" +#prefix="@prefix@" +prefix=$CTOOLS +#exec_prefix="@exec_prefix@" ctools_bin="@bindir@" ctools_lib="@libdir@" uname_system=`uname`