1+ #! /bin/bash
12# -------------------------------------------------------------------------------------------------------
23# Copyright (C) Microsoft. All rights reserved.
34# Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
@@ -20,20 +21,21 @@ PRINT_USAGE() {
2021 echo " build.sh [options]"
2122 echo " "
2223 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"
24+ echo " --cxx=PATH Path to Clang++ (see example below)"
25+ echo " --cc=PATH Path to Clang (see example below)"
26+ echo " -d, --debug Debug build (by default Release build)"
27+ echo " -h, --help Show help"
28+ echo " --icu=PATH Path to ICU include folder (see example below)"
29+ echo " -j [N], --jobs[=N] Multicore build, allow N jobs at once"
30+ echo " -n, --ninja Build with ninja instead of make"
31+ echo " --xcode Generate XCode project"
32+ echo " -t, --test-build Test build (by default Release build)"
33+ echo " --static Build as static library (by default shared library)"
34+ echo " -v, --verbose Display verbose output including all options"
35+ echo " --create-deb=V Create .deb package with given V version"
3436 echo " --without=FEATURE,FEATURE,..."
35- echo " Disable FEATUREs from JSRT experimental"
36- echo " features."
37+ echo " Disable FEATUREs from JSRT experimental"
38+ echo " features."
3739 echo " "
3840 echo " example:"
3941 echo " ./build.sh --cxx=/path/to/clang++ --cc=/path/to/clang -j"
@@ -53,6 +55,7 @@ MULTICORE_BUILD=""
5355ICU_PATH=" "
5456STATIC_LIBRARY=" "
5557WITHOUT_FEATURES=" "
58+ CREATE_DEB=0
5659
5760while [[ $# -gt 0 ]]; do
5861 case " $1 " in
@@ -111,11 +114,16 @@ while [[ $# -gt 0 ]]; do
111114 MAKE=ninja
112115 ;;
113116
114- --xcode)
117+ --xcode)
115118 CMAKE_GEN=" -G Xcode -DCC_XCODE_PROJECT=1"
116119 MAKE=0
117120 ;;
118121
122+ --create-deb=* )
123+ CREATE_DEB=$1
124+ CREATE_DEB=" ${CREATE_DEB: 13} "
125+ ;;
126+
119127 --static)
120128 STATIC_LIBRARY=" -DSTATIC_LIBRARY=1"
121129 ;;
228236
229237if [[ $_RET != 0 ]]; then
230238 echo " See error details above. Exit code was $_RET "
239+ else
240+ if [[ $CREATE_DEB != 0 ]]; then
241+ DEB_FOLDER=` realpath .`
242+ DEB_FOLDER=" ${DEB_FOLDER} /chakracore_${CREATE_DEB} "
243+
244+ mkdir -p $DEB_FOLDER /usr/local/bin
245+ mkdir -p $DEB_FOLDER /DEBIAN
246+ cp $DEB_FOLDER /../ch $DEB_FOLDER /usr/local/bin/
247+ if [[ $STATIC_LIBRARY == " " ]]; then
248+ cp $DEB_FOLDER /../* .so $DEB_FOLDER /usr/local/bin/
249+ fi
250+ echo -e " Package: ChakraCore" \
251+ " \nVersion: ${CREATE_DEB} " \
252+ " \nSection: base" \
253+ " \nPriority: optional" \
254+ " \nArchitecture: amd64" \
255+ " \nDepends: libc6 (>= 2.19), uuid-dev (>> 0), libunwind-dev (>> 0), libicu-dev (>> 0)" \
256+ " \nMaintainer: ChakraCore <chakracore@microsoft.com>" \
257+ " \nDescription: Chakra Core" \
258+ " \n Open source Core of Chakra Javascript Engine" \
259+ > $DEB_FOLDER /DEBIAN/control
260+
261+ dpkg-deb --build $DEB_FOLDER
262+ _RET=$?
263+ if [[ $_RET == 0 ]]; then
264+ echo " .deb package is available under $build_directory "
265+ fi
266+ fi
231267fi
232268
233269popd > /dev/null
0 commit comments