Skip to content

Commit 9097b3a

Browse files
committed
openresty: initial integration
Initial integration support for an OpenResty's branch of LuaJIT 2.
1 parent 1b48ca1 commit 9097b3a

File tree

3 files changed

+79
-0
lines changed

3 files changed

+79
-0
lines changed

projects/openresty/Dockerfile

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Copyright 2025 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
#
15+
################################################################################
16+
17+
FROM gcr.io/oss-fuzz-base/base-builder
18+
RUN git clone https://github.com/openresty/luajit2
19+
WORKDIR luajit2
20+
RUN git clone https://github.com/ligurio/lua-c-api-tests lua-c-api-tests
21+
COPY build.sh $SRC/

projects/openresty/build.sh

+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
#!/bin/bash -eu
2+
# Copyright 2025 Google LLC
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
#
16+
################################################################################
17+
18+
apt-get update
19+
apt-get install -y build-essential ninja-build cmake make \
20+
zlib1g-dev libreadline-dev libunwind-dev
21+
22+
: ${LD:="${CXX}"}
23+
: ${LDFLAGS:="${CXXFLAGS}"} # to make sure we link with sanitizer runtime
24+
25+
patch -p1 < lua-c-api-tests/patches/luajit-v2.1.patch
26+
27+
# Build the target project.
28+
make CC="${CC}" CFLAGS="${CFLAGS} -DLUAJIT_USE_ASAN -DLUA_USE_ASSERT -DLUA_USE_APICHECK" \
29+
LDFLAGS="${LDFLAGS}" HOST_CFLAGS=-fno-sanitize=undefined -C src
30+
LUA_LIBRARIES=$(realpath ./src/libluajit.a)
31+
LUA_INCLUDE_DIR=$(realpath ./src/)
32+
LUA_EXECUTABLE=$(realpath ./src/luajit)
33+
34+
# Build the tests.
35+
cd lua-c-api-tests
36+
cmake -S . -B build -DCMAKE_C_COMPILER="${CC}" \
37+
-DCMAKE_CXX_COMPILER="${CXX}" \
38+
-DIS_LUAJIT=TRUE \
39+
-DLUA_INCLUDE_DIR="${LUA_INCLUDE_DIR}" \
40+
-DLUA_LIBRARIES="${LUA_LIBRARIES}" \
41+
-DLUA_EXECUTABLE="${LUA_EXECUTABLE}" \
42+
-DLUA_VERSION_STRING=\"luajit2\"
43+
cmake --build build --parallel
44+
45+
for f in $(find build/tests/ -name '*_test' -type f);
46+
do
47+
cp $f $OUT/
48+
done

projects/openresty/project.yaml

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
homepage: "https://openresty.org/"
2+
language: c
3+
primary_contact: "[email protected]"
4+
auto_ccs:
5+
6+
main_repo: "https://github.com/openresty/luajit2"
7+
sanitizers:
8+
- address
9+
architectures:
10+
- x86_64

0 commit comments

Comments
 (0)