Commit 0862c211c7a6e7136fe11a9fd85628e6dde6ccd8

Authored by Jürgen Knödlseder
1 parent 32b2c065

Revert from using $GAMMALIB in setup script (#1929)

cscripts/Makefile.am
1 1 #############################################################################
2 2 # Makefile for cscripts scripts #
3 3 # ------------------------------------------------------------------------- #
4   -# Copyright (C) 2016 Juergen Knoedlseder #
  4 +# Copyright (C) 2016-2017 Juergen Knoedlseder #
5 5 # ------------------------------------------------------------------------- #
6 6 # #
7 7 # This program is free software: you can redistribute it and/or modify #
... ...
dev/pkgbuild-macosx.sh
1   -#!/bin/bash -f
  1 +#!/bin/bash
2 2 # ==========================================================================
3 3 # ctools Mac OS X package creation
4 4 #
... ... @@ -17,6 +17,14 @@
17 17 # You should have received a copy of the GNU General Public License
18 18 # along with this program. If not, see <http://www.gnu.org/licenses/>.
19 19 #
  20 +# -------------------------------------------------------------------------
  21 +#
  22 +# This script installs the ctools and GammaLib packages in the location
  23 +# /usr/local/gamma and then builds a Mac OS X package which is finally put
  24 +# onto a disk image. Any existing content in /usr/local/gamma will be
  25 +# destroyed. The script needs the priviledges to create a folder in
  26 +# /usr/local.
  27 +#
20 28 # ==========================================================================
21 29  
22 30 # ============================================= #
... ... @@ -33,8 +41,8 @@ VERSION=$1
33 41 # Set software component versions #
34 42 # =============================== #
35 43 CFITSIO=cfitsio3410
36   -NCURSES=ncurses-6.0
37   -READLINE=readline-7.0
  44 +NCURSES=ncurses-5.9
  45 +READLINE=readline-6.3
38 46 GAMMALIB=gammalib-$VERSION
39 47 CTOOLS=ctools-$VERSION
40 48  
... ... @@ -42,23 +50,33 @@ CTOOLS=ctools-$VERSION
42 50 # ============== #
43 51 # Set parameters #
44 52 # ============== #
  53 +INSTALLDIR=/usr/local/gamma
45 54 WRKDIR=$PWD/pkg_build
46   -INSTALLDIR=$WRKDIR/install
47 55 SRCDIR=$WRKDIR/src
48 56 PKGDIR=$WRKDIR/pkg
49 57 PRODDIR=$WRKDIR/prod
50 58 PLISTFILE=$PKGDIR/$CTOOLS-components.plist
51 59 DISTFILE=$PRODDIR/$CTOOLS.dist
52 60 DMGFILE=$WRKDIR/$CTOOLS-macosx10.7.dmg
  61 +LOGFILE=$PWD/pkg_build.log
53 62  
54 63  
55   -# ====================== #
56   -# Clean package creation #
57   -# ====================== #
  64 +# ============================= #
  65 +# Secure installation directory #
  66 +# ============================= #
  67 +if [ -d "$INSTALLDIR" ]; then
  68 + mv $INSTALLDIR $INSTALLDIR.backup
  69 +fi
  70 +
  71 +
  72 +# ======================= #
  73 +# Clean package directory #
  74 +# ======================= #
58 75 rm -rf $INSTALLDIR
59 76 rm -rf $PKGDIR
60 77 rm -rf $PRODDIR
61 78 rm -rf $DMGFILE
  79 +rm -rf $LOGFILE
62 80  
63 81  
64 82 # ============================= #
... ... @@ -69,10 +87,6 @@ mkdir -p $PKGDIR
69 87 mkdir -p $PRODDIR
70 88  
71 89  
72   -# Make sure that wget is installed
73   -# TODO: If not installed, execute "brew install wget"
74   -
75   -
76 90 # =============== #
77 91 # Install ncurses #
78 92 # =============== #
... ... @@ -87,9 +101,9 @@ if [ ! -d &quot;$NCURSES&quot; ]; then
87 101 fi
88 102 fi
89 103 cd $NCURSES
90   -./configure --prefix=$INSTALLDIR --with-shared
91   -make
92   -make install
  104 +./configure --prefix=$INSTALLDIR --with-shared | tee -a $LOGFILE
  105 +make -j4 | tee -a $LOGFILE
  106 +make install | tee -a $LOGFILE
93 107  
94 108  
95 109 # ================ #
... ... @@ -106,9 +120,9 @@ if [ ! -d &quot;$READLINE&quot; ]; then
106 120 fi
107 121 fi
108 122 cd $READLINE
109   -./configure --prefix=$INSTALLDIR
110   -make
111   -make install
  123 +./configure --prefix=$INSTALLDIR | tee -a $LOGFILE
  124 +make -j4 | tee -a $LOGFILE
  125 +make install | tee -a $LOGFILE
112 126  
113 127  
114 128 # =============== #
... ... @@ -125,9 +139,9 @@ if [ ! -d &quot;cfitsio&quot; ]; then
125 139 fi
126 140 fi
127 141 cd cfitsio
128   -./configure --prefix=$INSTALLDIR
129   -make shared
130   -make install
  142 +./configure --prefix=$INSTALLDIR | tee -a $LOGFILE
  143 +make -j4 shared | tee -a $LOGFILE
  144 +make install | tee -a $LOGFILE
131 145  
132 146  
133 147 # ================ #
... ... @@ -178,9 +192,9 @@ if [ -d &quot;.git&quot; ]; then
178 192 ./autogen.sh
179 193 fi
180 194 # Build code
181   -./configure --prefix=$INSTALLDIR
182   -make
183   -make install
  195 +./configure --prefix=$INSTALLDIR | tee -a $LOGFILE
  196 +make -j4 | tee -a $LOGFILE
  197 +make install | tee -a $LOGFILE
184 198  
185 199  
186 200 # ============== #
... ... @@ -222,9 +236,49 @@ if [ -d &quot;.git&quot; ]; then
222 236 ./autogen.sh
223 237 fi
224 238 # Build code
225   -./configure --prefix=$INSTALLDIR
226   -make
227   -make install
  239 +./configure --prefix=$INSTALLDIR | tee $LOGFILE
  240 +make -j4 | tee $LOGFILE
  241 +make install | tee $LOGFILE
  242 +
  243 +
  244 +# ================= #
  245 +# Post-process code #
  246 +# ================= #
  247 +# Change links in libraries
  248 +for file in ${INSTALLDIR}/lib/*.dylib
  249 +do
  250 + echo $file | tee -a $LOGFILE
  251 + install_name_tool -change "@rpath/libcfitsio.5.dylib" "$INSTALLDIR/lib/libcfitsio.5.dylib" $file
  252 +done
  253 +
  254 +# Change links in binaries
  255 +for file in ${INSTALLDIR}/bin/ct*
  256 +do
  257 + echo $file | tee -a $LOGFILE
  258 + install_name_tool -change "@rpath/libcfitsio.5.dylib" "$INSTALLDIR/lib/libcfitsio.5.dylib" $file
  259 +done
  260 +
  261 +# Change links in Python modules
  262 +pythons="python2.7"
  263 +for python in $pythons
  264 +do
  265 + # Print Python version
  266 + echo $python | tee -a $LOGFILE
  267 +
  268 + # Change links in gammalib modules
  269 + for file in ${INSTALLDIR}/lib/$python/site-packages/gammalib/_*.so
  270 + do
  271 + echo $file | tee -a $LOGFILE
  272 + install_name_tool -change "@rpath/libcfitsio.5.dylib" "$INSTALLDIR/lib/libcfitsio.5.dylib" $file
  273 + done
  274 +
  275 + # Change links in ctools modules
  276 + for file in ${INSTALLDIR}/lib/$python/site-packages/ctools/_*.so
  277 + do
  278 + echo $file | tee -a $LOGFILE
  279 + install_name_tool -change "@rpath/libcfitsio.5.dylib" "$INSTALLDIR/lib/libcfitsio.5.dylib" $file
  280 + done
  281 +done
228 282  
229 283  
230 284 # ====================== #
... ... @@ -239,6 +293,20 @@ pkgbuild --identifier cta.irap.omp.eu.ctools.pkg \
239 293 $PKGDIR/$CTOOLS.pkg
240 294  
241 295  
  296 +# ======================= #
  297 +# Clean package directory #
  298 +# ======================= #
  299 +rm -rf $INSTALLDIR
  300 +
  301 +
  302 +# ============================== #
  303 +# Recover installation directory #
  304 +# ============================== #
  305 +if [ -d "$INSTALLDIR.backup" ]; then
  306 + mv $INSTALLDIR.backup $INSTALLDIR
  307 +fi
  308 +
  309 +
242 310 # ====================== #
243 311 # Build Mac OS X product #
244 312 # ====================== #
... ...
dev/pkgcheck-macosx.sh
1   -#!/bin/bash -f
  1 +#!/bin/bash
2 2 # ==========================================================================
3 3 # ctools Mac OS X package validation
4 4 #
... ... @@ -32,72 +32,65 @@ VERSION=$1
32 32 # =============================== #
33 33 # Set software component versions #
34 34 # =============================== #
35   -#CFITSIO=cfitsio3410
36   -#NCURSES=ncurses-6.0
37   -#READLINE=readline-7.0
38   -#GAMMALIB=gammalib-$VERSION
39 35 CTOOLS=ctools-$VERSION
40 36  
41 37  
42 38 # ============== #
43 39 # Set parameters #
44 40 # ============== #
  41 +INSTALLDIR=/usr/local/gamma
45 42 WRKDIR=$PWD/pkg_check
46 43 PKGDIR=$PWD/pkg_build
  44 +DMGFILE=$PKGDIR/$CTOOLS-macosx10.7.dmg
  45 +LOGFILE=$PWD/pkg_check.log
47 46  
48 47  
49   -#INSTALLDIR=$WRKDIR/install
50   -#SRCDIR=$WRKDIR/src
51   -#PKGDIR=$WRKDIR/pkg
52   -#PRODDIR=$WRKDIR/prod
53   -#PLISTFILE=$PKGDIR/$CTOOLS-components.plist
54   -#DISTFILE=$PRODDIR/$CTOOLS.dist
55   -DMGFILE=$PKGDIR/$CTOOLS-macosx10.7.dmg
  48 +# ============================= #
  49 +# Secure installation directory #
  50 +# ============================= #
  51 +if [ -d "$INSTALLDIR" ]; then
  52 + mv $INSTALLDIR $INSTALLDIR.backup
  53 +fi
56 54  
57 55  
58 56 # ====================== #
59 57 # Clean package creation #
60 58 # ====================== #
61   -umount $WRKDIR
62   -rm -rf $WRKDIR
  59 +#umount $WRKDIR
  60 +#rm -rf $WRKDIR
63 61  
64 62  
65 63 # ============================= #
66 64 # Create package directory tree #
67 65 # ============================= #
68   -mkdir -p $WRKDIR
  66 +#mkdir -p $WRKDIR
69 67  
70 68  
71 69 # ================================= #
72 70 # Create Mac OS X RAM disk (488 MB) #
73 71 # ================================= #
74   -DEVICE=$(hdiutil attach ram://1000000 -nomount)
75   -diskutil erasevolume HFS+ 'ctools-test' $DEVICE
76   -umount -f /Volumes/ctools-test
77   -#sudo diskutil enableOwnership $DEVICE # You must be root for this command
78   -mount -t hfs $DEVICE $WRKDIR
  72 +#DEVICE=$(hdiutil attach ram://1000000 -nomount)
  73 +#diskutil erasevolume HFS+ 'ctools-test' $DEVICE
  74 +#umount -f /Volumes/ctools-test
  75 +#sudo diskutil enableOwnership $DEVICE
  76 +#mount -t hfs $DEVICE $WRKDIR
79 77  
80 78  
81 79 # =============== #
82 80 # Install package #
83 81 # =============== #
84   -echo $DMGFILE
85 82 hdiutil attach $DMGFILE
86   -sudo installer -pkg /Volumes/$CTOOLS/$CTOOLS.pkg -target $WRKDIR # You must be root for this command
  83 +sudo installer -pkg /Volumes/$CTOOLS/$CTOOLS.pkg -target /
87 84 hdiutil detach /Volumes/$CTOOLS
88 85  
89 86  
90 87 # ================= #
91 88 # Configure package #
92 89 # ================= #
93   -env
94   -export GAMMALIB=$WRKDIR/usr/local/gamma
  90 +export GAMMALIB=$INSTALLDIR
95 91 source $GAMMALIB/bin/gammalib-init.sh
96   -export CTOOLS=$WRKDIR/usr/local/gamma
  92 +export CTOOLS=$INSTALLDIR
97 93 source $CTOOLS/bin/ctools-init.sh
98   -echo
99   -echo
100   -env
101 94  
102 95  
103 96 # ============ #
... ... @@ -105,6 +98,21 @@ env
105 98 # ============ #
106 99 python -c 'import gammalib; gammalib.test()'
107 100 python -c 'import ctools; ctools.test()'
  101 +python -c 'import cscripts; cscripts.test()'
  102 +
  103 +
  104 +# ======================= #
  105 +# Clean package directory #
  106 +# ======================= #
  107 +#rm -rf $INSTALLDIR
  108 +
  109 +
  110 +# ============================== #
  111 +# Recover installation directory #
  112 +# ============================== #
  113 +#if [ -d "$INSTALLDIR.backup" ]; then
  114 +# mv $INSTALLDIR.backup $INSTALLDIR
  115 +#fi
108 116  
109 117  
110 118 # =============== #
... ...
src/ctools-setup.in
... ... @@ -26,23 +26,23 @@ fi
26 26 #
27 27 # Set parameters
28 28 # ==============
29   -#prefix="@prefix@"
30   -#exec_prefix="@exec_prefix@"
31   -#ctools_bin="@bindir@"
32   -#ctools_lib="@libdir@"
33   -#python_dir="@pythondir@"
34   -#python_exec_dir="@pyexecdir@"
35   -#pkgconfig_dir="@libdir@/pkgconfig"
36   -#man_dir="@datadir@/doc/ctools/man"
37   -#caldb_dir="@datadir@/caldb"
38   -prefix="$CTOOLS"
39   -ctools_bin="$CTOOLS/bin"
40   -ctools_lib="$CTOOLS/lib"
  29 +prefix="@prefix@"
  30 +exec_prefix="@exec_prefix@"
  31 +ctools_bin="@bindir@"
  32 +ctools_lib="@libdir@"
41 33 python_dir="@pythondir@"
42 34 python_exec_dir="@pyexecdir@"
43   -pkgconfig_dir="$CTOOLS/lib/pkgconfig"
44   -man_dir="$CTOOLS/share/doc/ctools/man"
45   -caldb_dir="$CTOOLS/share/caldb"
  35 +pkgconfig_dir="@libdir@/pkgconfig"
  36 +man_dir="@datadir@/doc/ctools/man"
  37 +caldb_dir="@datadir@/caldb"
  38 +#prefix="$CTOOLS"
  39 +#ctools_bin="$CTOOLS/bin"
  40 +#ctools_lib="$CTOOLS/lib"
  41 +#python_dir="@pythondir@"
  42 +#python_exec_dir="@pyexecdir@"
  43 +#pkgconfig_dir="$CTOOLS/lib/pkgconfig"
  44 +#man_dir="$CTOOLS/share/doc/ctools/man"
  45 +#caldb_dir="$CTOOLS/share/caldb"
46 46 uname_system=`uname`
47 47  
48 48 #
... ...