Commit 89679dc5bd3053f6c4cf1352c6048556994e418e

Authored by Jürgen Knödlseder
1 parent d28edb0b

Modify Mac OS X package build script so that code get's cloned from GitLab if no source files exist

.gitignore
@@ -95,3 +95,4 @@ examples/*.fits @@ -95,3 +95,4 @@ examples/*.fits
95 examples/*.xml 95 examples/*.xml
96 examples/*.dat 96 examples/*.dat
97 examples/ctools 97 examples/ctools
  98 +pkgbuild
dev/pkgbuild-macosx.sh
@@ -42,7 +42,7 @@ CTOOLS=ctools-$VERSION @@ -42,7 +42,7 @@ CTOOLS=ctools-$VERSION
42 # ============== # 42 # ============== #
43 # Set parameters # 43 # Set parameters #
44 # ============== # 44 # ============== #
45 -WRKDIR=$PWD/osxpackage 45 +WRKDIR=$PWD/pkgbuild
46 INSTALLDIR=$WRKDIR/install 46 INSTALLDIR=$WRKDIR/install
47 SRCDIR=$WRKDIR/src 47 SRCDIR=$WRKDIR/src
48 PKGDIR=$WRKDIR/pkg 48 PKGDIR=$WRKDIR/pkg
@@ -79,7 +79,12 @@ mkdir -p $PRODDIR @@ -79,7 +79,12 @@ mkdir -p $PRODDIR
79 cd $SRCDIR 79 cd $SRCDIR
80 if [ ! -d "$NCURSES" ]; then 80 if [ ! -d "$NCURSES" ]; then
81 wget https://ftp.gnu.org/pub/gnu/ncurses/$NCURSES.tar.gz 81 wget https://ftp.gnu.org/pub/gnu/ncurses/$NCURSES.tar.gz
82 - tar xvfz $NCURSES.tar.gz 82 + if [ "$?" -ne "0" ]; then
  83 + echo "*** Unable to download $NCURSES.tar.gz"
  84 + exit 1
  85 + else
  86 + tar xvfz $NCURSES.tar.gz
  87 + fi
83 fi 88 fi
84 cd $NCURSES 89 cd $NCURSES
85 ./configure --prefix=$INSTALLDIR --with-shared 90 ./configure --prefix=$INSTALLDIR --with-shared
@@ -92,8 +97,13 @@ make install @@ -92,8 +97,13 @@ make install
92 # ================ # 97 # ================ #
93 cd $SRCDIR 98 cd $SRCDIR
94 if [ ! -d "$READLINE" ]; then 99 if [ ! -d "$READLINE" ]; then
95 - wget https://ftp.gnu.org/pub/gnu/readline/$READLINE.tar.gz  
96 - tar xvfz $READLINE.tar.gz 100 + wget https://ftp.gnu.org/pub/gnu/readline/$READLINE.tar.gz
  101 + if [ "$?" -ne "0" ]; then
  102 + echo "*** Unable to download $READLINE.tar.gz"
  103 + exit 1
  104 + else
  105 + tar xvfz $READLINE.tar.gz
  106 + fi
97 fi 107 fi
98 cd $READLINE 108 cd $READLINE
99 ./configure --prefix=$INSTALLDIR 109 ./configure --prefix=$INSTALLDIR
@@ -107,7 +117,12 @@ make install @@ -107,7 +117,12 @@ make install
107 cd $SRCDIR 117 cd $SRCDIR
108 if [ ! -d "cfitsio" ]; then 118 if [ ! -d "cfitsio" ]; then
109 wget http://heasarc.gsfc.nasa.gov/FTP/software/fitsio/c/$CFITSIO.tar.gz 119 wget http://heasarc.gsfc.nasa.gov/FTP/software/fitsio/c/$CFITSIO.tar.gz
110 - tar xvfz $CFITSIO.tar.gz 120 + if [ "$?" -ne "0" ]; then
  121 + echo "*** Unable to download $CFITSIO.tar.gz"
  122 + exit 1
  123 + else
  124 + tar xvfz $CFITSIO.tar.gz
  125 + fi
111 fi 126 fi
112 cd cfitsio 127 cd cfitsio
113 ./configure --prefix=$INSTALLDIR 128 ./configure --prefix=$INSTALLDIR
@@ -121,9 +136,48 @@ make install @@ -121,9 +136,48 @@ make install
121 cd $SRCDIR 136 cd $SRCDIR
122 if [ ! -d "$GAMMALIB" ]; then 137 if [ ! -d "$GAMMALIB" ]; then
123 wget http://cta.irap.omp.eu/ctools/releases/gammalib/$GAMMALIB.tar.gz 138 wget http://cta.irap.omp.eu/ctools/releases/gammalib/$GAMMALIB.tar.gz
124 - tar xvfz $GAMMALIB.tar.gz 139 + if [ "$?" -ne "0" ]; then
  140 + if [ ! -d "gammalib" ]; then
  141 + echo "*** Unable to download $GAMMALIB.tar.gz, try cloning from GitLab"
  142 + export GIT_SSL_NO_VERIFY=true
  143 + git clone https://cta-gitlab.irap.omp.eu/gammalib/gammalib.git
  144 + if [ "$?" -ne "0" ]; then
  145 + echo "*** Unable to clone GammaLib from GitLab"
  146 + exit 1
  147 + fi
  148 + else
  149 + echo "*** Unable to download $GAMMALIB.tar.gz, use code in gammalib directory"
  150 + fi
  151 + cd gammalib
  152 + else
  153 + tar xvfz $GAMMALIB.tar.gz
  154 + cd $GAMMALIB
  155 + fi
125 fi 156 fi
126 -cd $GAMMALIB 157 +# If we got code from GitLab, then try using release branch, and if not
  158 +# available, use devel branch.
  159 +USE_BRANCH=
  160 +if [ -d ".git" ]; then
  161 + git fetch
  162 + git checkout release
  163 + if [ "$?" -ne "0" ]; then
  164 + echo "*** No release branch found on GitLab, try devel branch"
  165 + git checkout devel
  166 + if [ "$?" -ne "0" ]; then
  167 + echo "*** No devel branch found on GitLab"
  168 + exit 1
  169 + else
  170 + echo "*** Use devel branch of GammaLib"
  171 + USE_BRANCH=devel
  172 + fi
  173 + else
  174 + echo "*** Use release branch of GammaLib"
  175 + USE_BRANCH=release
  176 + fi
  177 + git pull
  178 + ./autogen.sh
  179 +fi
  180 +# Build code
127 ./configure --prefix=$INSTALLDIR 181 ./configure --prefix=$INSTALLDIR
128 make 182 make
129 make install 183 make install
@@ -133,11 +187,41 @@ make install @@ -133,11 +187,41 @@ make install
133 # Install ctools # 187 # Install ctools #
134 # ============== # 188 # ============== #
135 cd $SRCDIR 189 cd $SRCDIR
  190 +CTOOLS_DIR=$CTOOLS
136 if [ ! -d "$CTOOLS" ]; then 191 if [ ! -d "$CTOOLS" ]; then
137 wget http://cta.irap.omp.eu/ctools/releases/ctools/$CTOOLS.tar.gz 192 wget http://cta.irap.omp.eu/ctools/releases/ctools/$CTOOLS.tar.gz
138 - tar xvfz $CTOOLS.tar.gz 193 + if [ "$?" -ne "0" ]; then
  194 + if [ ! -d "ctools" ]; then
  195 + echo "*** Unable to download $CTOOLS.tar.gz, try cloning from GitLab"
  196 + export GIT_SSL_NO_VERIFY=true
  197 + git clone https://cta-gitlab.irap.omp.eu/ctools/ctools.git
  198 + if [ "$?" -ne "0" ]; then
  199 + echo "*** Unable to clone ctools from GitLab"
  200 + exit 1
  201 + fi
  202 + else
  203 + echo "*** Unable to download $CTOOLS.tar.gz, use code in ctools directory"
  204 + fi
  205 + cd ctools
  206 + CTOOLS_DIR=ctools
  207 + else
  208 + tar xvfz $CTOOLS.tar.gz
  209 + cd $CTOOLS
  210 + fi
  211 +fi
  212 +# If we got code from GitLab, then use the same branch that was used for
  213 +# GammaLib
  214 +if [ -d ".git" ]; then
  215 + git fetch
  216 + git checkout $USE_BRANCH
  217 + if [ "$?" -ne "0" ]; then
  218 + echo "*** No $USE_BRANCH branch found on GitLab"
  219 + exit 1
  220 + fi
  221 + git pull
  222 + ./autogen.sh
139 fi 223 fi
140 -cd $CTOOLS 224 +# Build code
141 ./configure --prefix=$INSTALLDIR 225 ./configure --prefix=$INSTALLDIR
142 make 226 make
143 make install 227 make install
@@ -179,7 +263,7 @@ productbuild --distribution $DISTFILE \ @@ -179,7 +263,7 @@ productbuild --distribution $DISTFILE \
179 $PRODDIR/$CTOOLS.pkg 263 $PRODDIR/$CTOOLS.pkg
180 264
181 # Add additional files to production folder 265 # Add additional files to production folder
182 -cp $SRCDIR/$CTOOLS/COPYING $PRODDIR/License.txt 266 +cp $SRCDIR/$CTOOLS_DIR/COPYING $PRODDIR/License.txt
183 267
184 # Add ReadMe 268 # Add ReadMe
185 /bin/cat <<EOM >$PRODDIR/ReadMe.txt 269 /bin/cat <<EOM >$PRODDIR/ReadMe.txt