-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathmkzip.sh
107 lines (87 loc) · 1.95 KB
/
mkzip.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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
#!/bin/bash -e
syntax() {
echo "Create klayout-bits zip files"
echo ""
echo "Synopsis:"
echo " mkzip.sh <version> <build-dir>"
echo ""
echo "Example:"
echo " mkzip.sh 3.0 /c/jenkins/build-klayout-bits/INSTALL"
echo ""
echo "This script creates two zip files:"
echo " * klayout-bits-<version>.zip Full package"
echo " * klayout-microbits-<version>.zip Reduces package for building PyPI packages"
exit 0
}
version=
build=
for a in $*; do
case $a in
-h)
syntax
;;
-*)
echo "*** ERROR: unknown option $a"
exit 1
;;
*)
if [ "$version" = "" ]; then
version="$a"
elif [ "$build" = "" ]; then
build="$a"
else
echo "*** ERROR: too many arguments (see -h for details)"
exit 1
fi
esac
done
if [ "$version" = "" ]; then
echo "*** ERROR: missing version (see -h for details)"
exit 1
fi
if [ "$build" = "" ]; then
echo "*** ERROR: missing build directory (see -h for details)"
exit 1
fi
if ! [ -e $build ]; then
echo "*** ERROR: build path $build does not exist!"
exit 1
fi
build=$(realpath $build)
if ! [ -e "$build/msvc2017" ]; then
echo "*** ERROR: $build does not seem to be an installation directory for klayout-bit packages"
exit 1
fi
echo "Creating:"
echo " klayout-bits-$version.zip"
echo " klayout-microbits-$version.zip"
echo "from $build"
echo ""
out=$(pwd)
tmp=.tmp
rm -rf $tmp
mkdir $tmp
cd $tmp
dest=klayout-bits-$version
destm=klayout-microbits-$version
rm -rf $out/$dest.zip $out/$destm.zip
mkdir $dest
echo "Copying files ..."
cp -R $build/msvc* $dest
echo "Creating $dest.zip archive ..."
zip -r $out/$dest.zip $dest
mv $dest $destm
echo "Removing unused packages ..."
for rm in openssl ruby python; do
echo " Removing $rm"
rm -rf $destm/msvc*/*/$rm
done
echo "Creating $destm.zip archive ..."
zip -r $out/$destm.zip $destm
echo "Cleaning up ..."
rm -rf $destm
cd ..
echo "Created:"
echo " $dest.zip"
echo " $destm.zip"
echo "Done."