Skip to content

Commit c41b0f7

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

File tree

3 files changed

+76
-0
lines changed

3 files changed

+76
-0
lines changed

Diff for: 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/

Diff for: projects/openresty/build.sh

+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
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" LDFLAGS="${LDFLAGS}" -C src
29+
LUA_LIBRARIES=$(realpath ./src/libluajit.a)
30+
LUA_INCLUDE_DIR=$(realpath ./src/)
31+
LUA_EXECUTABLE=$(realpath ./src/luajit)
32+
33+
# Build the tests.
34+
cd lua-c-api-tests
35+
cmake -S . -B build -DCMAKE_C_COMPILER="${CC}" \
36+
-DCMAKE_CXX_COMPILER="${CXX}" \
37+
-DIS_LUAJIT=TRUE \
38+
-DLUA_INCLUDE_DIR="${LUA_INCLUDE_DIR}" \
39+
-DLUA_LIBRARIES="${LUA_LIBRARIES}" \
40+
-DLUA_EXECUTABLE="${LUA_EXECUTABLE}" \
41+
-DLUA_VERSION_STRING=\"luajit2\"
42+
cmake --build build --parallel
43+
44+
for f in $(find build/tests/ -name '*_test' -type f);
45+
do
46+
cp $f $OUT/
47+
done

Diff for: projects/openresty/project.yaml

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
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+
architectures:
8+
- x86_64

0 commit comments

Comments
 (0)