forked from McStasMcXtrace/McCode
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build_macos_mcxtrace
executable file
·114 lines (100 loc) · 4.86 KB
/
build_macos_mcxtrace
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
#!/bin/sh
if [ "x$1" = "x" ]; then
# No arguments
echo Please provide one argument,e.g : $0 2.0
exit 1;
fi
# Ensure our 3rd party modules are in place and updated
THIRDPARTY=`echo mcpl`
cd 3rdparty
echo $THIRDPARTY | xargs -n1 rm -r
cd -
git submodule init
git submodule update --recursive --remote --recursive --remote
for MODULE in `echo $THIRDPARTY`
do
if [ -d "3rdparty/patches/${MODULE}" ]; then
echo Making McCode cmake modules available for $MODULE
rsync -avz cmake/ 3rdparty/${MODULE}/cmake
echo Applying McCode patches to 3rdparty/${MODULE}
cp -rp 3rdparty/patches/${MODULE}/* 3rdparty/${MODULE}/
fi
done
# This is an app bundle being built, but non-relocatable.
export MCINSTALL_PREFIX=/Applications/McXtrace-$1.app/
./mkdist mcxtrace-app $1 support/MacOSX/McCode.app/ "" mac "" -- OSXapp
# For the actual mcxtrace part, the packages need a 'deep' PREFIX
export MCINSTALL_PREFIX=/Applications/McXtrace-$1.app/Contents/Resources/
# 64-bit Mac OS
./mkdist mcxtrace $1 "" "" mac "" -- OSXapp
./mkdist mcxtrace-comps $1 "" "" mac "" -- OSXapp
./mkdist mcxtrace-tools-perl $1 tools/Legacy-Perl/ "" mac "" -- OSXapp
./mkdist mcxtrace-tools-perl-cmdline $1 tools/Legacy-Perl-cmdline/ "" mac "" -- OSXapp
./mkdist mcxtrace-tools-matlab-mxplot $1 tools/matlab/mcplot/ "" mac "" -- OSXapp
./mkdist mcxtrace-tools-python-mxplot-pyqtgraph $1 tools/Python/mcplot/pyqtgraph/ "" mac "" -- OSXapp
./mkdist mcxtrace-tools-python-mxplot-matplotlib $1 tools/Python/mcplot/matplotlib/ "" mac "" -- OSXapp
./mkdist mcxtrace-tools-python-mxplot-svg $1 tools/Python/mcplot/svg/ "" mac "" -- OSXapp
./mkdist mcxtrace-tools-python-mxrun $1 tools/Python/mcrun/ "" mac "" -- OSXapp
./mkdist mcxtrace-tools-python-mxgui $1 tools/Python/mcgui/ "" mac "" -- OSXapp
./mkdist mcxtrace-tools-python-mccodelib $1 tools/Python/mccodelib/ "" mac "" -- OSXapp
./mkdist mcxtrace-tools-python-mxdisplay-webgl $1 tools/Python/mcdisplay/webgl/ "" mac "" -- OSXapp
./mkdist mcxtrace-tools-python-mxdisplay-pyqtgraph $1 tools/Python/mcdisplay/pyqtgraph/ "" mac "" -- OSXapp
./mkdist mcxtrace-tools-python-mxdisplay-matplotlib $1 tools/Python/mcdisplay/matplotlib/ "" mac "" -- OSXapp
./mkdist mcxtrace-tools-python-mxdoc $1 tools/Python/mcdoc/ "" mac "" -- OSXapp
./mkdist mcxtrace-clusterscripts $1 tools/cluster-scripts/ "" mac "" -- OSXapp
./mkdist mcxtrace-manuals $1 docpkg/manuals/mcxtrace/ "" mac "" -- OSXapp
WORK=`pwd`
cd $WORK
if [ ! -f Miniconda3-py38_4.10.3-MacOSX-x86_64.sh ]; then
# Download and embed a miniconda
echo
echo "*********************************************************"
echo "* Downloading a miniconda3 for your app *"
echo "*********************************************************"
echo
sleep 3
curl -O https://repo.anaconda.com/miniconda/Miniconda3-py38_4.10.3-MacOSX-x86_64.sh
fi
echo "*********************************************************"
echo "* Embedding miniconda3 in your app *"
echo "*********************************************************"
chmod a+x Miniconda3-py38_4.10.3-MacOSX-x86_64.sh
./Miniconda3-py38_4.10.3-MacOSX-x86_64.sh -b -p $MCINSTALL_PREFIX/mcxtrace/$1/miniconda3/
# Run conda to install the dependencies
echo
echo "*********************************************************"
echo "* Downloading python dependencies to embedded miniconda *"
echo "*********************************************************"
echo
export PATHBAK=$PATH
export PATH=$MCINSTALL_PREFIX/mcxtrace/$1/miniconda3/bin:$PATH
$MCINSTALL_PREFIX/mcxtrace/$1/miniconda3/bin/conda install openmpi gsl matplotlib nomkl -y
$MCINSTALL_PREFIX/mcxtrace/$1/miniconda3/bin/pip install PyQt5 Qscintilla pyqtgraph pyaml ply numpy scipy pillow tornado jinja2 mpld3
export PATH=$PATHBAK
# Copy in the mpicc snippets
cp support/MacOSX/mpicc-wrappers/* $MCINSTALL_PREFIX/mcxtrace/$1/bin
export MCINSTALL_PREFIX=/Applications/McXtrace-$1.app/Contents/Resources/
cd $WORK
# Generate mcdoc pages
$MCINSTALL_PREFIX/mcxtrace/$1/miniconda3/bin/python $MCINSTALL_PREFIX/mcxtrace/$1/tools/Python/mxdoc/mcdoc.py -i
# Hack to make openmpi from the conda env available on Big Sur
ln -s $MCINSTALL_PREFIX/mcxtrace/$1/miniconda3/bin/mpi* $MCINSTALL_PREFIX/mcxtrace/$1/bin/
mkdir -p dist
# Move the App bundle back to the dist - or keep it in /Applications?
if [ "x$2" = "x" ]; then
mv /Applications/McXtrace-$1.app dist
ln -s /Applications dist/
cd dist
ln -s McXtrace-$1.app/Contents/Resources/mcxtrace/$1/environment McXtrace-$1-environment.command
cd ..
cp support/MacOSX/Check-dependencies/* dist
mv dist mcxtrace-$1
mkdir dist
tar cfz dist/mcxtrace-$1_x86_64.tgz mcxtrace-$1
cp INSTALL-McStas-2.x/macOS/README.md dist
echo A tgz of your app is now located in the dist folder
rm -rf mcxtrace-$1
else
ln -s /Applications/McXtrace-$1.app dist/
echo Your app is now located in /Applications \(link available in the dist folder\)
fi