From 0862c211c7a6e7136fe11a9fd85628e6dde6ccd8 Mon Sep 17 00:00:00 2001 From: Jürgen Knödlseder Date: Fri, 24 Feb 2017 09:53:11 +0100 Subject: [PATCH] Revert from using $GAMMALIB in setup script (#1929) --- cscripts/Makefile.am | 2 +- dev/pkgbuild-macosx.sh | 120 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-------------------------- dev/pkgcheck-macosx.sh | 64 ++++++++++++++++++++++++++++++++++++---------------------------- src/ctools-setup.in | 30 +++++++++++++++--------------- 4 files changed, 146 insertions(+), 70 deletions(-) diff --git a/cscripts/Makefile.am b/cscripts/Makefile.am index 0a863c2..683dc09 100644 --- a/cscripts/Makefile.am +++ b/cscripts/Makefile.am @@ -1,7 +1,7 @@ ############################################################################# # Makefile for cscripts scripts # # ------------------------------------------------------------------------- # -# Copyright (C) 2016 Juergen Knoedlseder # +# Copyright (C) 2016-2017 Juergen Knoedlseder # # ------------------------------------------------------------------------- # # # # This program is free software: you can redistribute it and/or modify # diff --git a/dev/pkgbuild-macosx.sh b/dev/pkgbuild-macosx.sh index 9987019..e7492e5 100755 --- a/dev/pkgbuild-macosx.sh +++ b/dev/pkgbuild-macosx.sh @@ -1,4 +1,4 @@ -#!/bin/bash -f +#!/bin/bash # ========================================================================== # ctools Mac OS X package creation # @@ -17,6 +17,14 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # +# ------------------------------------------------------------------------- +# +# This script installs the ctools and GammaLib packages in the location +# /usr/local/gamma and then builds a Mac OS X package which is finally put +# onto a disk image. Any existing content in /usr/local/gamma will be +# destroyed. The script needs the priviledges to create a folder in +# /usr/local. +# # ========================================================================== # ============================================= # @@ -33,8 +41,8 @@ VERSION=$1 # Set software component versions # # =============================== # CFITSIO=cfitsio3410 -NCURSES=ncurses-6.0 -READLINE=readline-7.0 +NCURSES=ncurses-5.9 +READLINE=readline-6.3 GAMMALIB=gammalib-$VERSION CTOOLS=ctools-$VERSION @@ -42,23 +50,33 @@ CTOOLS=ctools-$VERSION # ============== # # Set parameters # # ============== # +INSTALLDIR=/usr/local/gamma WRKDIR=$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=$WRKDIR/$CTOOLS-macosx10.7.dmg +LOGFILE=$PWD/pkg_build.log -# ====================== # -# Clean package creation # -# ====================== # +# ============================= # +# Secure installation directory # +# ============================= # +if [ -d "$INSTALLDIR" ]; then + mv $INSTALLDIR $INSTALLDIR.backup +fi + + +# ======================= # +# Clean package directory # +# ======================= # rm -rf $INSTALLDIR rm -rf $PKGDIR rm -rf $PRODDIR rm -rf $DMGFILE +rm -rf $LOGFILE # ============================= # @@ -69,10 +87,6 @@ mkdir -p $PKGDIR mkdir -p $PRODDIR -# Make sure that wget is installed -# TODO: If not installed, execute "brew install wget" - - # =============== # # Install ncurses # # =============== # @@ -87,9 +101,9 @@ if [ ! -d "$NCURSES" ]; then fi fi cd $NCURSES -./configure --prefix=$INSTALLDIR --with-shared -make -make install +./configure --prefix=$INSTALLDIR --with-shared | tee -a $LOGFILE +make -j4 | tee -a $LOGFILE +make install | tee -a $LOGFILE # ================ # @@ -106,9 +120,9 @@ if [ ! -d "$READLINE" ]; then fi fi cd $READLINE -./configure --prefix=$INSTALLDIR -make -make install +./configure --prefix=$INSTALLDIR | tee -a $LOGFILE +make -j4 | tee -a $LOGFILE +make install | tee -a $LOGFILE # =============== # @@ -125,9 +139,9 @@ if [ ! -d "cfitsio" ]; then fi fi cd cfitsio -./configure --prefix=$INSTALLDIR -make shared -make install +./configure --prefix=$INSTALLDIR | tee -a $LOGFILE +make -j4 shared | tee -a $LOGFILE +make install | tee -a $LOGFILE # ================ # @@ -178,9 +192,9 @@ if [ -d ".git" ]; then ./autogen.sh fi # Build code -./configure --prefix=$INSTALLDIR -make -make install +./configure --prefix=$INSTALLDIR | tee -a $LOGFILE +make -j4 | tee -a $LOGFILE +make install | tee -a $LOGFILE # ============== # @@ -222,9 +236,49 @@ if [ -d ".git" ]; then ./autogen.sh fi # Build code -./configure --prefix=$INSTALLDIR -make -make install +./configure --prefix=$INSTALLDIR | tee $LOGFILE +make -j4 | tee $LOGFILE +make install | tee $LOGFILE + + +# ================= # +# Post-process code # +# ================= # +# Change links in libraries +for file in ${INSTALLDIR}/lib/*.dylib +do + echo $file | tee -a $LOGFILE + install_name_tool -change "@rpath/libcfitsio.5.dylib" "$INSTALLDIR/lib/libcfitsio.5.dylib" $file +done + +# Change links in binaries +for file in ${INSTALLDIR}/bin/ct* +do + echo $file | tee -a $LOGFILE + install_name_tool -change "@rpath/libcfitsio.5.dylib" "$INSTALLDIR/lib/libcfitsio.5.dylib" $file +done + +# Change links in Python modules +pythons="python2.7" +for python in $pythons +do + # Print Python version + echo $python | tee -a $LOGFILE + + # Change links in gammalib modules + for file in ${INSTALLDIR}/lib/$python/site-packages/gammalib/_*.so + do + echo $file | tee -a $LOGFILE + install_name_tool -change "@rpath/libcfitsio.5.dylib" "$INSTALLDIR/lib/libcfitsio.5.dylib" $file + done + + # Change links in ctools modules + for file in ${INSTALLDIR}/lib/$python/site-packages/ctools/_*.so + do + echo $file | tee -a $LOGFILE + install_name_tool -change "@rpath/libcfitsio.5.dylib" "$INSTALLDIR/lib/libcfitsio.5.dylib" $file + done +done # ====================== # @@ -239,6 +293,20 @@ pkgbuild --identifier cta.irap.omp.eu.ctools.pkg \ $PKGDIR/$CTOOLS.pkg +# ======================= # +# Clean package directory # +# ======================= # +rm -rf $INSTALLDIR + + +# ============================== # +# Recover installation directory # +# ============================== # +if [ -d "$INSTALLDIR.backup" ]; then + mv $INSTALLDIR.backup $INSTALLDIR +fi + + # ====================== # # Build Mac OS X product # # ====================== # diff --git a/dev/pkgcheck-macosx.sh b/dev/pkgcheck-macosx.sh index 81ff37c..6d8029d 100755 --- a/dev/pkgcheck-macosx.sh +++ b/dev/pkgcheck-macosx.sh @@ -1,4 +1,4 @@ -#!/bin/bash -f +#!/bin/bash # ========================================================================== # ctools Mac OS X package validation # @@ -32,72 +32,65 @@ VERSION=$1 # =============================== # # Set software component versions # # =============================== # -#CFITSIO=cfitsio3410 -#NCURSES=ncurses-6.0 -#READLINE=readline-7.0 -#GAMMALIB=gammalib-$VERSION CTOOLS=ctools-$VERSION # ============== # # Set parameters # # ============== # +INSTALLDIR=/usr/local/gamma WRKDIR=$PWD/pkg_check PKGDIR=$PWD/pkg_build +DMGFILE=$PKGDIR/$CTOOLS-macosx10.7.dmg +LOGFILE=$PWD/pkg_check.log -#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 +# ============================= # +# Secure installation directory # +# ============================= # +if [ -d "$INSTALLDIR" ]; then + mv $INSTALLDIR $INSTALLDIR.backup +fi # ====================== # # Clean package creation # # ====================== # -umount $WRKDIR -rm -rf $WRKDIR +#umount $WRKDIR +#rm -rf $WRKDIR # ============================= # # Create package directory tree # # ============================= # -mkdir -p $WRKDIR +#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 +#DEVICE=$(hdiutil attach ram://1000000 -nomount) +#diskutil erasevolume HFS+ 'ctools-test' $DEVICE +#umount -f /Volumes/ctools-test +#sudo diskutil enableOwnership $DEVICE +#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 +sudo installer -pkg /Volumes/$CTOOLS/$CTOOLS.pkg -target / hdiutil detach /Volumes/$CTOOLS # ================= # # Configure package # # ================= # -env -export GAMMALIB=$WRKDIR/usr/local/gamma +export GAMMALIB=$INSTALLDIR source $GAMMALIB/bin/gammalib-init.sh -export CTOOLS=$WRKDIR/usr/local/gamma +export CTOOLS=$INSTALLDIR source $CTOOLS/bin/ctools-init.sh -echo -echo -env # ============ # @@ -105,6 +98,21 @@ env # ============ # python -c 'import gammalib; gammalib.test()' python -c 'import ctools; ctools.test()' +python -c 'import cscripts; cscripts.test()' + + +# ======================= # +# Clean package directory # +# ======================= # +#rm -rf $INSTALLDIR + + +# ============================== # +# Recover installation directory # +# ============================== # +#if [ -d "$INSTALLDIR.backup" ]; then +# mv $INSTALLDIR.backup $INSTALLDIR +#fi # =============== # diff --git a/src/ctools-setup.in b/src/ctools-setup.in index 235e3d6..6341bb6 100644 --- a/src/ctools-setup.in +++ b/src/ctools-setup.in @@ -26,23 +26,23 @@ fi # # Set parameters # ============== -#prefix="@prefix@" -#exec_prefix="@exec_prefix@" -#ctools_bin="@bindir@" -#ctools_lib="@libdir@" -#python_dir="@pythondir@" -#python_exec_dir="@pyexecdir@" -#pkgconfig_dir="@libdir@/pkgconfig" -#man_dir="@datadir@/doc/ctools/man" -#caldb_dir="@datadir@/caldb" -prefix="$CTOOLS" -ctools_bin="$CTOOLS/bin" -ctools_lib="$CTOOLS/lib" +prefix="@prefix@" +exec_prefix="@exec_prefix@" +ctools_bin="@bindir@" +ctools_lib="@libdir@" python_dir="@pythondir@" python_exec_dir="@pyexecdir@" -pkgconfig_dir="$CTOOLS/lib/pkgconfig" -man_dir="$CTOOLS/share/doc/ctools/man" -caldb_dir="$CTOOLS/share/caldb" +pkgconfig_dir="@libdir@/pkgconfig" +man_dir="@datadir@/doc/ctools/man" +caldb_dir="@datadir@/caldb" +#prefix="$CTOOLS" +#ctools_bin="$CTOOLS/bin" +#ctools_lib="$CTOOLS/lib" +#python_dir="@pythondir@" +#python_exec_dir="@pyexecdir@" +#pkgconfig_dir="$CTOOLS/lib/pkgconfig" +#man_dir="$CTOOLS/share/doc/ctools/man" +#caldb_dir="$CTOOLS/share/caldb" uname_system=`uname` # -- libgit2 0.21.4