-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Surender Yadav <root@m4228022.lnxero1.boe>
- Loading branch information
Surender Yadav
committed
Jul 2, 2024
1 parent
17ea349
commit 67cdc8a
Showing
6 changed files
with
167 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
diff --git a/build.py b/build.py | ||
new file mode 100644 | ||
index 00000000..dab3606c | ||
--- /dev/null | ||
+++ b/build.py | ||
@@ -0,0 +1,49 @@ | ||
+#!/usr/bin/env python3 | ||
+ | ||
+import argparse | ||
+import os | ||
+import shutil | ||
+import subprocess | ||
+ | ||
+def main(): | ||
+ parser = argparse.ArgumentParser() | ||
+ parser.add_argument("--prefix") | ||
+ args = parser.parse_args() | ||
+ src_dir = os.path.dirname(os.path.realpath(__file__)) | ||
+ shutil.copytree(src_dir, os.path.basename(src_dir)) | ||
+ os.chdir(os.path.basename(src_dir)) | ||
+ | ||
+ os.environ["MACOSX_DEPLOYMENT_TARGET"] = "10.6" | ||
+ os.environ["DEFAULT_CC"] = os.environ.get("CC", "") | ||
+ os.environ["TARGET_CFLAGS"] = os.environ.get("CFLAGS", "") + " -fno-function-sections -fno-data-sections" | ||
+ os.environ["TARGET_LDFLAGS"] = os.environ.get("CFLAGS", "") + " -fno-function-sections -fno-data-sections" | ||
+ os.environ["CFLAGS"] = "" | ||
+ # LuaJIT compile process build a tool `buildvm` and use it, building `buildvm` with ASAN | ||
+ # will cause LSAN detect its leak and fail the build, set exitcode to 0 to make LSAN doesn't | ||
+ # fail on it. | ||
+ os.environ["LSAN_OPTIONS"] = "exitcode=0" | ||
+ | ||
+ if "ENVOY_MSAN" in os.environ: | ||
+ os.environ["HOST_CFLAGS"] = "-fno-sanitize=memory" | ||
+ os.environ["HOST_LDFLAGS"] = "-fno-sanitize=memory" | ||
+ | ||
+ arch = subprocess.check_output(["uname","-m"]).decode("utf-8").strip() | ||
+ compiler = os.environ.get("CC", "") | ||
+ if "clang" in compiler and arch in ["s390x","ppc64le"]: | ||
+ extra_clang_cflags = " -fgnuc-version=10 -fno-integrated-as -Wno-implicit-function-declaration -D_Float32=float -D_Float64=double -D_Float128=double -D_Float32x=double -D_Float64x=double" | ||
+ os.environ["TARGET_CFLAGS"] += extra_clang_cflags | ||
+ os.environ["TARGET_LDFLAGS"] += " -fgnuc-version=10" | ||
+ os.environ["HOST_CFLAGS"] = os.environ.get("HOST_CFLAGS", "") + extra_clang_cflags | ||
+ os.environ["HOST_LDFLAGS"] = os.environ.get("HOST_LDFLAGS", "") + " -fgnuc-version=10" | ||
+ | ||
+ # Remove LuaJIT from ASAN for now. | ||
+ # TODO(htuch): Remove this when https://github.com/envoyproxy/envoy/issues/6084 is resolved. | ||
+ if "ENVOY_CONFIG_ASAN" in os.environ or "ENVOY_CONFIG_MSAN" in os.environ: | ||
+ os.environ["TARGET_CFLAGS"] += " -fsanitize-blacklist=%s/com_github_luajit_luajit/clang-asan-blocklist.txt" % os.environ["PWD"] | ||
+ with open("clang-asan-blocklist.txt", "w") as f: | ||
+ f.write("fun:*\n") | ||
+ | ||
+ os.system('make -j{} V=1 PREFIX="{}" install'.format(os.cpu_count(), args.prefix)) | ||
+ | ||
+main() | ||
+ | ||
diff --git a/src/Makefile b/src/Makefile | ||
index acbe0ca7..313a7e44 100644 | ||
--- a/src/Makefile | ||
+++ b/src/Makefile | ||
@@ -27,7 +27,7 @@ NODOTABIVER= 51 | ||
DEFAULT_CC = gcc | ||
# | ||
# LuaJIT builds as a native 32 or 64 bit binary by default. | ||
-CC= $(DEFAULT_CC) | ||
+CC ?= $(DEFAULT_CC) | ||
# | ||
# Use this if you want to force a 32 bit build on a 64 bit multilib OS. | ||
#CC= $(DEFAULT_CC) -m32 | ||
@@ -71,10 +71,10 @@ CCWARN= -Wall | ||
# as dynamic mode. | ||
# | ||
# Mixed mode creates a static + dynamic library and a statically linked luajit. | ||
-BUILDMODE= mixed | ||
+#BUILDMODE= mixed | ||
# | ||
# Static mode creates a static library and a statically linked luajit. | ||
-#BUILDMODE= static | ||
+BUILDMODE= static | ||
# | ||
# Dynamic mode creates a dynamic library and a dynamically linked luajit. | ||
# Note: this executable will only run when the library is installed! | ||
@@ -99,7 +99,7 @@ XCFLAGS= | ||
# enabled by default. Some other features that *might* break some existing | ||
# code (e.g. __pairs or os.execute() return values) can be enabled here. | ||
# Note: this does not provide full compatibility with Lua 5.2 at this time. | ||
-#XCFLAGS+= -DLUAJIT_ENABLE_LUA52COMPAT | ||
+XCFLAGS+= -DLUAJIT_ENABLE_LUA52COMPAT | ||
# | ||
# Disable the JIT compiler, i.e. turn LuaJIT into a pure interpreter. | ||
#XCFLAGS+= -DLUAJIT_DISABLE_JIT | ||
@@ -617,7 +617,7 @@ endif | ||
|
||
Q= @ | ||
E= @echo | ||
-#Q= | ||
+Q= | ||
#E= @: | ||
|
||
############################################################################## |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters