Here are the instructions used for building the 2021A REV1 MacOS build. They are a combination of the Jenkins nightly build instructions and the instructions at StarlinkRelease. The shell is assumed to be tcsh:

# Log into pc0054 as user jenkins (pw jenkins)
ssh -ljenkins -caes128-ctr pc0054

# Create a workspace directory and move into it. Ensure it is empty.
setenv WORK $HOME/2021A-REV1
mkdir -p $WORK
cd $WORK
rm -rf * 

# Following line needed because github has switched off the anonymous git protocol. 
# So need to use https instead of git when cloning submodules.
git config --global url."https://".insteadOf git://

# Clone the starlink repo and checkout the required branch and tag
git clone starlink
cd starlink
git checkout tags/2021A-REV1 -b 2021A

# We will install the built starlink into a suitably named subdirectory.
setenv STARLINK_DIR $WORK/star-2021A-REV1

# Ensure other environment variables are correct. Note, gcc and g++ on 
# pc0054 are links to clang. gfortran is part of GCC 11.2.
unsetenv STARLINK
unsetenv INSTALL
unsetenv CFLAGS
unsetenv CXXFLAGS
unsetenv FFLAGS
unsetenv DISPLAY
setenv LC_ALL C
setenv FC gfortran
setenv F77 gfortran
setenv CC gcc
setenv CXX g++
setenv PATH $STARLINK_DIR/bin/startcl\:$STARLINK_DIR/bin\:$STARLINK_DIR/buildsupport/bin\:$PATH
setenv PERL_CPANM_HOME $HOME/starcpanm

# Allow clang to build for all versions back to snow leopard
setenv LDFLAGS '-mmacosx-version-min=10.10'
setenv CFLAGS '-mmacosx-version-min=10.10 -g -O2'
setenv CXXFLAGS '-mmacosx-version-min=10.10'

#  bootstrap

# Remove symbolic link which can cause problems on MacOS if it still exists
rm -f $STARLINK_DIR/lib/iwidgets

# Configure
make configure-deps
./configure -C

# Remove more symbolic links which are troublesome on MacOS
rm -f $STARLINK_DIR/include/vtk

# Fix for libyaml?
setenv LIBRARY_PATH /usr/local/lib

#  make everything
make world
make componentset.html

# Fix up the build modules stuff?
install_name_tool -id $STARLINK_DIR/lib/libcfitsio.9.dylib  $STARLINK_DIR/lib/libcfitsio.9.dylib
install_name_tool -id $STARLINK_DIR/lib/libcfitsio.dylib  $STARLINK_DIR/lib/libcfitsio.dylib

# Build perl modules
cd thirdparty/perlsys/perlmods

# Post build fix up to ensure build is relocatable and doesn't require 
# DYLD_LIBRARY_PATH to be set.
cd ../../../

# Ensure all the libraries can be edited.
foreach i (`find $STARLINK_DIR/Perl/ -name '*.bundle' -type f`)
 chmod u+w $i

foreach i (`find $STARLINK_DIR/lib/ -name '*.dylib' -type f`)
 chmod u+w $i

# Copy required system libraries into STARLINK_DIR and fix up references to them. 
# Note the order of processing these libraries is important.
./ /usr/local/opt/gcc/lib/gcc/11/libgfortran.5.dylib
./ /usr/local/opt/gcc/lib/gcc/11/libquadmath.0.dylib
./ /usr/local/lib/gcc/11/libgcc_s.1.dylib
./ /usr/local/opt/jpeg/lib/libjpeg.9.dylib
./ /usr/local/opt/libyaml/lib/libyaml-0.2.dylib 

cp $STARLINK_DIR/lib/libcfitsio.9.dylib  $STARLINK_DIR/libcfitsio.9.dylib
./ $STARLINK_DIR/libcfitsio.9.dylib

#  libgfortran refers to libquadmath in Cellar (everything else refers to it in opt). 
#  So our copy of libgfortran will still use the wrong reference. Fix this now.
install_name_tool -change /usr/local/Cellar/gcc/11.2.0/lib/gcc/11/libquadmath.0.dylib \
      $STARLINK_DIR/lib/libquadmath.0.dylib $STARLINK_DIR/lib/libgfortran.5.dylib

# Now add rpaths for all libraries.

# Fix all CFITSIO stuff
setenv CFITSIOLIB "@rpath/libcfitsio.7.dylib"
setenv NEWCFITSIOLIB "@rpath/lib/libcfitsio.7.dylib"

foreach i (`find $STARLINK_DIR/bin -type file`)
   otool -L $i | grep -q $CFITSIOLIB
   if( $status == 0 ) then
      install_name_tool -change $CFITSIOLIB $NEWCFITSIOLIB $i

