Skip to content

Commit 5cebeab

Browse files
[MERGE #1392 @digitalinfinity] Merge linux branch into master
Merge pull request #1392 from digitalinfinity:linux
2 parents d71347c + 8aad2a5 commit 5cebeab

28 files changed

+452
-172
lines changed

CMakeLists.txt

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,26 @@ function(clr_unknown_arch)
1010
endif()
1111
endfunction()
1212

13+
if(ICU_INCLUDE_PATH)
14+
set(ICU_CC_PATH "${ICU_INCLUDE_PATH}/../lib/")
15+
find_library(ICUUC icuuc PATHS ${ICU_CC_PATH} NO_DEFAULT_PATH)
16+
find_library(ICU18 icui18n PATHS ${ICU_CC_PATH} NO_DEFAULT_PATH)
17+
find_library(ICUDATA icudata PATHS ${ICU_CC_PATH} NO_DEFAULT_PATH)
18+
if(ICUUC)
19+
message("found libraries on ${ICU_CC_PATH}")
20+
set(ICULIB
21+
${ICUUC}
22+
${ICU18}
23+
${ICUDATA}
24+
)
25+
endif()
26+
endif()
27+
1328
if(CMAKE_SYSTEM_NAME STREQUAL Linux)
29+
if(NOT ICULIB)
30+
set(ICULIB "icuuc")
31+
endif()
32+
1433
set(CLR_CMAKE_PLATFORM_UNIX 1)
1534
if(CMAKE_SYSTEM_PROCESSOR STREQUAL x86_64)
1635
set(CLR_CMAKE_PLATFORM_UNIX_TARGET_AMD64 1)
@@ -21,9 +40,16 @@ if(CMAKE_SYSTEM_NAME STREQUAL Linux)
2140
elseif(CMAKE_SYSTEM_NAME STREQUAL Darwin)
2241
add_definitions(
2342
-DPLATFORM_UNIX
24-
-DU_DISABLE_RENAMING=1 #in case we link against to an older binary of icu
2543
)
2644

45+
if(NOT ICULIB)
46+
set(ICULIB "icucore")
47+
add_definitions(
48+
-DU_DISABLE_RENAMING=1 #in case we link against to an older binary of icu
49+
)
50+
message("using ICU from system default: ${ICULIB}")
51+
endif()
52+
2753
set(CLR_CMAKE_PLATFORM_UNIX 1)
2854
if(CMAKE_SYSTEM_PROCESSOR STREQUAL x86_64)
2955
set(CLR_CMAKE_PLATFORM_UNIX_TARGET_AMD64 1)
@@ -193,6 +219,12 @@ include_directories(
193219
${ICU_INCLUDE_PATH}
194220
)
195221

222+
if(ICU_INCLUDE_PATH)
223+
if(NOT HAVE_LIBICU_UCHAR_H)
224+
set(HAVE_LIBICU_UCHAR_H "1")
225+
endif()
226+
endif()
227+
196228
add_subdirectory (pal)
197229

198230
# build the rest with NO_PAL_MINMAX and PAL_STDCPP_COMPAT

bin/ChakraCore/CMakeLists.txt

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ add_library (ChakraCore SHARED
33
ConfigParserExternals.cpp
44
TestHooks.cpp
55
)
6-
6+
77
target_include_directories (
88
ChakraCore PUBLIC
99
${CMAKE_CURRENT_SOURCE_DIR}
@@ -45,18 +45,9 @@ set(lib_target "${lib_target}"
4545
pthread
4646
stdc++
4747
dl
48+
${ICULIB}
4849
)
4950

50-
if(CMAKE_SYSTEM_NAME STREQUAL Linux)
51-
set(lib_target "${lib_target}"
52-
icuuc
53-
)
54-
elseif(CMAKE_SYSTEM_NAME STREQUAL Darwin)
55-
set(lib_target "${lib_target}"
56-
icucore
57-
)
58-
endif() # Linux ?
59-
6051
if(CMAKE_SYSTEM_NAME STREQUAL Linux)
6152
set(lib_target "${lib_target}"
6253
-Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/libChakraCoreLib.version
@@ -72,7 +63,7 @@ if(NOT CC_XCODE_PROJECT)
7263
if(CMAKE_SYSTEM_NAME STREQUAL Darwin)
7364
set(CC_LIB_EXT "dylib")
7465
endif()
75-
66+
7667
add_custom_command(TARGET ChakraCore POST_BUILD
7768
COMMAND ${CMAKE_COMMAND} -E copy_if_different
7869
"${CHAKRACORE_BINARY_DIR}/bin/ChakraCore/libChakraCore.${CC_LIB_EXT}"

bin/NativeTests/NativeTests.vcxproj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
$(ChakraCoreRootDirectory)bin\External;
2828
%(AdditionalIncludeDirectories)
2929
</AdditionalIncludeDirectories>
30-
<RuntimeLibrary Condition="'$(Configuration)'=='Debug'">MultiThreadedDebugDLL</RuntimeLibrary>
3130
<MultiProcessorCompilation>true</MultiProcessorCompilation>
3231
<SmallerTypeCheck>false</SmallerTypeCheck>
3332
<MinimalRebuild>false</MinimalRebuild>

bin/ch/CMakeLists.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
set(ch_source_files
1+
set(ch_source_files
22
ch.cpp
33
ChakraRtInterface.cpp
44
CodexAssert.cpp
@@ -59,12 +59,12 @@ if(STATIC_LIBRARY)
5959

6060
if(CMAKE_SYSTEM_NAME STREQUAL Linux)
6161
set(lib_target "${lib_target}"
62-
icuuc
62+
${ICULIB}
6363
unwind-x86_64
6464
)
6565
elseif(CMAKE_SYSTEM_NAME STREQUAL Darwin)
6666
set(lib_target "${lib_target}"
67-
icucore
67+
${ICULIB}
6868
"-framework CoreFoundation"
6969
"-framework Security"
7070
)
@@ -78,7 +78,7 @@ else() # // !from shared library
7878
endif()
7979

8080
if(CMAKE_SYSTEM_NAME STREQUAL Linux)
81-
set(lib_target "${lib_target}"
81+
set(lib_target "${lib_target}"
8282
-Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/ch.version
8383
)
8484
endif()

bin/ch/ch.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -310,6 +310,12 @@ HRESULT RunScript(const char* fileName, LPCSTR fileContents, BYTE *bcBuffer, cha
310310
}
311311

312312
runScript = ChakraRTInterface::JsTTDRunScript(-1, fileContents, WScriptJsrt::GetNextSourceContext(), fullPath, nullptr /*result*/);
313+
314+
if (runScript == JsErrorCategoryUsage)
315+
{
316+
wprintf(_u("FATAL ERROR: Core was compiled without ENABLE_TTD is defined. CH is trying to use TTD interface\n"));
317+
abort();
318+
}
313319
#else
314320
runScript = ChakraRTInterface::JsRunScriptUtf8(fileContents, WScriptJsrt::GetNextSourceContext(), fullPath, nullptr /*result*/);
315321
#endif

bin/ch/stdafx.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323

2424
#define WIN32_LEAN_AND_MEAN 1
2525

26-
#define ENABLE_TEST_HOOKS 1
2726
#include "CommonDefines.h"
2827
#include <map>
2928
#include <string>
@@ -137,6 +136,9 @@ do { \
137136
} \
138137
} while (0)
139138

139+
#ifndef ENABLE_TEST_HOOKS
140+
#define ENABLE_TEST_HOOKS
141+
#endif
140142
#include "TestHooks.h"
141143
#include "ChakraRtInterface.h"
142144
#include "HostConfigFlags.h"

build.sh

Lines changed: 50 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
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=""
5355
ICU_PATH=""
5456
STATIC_LIBRARY=""
5557
WITHOUT_FEATURES=""
58+
CREATE_DEB=0
5659

5760
while [[ $# -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
;;
@@ -228,6 +236,34 @@ fi
228236

229237
if [[ $_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 <[email protected]>"\
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
231267
fi
232268

233269
popd > /dev/null

jenkins/get_system_info.sh

Lines changed: 40 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,55 @@
33
# Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
44
#-------------------------------------------------------------------------------------------------------
55

6+
if [[ $# -eq 0 ]]; then
7+
echo "No platform passed in- assuming Linux"
8+
_PLATFORM="linux"
9+
fi
10+
11+
while [[ $# -gt 0 ]]; do
12+
case "$1" in
13+
--linux)
14+
_PLATFORM="linux"
15+
;;
16+
--osx)
17+
_PLATFORM="osx"
18+
;;
19+
esac
20+
21+
shift
22+
done
23+
624
echo
725
echo "=================================================="
826
echo
927

10-
echo "Number of processors (nproc):"
11-
echo
12-
nproc
28+
if [[ $_PLATFORM =~ "linux" ]]; then
29+
echo "Number of processors (nproc):"
30+
echo
31+
nproc
32+
elif [[ $_PLATFORM =~ "osx" ]]; then
33+
echo "Number of processors (sysctl -n hw.logicalcpu):"
34+
echo
35+
sysctl -n hw.logicalcpu
36+
else
37+
echo "Unknown platform"
38+
exit 1
39+
fi
1340

1441
echo
1542
echo "--------------------------------------------------"
1643
echo
1744

18-
echo "Linux version (lsb_release -a):"
19-
echo
20-
lsb_release -a
45+
if [[ $_PLATFORM =~ "linux" ]]; then
46+
echo "Linux version (lsb_release -a):"
47+
echo
48+
lsb_release -a
49+
elif [[ $_PLATFORM =~ "osx" ]]; then
50+
echo "OS X version (sw_vers -productVersion):"
51+
echo
52+
sw_vers -productVersion
53+
fi
54+
2155

2256
echo
2357
echo "--------------------------------------------------"

lib/Common/ChakraCoreVersion.h

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
//-------------------------------------------------------------------------------------------------------
2+
// Copyright (C) Microsoft. All rights reserved.
3+
// Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
4+
//-------------------------------------------------------------------------------------------------------
5+
#pragma once
6+
7+
#define CHAKRA_CORE_MAJOR_VERSION 1
8+
#define CHAKRA_CORE_MINOR_VERSION 2
9+
#define CHAKRA_CORE_VERSION_RELEASE 0
10+
#define CHAKRA_CORE_VERSION_PRERELEASE 0
11+
#define CHAKRA_CORE_VERSION_RELEASE_QFE 0
12+
13+
#define CHAKRA_VERSION_RELEASE 0
14+
15+
// NOTE: need to update the GUID in ByteCodeCacheReleaseFileVersion.h as well

lib/Common/CommonDefines.h

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,7 @@
66

77
#include "TargetVer.h"
88
#include "Warnings.h"
9-
10-
//----------------------------------------------------------------------------------------------------
11-
// Chakra Core version
12-
//----------------------------------------------------------------------------------------------------
13-
#define CHAKRA_CORE_MAJOR_VERSION 1
14-
#define CHAKRA_CORE_MINOR_VERSION 2
15-
#define CHAKRA_CORE_VERSION_RELEASE 0
16-
#define CHAKRA_CORE_VERSION_PRERELEASE 0
17-
#define CHAKRA_CORE_VERSION_RELEASE_QFE 0
18-
19-
#define CHAKRA_VERSION_RELEASE 0
20-
21-
// NOTE: need to update the GUID in ByteCodeCacheReleaseFileVersion.h as well
9+
#include "ChakraCoreVersion.h"
2210

2311
//----------------------------------------------------------------------------------------------------
2412
// Default debug/fretest/release flags values

0 commit comments

Comments
 (0)