Skip to content

Commit 1dc22be

Browse files
author
Casper Boon
committed
one more go at sonoma
1 parent 42ff5d2 commit 1dc22be

File tree

1 file changed

+11
-17
lines changed

1 file changed

+11
-17
lines changed

macos/macpkg.sh

Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,14 @@ MOSNAME=`echo ${MOSLINE} | awk -F 'macOS ' '{print $NF}' | tr -d '\\' | tr ' '
1010

1111
HOMEBREW=$1
1212

13+
EXTRPTH="local"
1314
if [ "$HOMEBREW" = "true" ] ; then
1415
# It's HOMEBREW
1516
if [ `uname -m` = "x86_64" ] ; then
1617
BASEDIR=usr
1718
else
1819
BASEDIR=/opt/homebrew
20+
EXTRPTH="opt"
1921
fi
2022
else
2123
BASEDIR=opt
@@ -64,18 +66,18 @@ fi
6466
echo "BASEDIR is ${BASEDIR}" 1>&2
6567
find_libs () {
6668
echo "*** find_libs \"$1\" \"$2\"" 1>&2
67-
otool --help
68-
otool -L ${PKG}.app/Contents/MacOS/$2
69+
otool -L ${PKG}.app/Contents/MacOS/$2 | grep \/${BASEDIR}\/
6970
L2=`otool -L ${PKG}.app/Contents/MacOS/$2 | grep \/${BASEDIR}\/$1 | cut -d\ -f1 | grep -o '[^/]*$'`
71+
echo $L2
7072
LIST=""
7173
while [ "$L2" != "$LIST" ] ; do
7274
LIST=$L2
7375
for i in $LIST ; do
7476
xx=`find \/${BASEDIR} -name $i 2> /dev/null | tail -n 1`
75-
#echo "Looking for \"$i\" ($xx)" 1>&2
77+
echo "Looking for \"$i\" ($xx)" 1>&2
7678
if [ ! -f ${PKG}.app/Contents/MacOS/$i ] ; then
7779
if [ "$xx" = "" ] ; then
78-
/bin/cp -f /${BASEDIR}/local/lib/$i ${PKG}.app/Contents/MacOS
80+
/bin/cp -f /${BASEDIR}/${EXTRPTH}/lib/$i ${PKG}.app/Contents/MacOS
7981
else
8082
/bin/cp -f $xx ${PKG}.app/Contents/MacOS
8183
fi
@@ -104,7 +106,7 @@ find_libs () {
104106
}
105107

106108

107-
LIBS1=`find_libs local ${PKG}`
109+
LIBS1=`find_libs ${EXTRPTH} ${PKG}`
108110
#LIBS2=`find_libs intel ${PKG}`
109111

110112
if [ "$FC" = "ifort" ] ; then
@@ -115,15 +117,7 @@ if [ "$FC" = "ifort" ] ; then
115117
LIBS2="${LIBS2} libifport.dylib"
116118
fi
117119
else
118-
if [ "$HOMEBREW" = "true" ] ; then
119-
if [ `uname -m` = "x86_64" ] ; then
120-
PATH2=/${BASEDIR}/local/
121-
else
122-
PATH2=/${BASEDIR}/opt/
123-
fi
124-
else
125-
PATH2=/${BASEDIR}/local/
126-
fi
120+
PATH2=/${BASEDIR}/${EXTRPTH}/
127121
PATH3=/usr/local/
128122
LIBS2="libgfortran.5.dylib"
129123
fi
@@ -137,7 +131,7 @@ echo "LIBS2 = $LIBS2"
137131
for i in $LIBS1 ; do
138132
echo "*** Configuring : $i ***"
139133
xx=`find /${BASEDIR} -name $i 2> /dev/null | tail -n 1`
140-
#cp /${BASEDIR}/local/lib/$i ${PKG}.app/Contents/MacOS
134+
#cp /${BASEDIR}/${EXTRPTH}/lib/$i ${PKG}.app/Contents/MacOS
141135
if [ ! -f ${PKG}.app/Contents/MacOS/$i ] ; then
142136
143137
/bin/cp -f $xx ${PKG}.app/Contents/MacOS
@@ -148,12 +142,12 @@ for i in $LIBS1 ; do
148142
chmod +w ${PKG}.app/Contents/MacOS/$i
149143
fi
150144
install_name_tool -id $i ${PKG}.app/Contents/MacOS/$i
151-
#install_name_tool -change /${BASEDIR}/local/lib/$i '@executable_path/'$i ${PKG}.app/Contents/MacOS/${PKG}
145+
#install_name_tool -change /${BASEDIR}/${EXTRPTH}/lib/$i '@executable_path/'$i ${PKG}.app/Contents/MacOS/${PKG}
152146
install_name_tool -change $xx '@executable_path/'$i ${PKG}.app/Contents/MacOS/${PKG}
153147
#echo '****' install_name_tool -change $xx '@executable_path/'$i ${PKG}.app/Contents/MacOS/${PKG}
154148
if [ "${BASEDIR}" = "usr" ] ; then
155149
# This is probably a HOMEBREW setup, so there might be references into the Cellar
156-
NLST=`otool -L ${PKG}.app/Contents/MacOS/$i | grep \/${BASEDIR}\/local/Cellar | cut -d\ -f1`
150+
NLST=`otool -L ${PKG}.app/Contents/MacOS/$i | grep \/${BASEDIR}\/${EXTRPTH}/Cellar | cut -d\ -f1`
157151
for j in $NLST ; do
158152
k=`echo $j | grep -o '[^/]*$'`
159153
install_name_tool -change $j '@executable_path/'$k ${PKG}.app/Contents/MacOS/$i

0 commit comments

Comments
 (0)