-
Notifications
You must be signed in to change notification settings - Fork 59
/
create_bundle.sh
87 lines (74 loc) · 2.48 KB
/
create_bundle.sh
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
# assume we have a working conda available
export MAMBA_NO_BANNER=1
conda_env="APP/FreeCAD.app/Contents/Resources"
mamba create -y --copy -c freecad/label/dev -c conda-forge -p ${conda_env} \
python=3.11 \
freecad=*.pre \
blas=*=openblas \
blinker \
calculix \
docutils \
ifcopenshell \
jinja2 \
lark \
lxml \
matplotlib-base \
nine \
numpy \
occt \
olefile \
opencamlib \
opencv \
pandas \
pycollada \
pyyaml \
requests \
scipy \
six \
sympy \
vtk \
xlutils
# delete unnecessary stuff
rm -rf ${conda_env}/include
find ${conda_env} -name \*.a -delete
mv ${conda_env}/bin ${conda_env}/bin_tmp
mkdir ${conda_env}/bin
cp ${conda_env}/bin_tmp/freecad ${conda_env}/bin/
cp ${conda_env}/bin_tmp/freecadcmd ${conda_env}/bin
cp ${conda_env}/bin_tmp/ccx ${conda_env}/bin/
cp ${conda_env}/bin_tmp/python ${conda_env}/bin/
cp ${conda_env}/bin_tmp/pip ${conda_env}/bin/
cp ${conda_env}/bin_tmp/pyside2-rcc ${conda_env}/bin/
cp ${conda_env}/bin_tmp/gmsh ${conda_env}/bin/
cp ${conda_env}/bin_tmp/dot ${conda_env}/bin/
cp ${conda_env}/bin_tmp/unflatten ${conda_env}/bin/
sed -i "" '1s|.*|#!/usr/bin/env python|' ${conda_env}/bin/pip
rm -rf ${conda_env}/bin_tmp
#copy qt.conf
cp qt.conf ${conda_env}/bin/
cp qt.conf ${conda_env}/libexec/
# Remove __pycache__ folders and .pyc files
find . -path "*/__pycache__/*" -delete
find . -name "*.pyc" -type f -delete
# fix problematic rpaths and reexport_dylibs for signing
# see https://github.com/FreeCAD/FreeCAD/issues/10144#issuecomment-1836686775
# and https://github.com/FreeCAD/FreeCAD-Bundle/pull/203
mamba run -p ${conda_env} python ../scripts/fix_macos_lib_paths.py ${conda_env}/lib
# build and install the launcher
cmake -B build launcher
cmake --build build
cp build/FreeCAD APP/FreeCAD.app/Contents/MacOS/FreeCAD
mamba run -p ${conda_env} python ../scripts/get_freecad_version.py
read -r version_name < bundle_name.txt
echo -e "\################"
echo -e "version_name: ${version_name}"
echo -e "################"
mamba list -p ${conda_env} > APP/FreeCAD.app/Contents/packages.txt
sed -i "" "1s/.*/\nLIST OF PACKAGES:/" APP/FreeCAD.app/Contents/packages.txt
# copy the plugin into its final location
mv ${conda_env}/Library ${conda_env}/../Library
# create the dmg
pip3 install --break-system-packages "dmgbuild[badge_icons]>=1.6.0,<1.7.0"
dmgbuild -s dmg_settings.py "FreeCAD" "${version_name}.dmg"
# create hash
shasum -a 256 ${version_name}.dmg > ${version_name}.dmg-SHA256.txt