forked from mccode-dev/McCode
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild_macos_mcstas
More file actions
executable file
·118 lines (102 loc) · 5.03 KB
/
build_macos_mcstas
File metadata and controls
executable file
·118 lines (102 loc) · 5.03 KB
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
114
115
#!/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
git submodule init
git submodule update
# This is an app bundle being built, relocatable.
export MCINSTALL_PREFIX=/Applications/McStas-$1.app/
./mkdist mcstas-app $1 support/MacOSX/McCode.app/ "" mac "" -- OSXapp
# For the actual mcstas part, the packages need a 'deep' PREFIX
export MCINSTALL_PREFIX=/Applications/McStas-$1.app/Contents/Resources/
# 64-bit Mac OS
./mkdist mcstas $1 "" "" mac "" -- OSXapp
./mkdist mcstas-comps $1 "" "" mac "" -- OSXapp
./mkdist mcstas-tools-perl $1 tools/Legacy-Perl/ "" mac "" -- OSXapp
./mkdist mcstas-tools-perl-cmdline $1 tools/Legacy-Perl-cmdline/ "" mac "" -- OSXapp
./mkdist mcstas-tools-matlab-mcplot $1 tools/matlab/mcplot/ "" mac "" -- OSXapp
./mkdist mcstas-tools-python-mcplot-pyqtgraph $1 tools/Python/mcplot/pyqtgraph/ "" mac "" -- OSXapp
./mkdist mcstas-tools-python-mcplot-matplotlib $1 tools/Python/mcplot/matplotlib/ "" mac "" -- OSXapp
./mkdist mcstas-tools-python-mcplot-svg $1 tools/Python/mcplot/svg/ "" mac "" -- OSXapp
./mkdist mcstas-tools-python-mcrun $1 tools/Python/mcrun/ "" mac "" -- OSXapp
./mkdist mcstas-tools-python-mcresplot $1 tools/Python/mcresplot/ "" mac "" -- OSXapp
./mkdist mcstas-tools-python-mcgui $1 tools/Python/mcgui/ "" mac "" -- OSXapp
./mkdist mcstas-tools-python-mccodelib $1 tools/Python/mccodelib/ "" mac "" -- OSXapp
./mkdist mcstas-tools-python-mcdisplay-webgl $1 tools/Python/mcdisplay/webgl/ "" mac "" -- OSXapp
./mkdist mcstas-tools-python-mcdisplay-pyqtgraph $1 tools/Python/mcdisplay/pyqtgraph/ "" mac "" -- OSXapp
./mkdist mcstas-tools-python-mcdisplay-matplotlib $1 tools/Python/mcdisplay/matplotlib/ "" mac "" -- OSXapp
./mkdist mcstas-tools-python-mcdisplay-mantid $1 tools/Python/mcdisplay/mantid_xml/ "" mac "" -- OSXapp
./mkdist mcstas-tools-python-mcdoc $1 tools/Python/mcdoc/ "" mac "" -- OSXapp
./mkdist mcstas-clusterscripts $1 tools/cluster-scripts/ "" mac "" -- OSXapp
./mkdist mcstas-manuals $1 docpkg/manuals/mcstas/ "" mac "" -- OSXapp
WORK=`pwd`
# NCrystal installation:
rm -rf 3rdparty-build/ncrystal/build
mkdir 3rdparty-build/ncrystal/build
cd 3rdparty-build/ncrystal/build
cmake .. -DCMAKE_INSTALL_PREFIX=/Applications/McStas-$1.app/Contents/Resources/mcstas/$1/ncrystal/ -DBUILD_G4HOOKS=OFF
make
make install
cd $WORK
rm -rf 3rdparty-build/ncrystal/build
if [ ! -f Miniconda3-latest-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-latest-MacOSX-x86_64.sh
fi
echo "*********************************************************"
echo "* Embedding miniconda3 in your app *"
echo "*********************************************************"
chmod a+x Miniconda3-latest-MacOSX-x86_64.sh
./Miniconda3-latest-MacOSX-x86_64.sh -b -p $MCINSTALL_PREFIX/mcstas/$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/mcstas/$1/miniconda3/bin:$PATH
$MCINSTALL_PREFIX/mcstas/$1/miniconda3/bin/conda install openmpi gsl matplotlib -y
$MCINSTALL_PREFIX/mcstas/$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/mcstas/$1/bin
# - Nasty local macOS hacks:
# (1) ensure pymcpltool is run with pythonw binary
sed -i.orig s/python/pythonw/ $MCINSTALL_PREFIX/mcstas/$1/bin/pymcpltool
rm $MCINSTALL_PREFIX/mcstas/$1/bin/pymcpltool.orig
# (2) same type of hack for mcgui seems to remove focusing-issue
sed -i.orig s/python3/pythonw/ $MCINSTALL_PREFIX/mcstas/$1/bin/mcgui
rm $MCINSTALL_PREFIX/mcstas/$1/bin/mcgui.orig
export MCINSTALL_PREFIX=/Applications/McStas-$1.app/Contents/Resources/
cd $WORK
# Generate mcdoc pages
$MCINSTALL_PREFIX/mcstas/$1/miniconda3/bin/python $MCINSTALL_PREFIX/mcstas/$1/tools/Python/mcdoc/mcdoc.py -i
mkdir -p dist
# Move the App bundle back to the dist - or keep it in /Applications?
if [ "x$2" = "x" ]; then
mv /Applications/McStas-$1.app dist
ln -s /Applications dist/
cd dist
ln -s McStas-$1.app/Contents/Resources/mcstas/$1/environment McStas-$1-environment.command
cd ..
cp support/MacOSX/Check-dependencies/* dist
mv dist mcstas-$1
mkdir dist
tar cfz dist/mcstas-$1.tgz mcstas-$1
cp INSTALL-McStas/macOS/README.md dist
echo A tgz of your app is now located in the dist folder
rm -rf mcstas-$1
else
ln -s /Applications/McStas-$1.app dist/
echo Your app is now located in /Applications \(link available in the dist folder\)
fi