Skip to content

Commit e448704

Browse files
committed
[MERGE #1294 @obastemur] cross platform: add deb package creation support
Merge pull request #1294 from obastemur:deb_package
2 parents 9465f16 + a7bff6d commit e448704

File tree

1 file changed

+49
-14
lines changed

1 file changed

+49
-14
lines changed

build.sh

Lines changed: 49 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -20,20 +20,21 @@ PRINT_USAGE() {
2020
echo "build.sh [options]"
2121
echo ""
2222
echo "options:"
23-
echo " --cxx=PATH Path to Clang++ (see example below)"
24-
echo " --cc=PATH Path to Clang (see example below)"
25-
echo " -d, --debug Debug build (by default Release build)"
26-
echo " -h, --help Show help"
27-
echo " --icu=PATH Path to ICU include folder (see example below)"
28-
echo " -j [N], --jobs[=N] Multicore build, allow N jobs at once"
29-
echo " -n, --ninja Build with ninja instead of make"
30-
echo " --xcode Generate XCode project"
31-
echo " -t, --test-build Test build (by default Release build)"
32-
echo " --static Build as static library (by default shared library)"
33-
echo " -v, --verbose Display verbose output including all options"
23+
echo " --cxx=PATH Path to Clang++ (see example below)"
24+
echo " --cc=PATH Path to Clang (see example below)"
25+
echo " -d, --debug Debug build (by default Release build)"
26+
echo " -h, --help Show help"
27+
echo " --icu=PATH Path to ICU include folder (see example below)"
28+
echo " -j [N], --jobs[=N] Multicore build, allow N jobs at once"
29+
echo " -n, --ninja Build with ninja instead of make"
30+
echo " --xcode Generate XCode project"
31+
echo " -t, --test-build Test build (by default Release build)"
32+
echo " --static Build as static library (by default shared library)"
33+
echo " -v, --verbose Display verbose output including all options"
34+
echo " --create-deb=V Create .deb package with given V version"
3435
echo " --without=FEATURE,FEATURE,..."
35-
echo " Disable FEATUREs from JSRT experimental"
36-
echo " features."
36+
echo " Disable FEATUREs from JSRT experimental"
37+
echo " features."
3738
echo ""
3839
echo "example:"
3940
echo " ./build.sh --cxx=/path/to/clang++ --cc=/path/to/clang -j"
@@ -53,6 +54,7 @@ MULTICORE_BUILD=""
5354
ICU_PATH=""
5455
STATIC_LIBRARY=""
5556
WITHOUT_FEATURES=""
57+
CREATE_DEB=0
5658

5759
while [[ $# -gt 0 ]]; do
5860
case "$1" in
@@ -111,11 +113,16 @@ while [[ $# -gt 0 ]]; do
111113
MAKE=ninja
112114
;;
113115

114-
--xcode)
116+
--xcode)
115117
CMAKE_GEN="-G Xcode -DCC_XCODE_PROJECT=1"
116118
MAKE=0
117119
;;
118120

121+
--create-deb=*)
122+
CREATE_DEB=$1
123+
CREATE_DEB="${CREATE_DEB:13}"
124+
;;
125+
119126
--static)
120127
STATIC_LIBRARY="-DSTATIC_LIBRARY=1"
121128
;;
@@ -228,6 +235,34 @@ fi
228235

229236
if [[ $_RET != 0 ]]; then
230237
echo "See error details above. Exit code was $_RET"
238+
else
239+
if [[ $CREATE_DEB != 0 ]]; then
240+
DEB_FOLDER=`realpath .`
241+
DEB_FOLDER="${DEB_FOLDER}/chakracore_${CREATE_DEB}"
242+
243+
mkdir -p $DEB_FOLDER/usr/local/bin
244+
mkdir -p $DEB_FOLDER/DEBIAN
245+
cp $DEB_FOLDER/../ch $DEB_FOLDER/usr/local/bin/
246+
if [[ $STATIC_LIBRARY == "" ]]; then
247+
cp $DEB_FOLDER/../*.so $DEB_FOLDER/usr/local/bin/
248+
fi
249+
echo -e "Package: ChakraCore"\
250+
"\nVersion: ${CREATE_DEB}"\
251+
"\nSection: base"\
252+
"\nPriority: optional"\
253+
"\nArchitecture: amd64"\
254+
"\nDepends: libc6 (>= 2.19), uuid-dev (>> 0), libunwind-dev (>> 0), libicu-dev (>> 0)"\
255+
"\nMaintainer: ChakraCore <[email protected]>"\
256+
"\nDescription: Chakra Core"\
257+
"\n Open source Core of Chakra Javascript Engine"\
258+
> $DEB_FOLDER/DEBIAN/control
259+
260+
dpkg-deb --build $DEB_FOLDER
261+
_RET=$?
262+
if [[ $_RET == 0 ]]; then
263+
echo ".deb package is available under $build_directory"
264+
fi
265+
fi
231266
fi
232267

233268
popd > /dev/null

0 commit comments

Comments
 (0)