foreach i (`find $STARLINK_DIR/lib -type file -name '*.dylib'`)
   otool -L $i | grep -q $CFITSIOLIB
   if( $status == 0 ) then
      install_name_tool -change $CFITSIOLIB $NEWCFITSIOLIB $i

# Now need to remove the parts of the profile and login scripts that 
# set the DYLD_LIBRARY_PATH: profile: delete lines 115:197 inclusive 
# login; delete lines 94:192; Note, these numbers will obviously need
# to be changed if the contents of these files changes
sed -i.BAK '115,197d' $STARLINK_DIR/etc/profile 
sed -i.BAK '94,192d' $STARLINK_DIR/etc/login


This assumes that the above instructions have been executed:

cd $WORK

#  Identify the JDK 8 to be used.
setenv JAVA_HOME "`/usr/libexec/java_home -v 1.8`"
setenv STAR_JAVA $JAVA_HOME/bin/java
setenv PATH $JAVA_HOME/bin\:$PATH

#  Ensure the target install directory exists and is empty.
touch $STARLINK_DIR/starjava
rm -rf $STARLINK_DIR/starjava 
mkdir $STARLINK_DIR/starjava

# Clone the starjava repo and checkout the required branch and tag 
touch starjava-2021A-REV1
rm -rf starjava-2021A-REV1
git clone starjava-2021A-REV1
cd starjava-2021A-REV1
git checkout --track origin/2021A
git checkout tags/2021A-REV1

#  build and install the starlink version of ant
cd ant
setenv PATH `pwd`/bin\:$PATH
ant install -Dstar.dir=$STARLINK_DIR/starjava
ant clean
setenv PATH $STARLINK_DIR/starjava/bin\:$PATH
cd ..

# Adjust locale settings to avoid errors from special characters in the documentation
setenv LC_ALL en_US.UTF-8
setenv LANG en_US.UTF-8
setenv LANGUAGE en_US.UTF-8

# Allow access to the JAI classes (otherwise starjava will not build). JAI is not 
# actually included in the release though, so JSKY and SOG will not function.
setenv CLASSPATH /Users/jenkins/StarJavaOSXJAI/jai-1_1_3/lib/jai_codec.jar\:/Users/jenkins/StarJavaOSXJAI/jai-1_1_3/lib/jai_core.jar

# Build and install starjava
ant -Dstardev=$STARLINK_DIR -Dstar.dir=$STARLINK_DIR/starjava build
ant -Dstardev=$STARLINK_DIR -Dstar.dir=$STARLINK_DIR/starjava install

#  Now build the native JNI libraries
foreach lib (jniast jnihds splat)
   cd $lib
   ant -Dstardev=$STARLINK_DIR -Dstar.dir=$STARLINK_DIR/starjava build-native
   ant -Dstardev=$STARLINK_DIR -Dstar.dir=$STARLINK_DIR/starjava install
   ant -Dstardev=$STARLINK_DIR -Dstar.dir=$STARLINK_DIR/starjava test
   cd ..   
   install_name_tool -id @rpath/starjava/lib/x86_64/lib${lib}.jnilib \
   install_name_tool -add_rpath "@loader_path/../../../" $STARLINK_DIR/starjava/lib/x86_64/lib${lib}.jnilib

# Even though the version of AST in jniast is ancient, it still needs to link 
# with libyaml. This is because jniast only includes source files for the AST 
# classes it wraps. It picks up other required AST files (eg cminpack, etc) by 
# linking with the AST libraries in $STARLINK_DIR. These require libyaml, so 
# jniast also requires libyaml even though it does not expose any of the YamlChan
# class that uses libyaml.
install_name_tool -change \
  /usr/local/opt/libyaml/lib/libyaml-0.2.dylib \
  "@rpath/lib/libyaml-0.2.dylib" $STARLINK_DIR/starjava/lib/x86_64/libjniast.jnilib

install_name_tool -add_rpath "@loader_path/../../../lib/" \


cd $WORK

source $STARLINK_DIR/etc/login
source $STARLINK_DIR/etc/cshrc

touch oracdr
rm -rf oracdr

git clone oracdr

cd oracdr
git checkout 2021A

cd src/docs
make install

git clean -fdx

Tidying up

# Clean up unnecessary bits of document tree.
rm docs/*.htx/*.dvi
rm docs/*.htx/*.idv
rm docs/*.htx/*.log
rm docs/*.htx/*.lg
rm docs/*.htx/*.4ct
rm docs/*.htx/*.4tc
cd ..

#  Tar up the whole release and copy it to the FTP directory.
tar -czf starlink-2021A-OSX-REV1.tar.gz star-2021A-REV1
scp starlink-2021A-OSX-REV1.tar.gz \

Starlink: method used for building the 2021A-REV1 macOS build (last edited 2022-04-04 11:40:21 by DavidBerry)