-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrelease.sh
164 lines (142 loc) · 4.78 KB
/
release.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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
#!/bin/sh
# Scripts required to build the project are broken at the moment
#"D:/Software/JetBrains/CLion 2023.3.4/bin/cmake/win/x64/bin/cmake.exe" -DCMAKE_C_COMPILER="cl.exe" -DCMAKE_CXX_COMPILER="cl.exe" -DCMAKE_BUILD_TYPE=Release -S D:/chemical -B D:/chemical/out/build/x64-release --fresh
#"D:/Software/JetBrains/CLion 2023.3.4/bin/cmake/win/x64/bin/cmake.exe" --build D:/chemical/out/build/x64-release
# Assembling Release from already built package
version=v1.0.4
# Targets to build
linux_x86_64=true
windows_x64=true
linux_x86_64_tcc=true
windows_x64_tcc=true
# Command line parameter variables
zip_all_at_end=true
delete_dirs_at_end=true
# Loop through each command parameter
for param in "$@"; do
if [ "$param" = "--no-zip" ]; then
zip_all_at_end=false
elif [ "$param" = "--no-del-dirs" ]; then
delete_dirs_at_end=false
fi
done
# Create directory names
win64dirname=windows-x64-$version
lin64dirname=linux-x86-64-$version
Win64TccDirName=windows-x64-tcc-$version
Lin64TccDirName=linux-x86-64-tcc-$version
# Create directory paths
windows64dir=out/release/$win64dirname
linux64dir=out/release/$lin64dirname
Win64TccDir=out/release/$Win64TccDirName
Lin64TccDir=out/release/$Lin64TccDirName
# Make directories required for each target
if [ "$windows_x64" = true ]; then
mkdir -p $windows64dir/packages/tcc
mkdir $windows64dir/libs
fi
if [ "$linux_x86_64" = true ]; then
mkdir -p $linux64dir/packages/tcc
mkdir $linux64dir/libs
fi
if [ "$windows_x64_tcc" = true ]; then
mkdir -p $Win64TccDir/packages/tcc
mkdir $Win64TccDir/libs
fi
if [ "$linux_x86_64_tcc" = true ]; then
mkdir -p $Lin64TccDir/packages/tcc
mkdir $Lin64TccDir/libs
fi
# -------------------------- windows x64
if [ "$windows_x64" = true ]; then
# copy compiler
cp out/build/x64-release/Compiler.exe $windows64dir/chemical.exe
# copy lsp
cp out/build/x64-release/ChemicalLsp.exe $windows64dir/ChemicalLsp.exe
# copy resources
cp -r ./lib/include $windows64dir/resources
# copy tiny cc dll
cp lib/libtcc/win-x64/libtcc.dll $windows64dir/libtcc.dll
# copy the libs directory
cp -r lang/libs $windows64dir/libs/
# unzip the tinycc package
unzip lib/libtcc/win-x64/package.zip -d $windows64dir/packages/tcc
fi
# -------------------------- linux x86-64
if [ "$linux_x86_64" = true ]; then
# copy compiler
cp out/build/x64-release-wsl/Compiler $linux64dir/chemical
# copy lsp
cp out/build/x64-release-wsl/ChemicalLsp $linux64dir/ChemicalLsp
# copy resources
cp -r ./lib/include $linux64dir/resources
# copy tiny cc dll
cp lib/libtcc/lin-x64/libtcc.so $linux64dir/libtcc.so
# copy the libs directory
cp -r lang/libs $linux64dir/libs
# unzip the tinycc package
unzip lib/libtcc/lin-x64/package.zip -d $linux64dir/packages/tcc
fi
# -------------------------- windows x64 tcc
if [ "$windows_x64_tcc" = true ]; then
# copy tcc compiler
cp out/build/x64-release/TCCCompiler.exe $Win64TccDir/chemical.exe
# copy lsp
cp out/build/x64-release/ChemicalLsp.exe $Win64TccDir/ChemicalLsp.exe
# copy resources (tcc build doesn't need resources)
# cp -r ./lib/include $Win64TccDir/resources
# copy tiny cc dll
cp lib/libtcc/win-x64/libtcc.dll $Win64TccDir/libtcc.dll
# copy the libs directory
cp -r lang/libs $Win64TccDir/libs
# unzip the tinycc package
unzip lib/libtcc/win-x64/package.zip -d $Win64TccDir/packages/tcc
fi
# -------------------------- linux x86-64 tcc
if [ "$linux_x86_64_tcc" = true ]; then
# copy tcc compiler
cp out/build/x64-release-wsl/TCCCompiler $Lin64TccDir/chemical
# copy lsp
cp out/build/x64-release-wsl/ChemicalLsp $Lin64TccDir/ChemicalLsp
# copy resources (tcc build doesn't need resources)
# cp -r ./lib/include $Lin64TccDir/resources
# copy tiny cc dll
cp lib/libtcc/lin-x64/libtcc.so $Lin64TccDir/libtcc.so
# copy the libs directory
cp -r lang/libs $Lin64TccDir/libs
# unzip the tinycc package
unzip lib/libtcc/lin-x64/package.zip -d $Lin64TccDir/packages/tcc
fi
# ------------------------- done
if [ "$zip_all_at_end" = true ]; then
echo "Zipping all";
cd out/release || return
if [ "$windows_x64" = true ]; then
zip -r windows-x64.zip $win64dirname/*
fi
if [ "$linux_x86_64" = true ]; then
zip -r linux-x86-64.zip $lin64dirname/*
fi
if [ "$windows_x64_tcc" = true ]; then
zip -r windows-x64-tcc.zip $Win64TccDirName/*
fi
if [ "$linux_x86_64_tcc" = true ]; then
zip -r linux-x86-64-tcc.zip $Lin64TccDirName/*
fi
cd ../../
fi
if [ "$delete_dirs_at_end" = true ]; then
echo "Deleting Directories";
if [ "$windows_x64" = true ]; then
rm -rf $windows64dir
fi
if [ "$linux_x86_64" = true ]; then
rm -rf $linux64dir
fi
if [ "$windows_x64_tcc" = true ]; then
rm -rf $Win64TccDir
fi
if [ "$linux_x86_64_tcc" = true ]; then
rm -rf $Lin64TccDir
fi
fi