Add LUASCRIPT compatibility

Signed-off-by: DL6ER <dl6er@dl6er.de>
This commit is contained in:
DL6ER 2020-07-21 06:06:25 +02:00
parent 2a0697412f
commit 99c7688610
No known key found for this signature in database
GPG Key ID: 00135ACBD90B28DD
5 changed files with 24 additions and 7 deletions

View File

@ -12,6 +12,6 @@
rm -rf cmake/ && \
mkdir cmake && \
cd cmake && \
cmake -DSTATIC="${1}" .. && \
cmake "${1}" .. && \
cmake --build . -- GIT_BRANCH="${2}" GIT_TAG="${3}" CIRCLE_JOB="${4}" -j 4 && \
mv pihole-FTL ../

View File

@ -13,7 +13,7 @@ version: 2
command: |
BRANCH=$([ -z "$CIRCLE_TAG" ] && echo "$CIRCLE_BRANCH" || echo "master")
[[ $CIRCLE_JOB == *"qemu"* ]] && DOCKERIFNEEDED="docker run --rm -v $(pwd):/workspace -w /workspace pihole/ftl-build:arm-qemu "
$DOCKERIFNEEDED bash .circleci/build-CI.sh "${STATIC}" "${BRANCH}" "${CIRCLE_TAG}" "${CIRCLE_JOB}"
$DOCKERIFNEEDED bash .circleci/build-CI.sh "-DSTATIC=${STATIC}" "${BRANCH}" "${CIRCLE_TAG}" "${CIRCLE_JOB}"
- run:
name: "Binary checks"
command: bash test/arch_test.sh

View File

@ -18,17 +18,23 @@ if [[ "${1}" == "clean" ]]; then
exit 0
fi
# Configure build
# Configure build, pass CMake CACHE entries if present
# Wrap multiple options in "" as first argument to ./build.sh:
# ./build.sh "-DA=1 -DB=2" install
mkdir -p cmake
cd cmake
cmake ..
if [[ "${1}" == "-D"* ]]; then
cmake "${1}" ..
else
cmake ..
fi
# Build the sources
cmake --build . -- -j $(nproc)
# If we are asked to install, we do this here
# Otherwise, we simply copy the binary one level up
if [[ "${1}" == "install" ]]; then
if [[ "${1}" == "install" || "${2}" == "install" ]]; then
sudo make install
else
cp pihole-FTL ../

View File

@ -178,10 +178,18 @@ find_library(NETTLE libnettle${CMAKE_STATIC_LIBRARY_SUFFIX})
find_library(IDN libidn${CMAKE_STATIC_LIBRARY_SUFFIX})
# for FTL we need the pthread library
# for dnsmasq we need the nettle crypto library and the gmp maths library
# We link the two libraries statically. Although this increases the binary file size by about 1 MB, it saves about 5 MB of shared libraries and makes deployment easier
# for DNSSEC we need the nettle (+ hogweed) crypto and the gmp math libraries
target_link_libraries(pihole-FTL rt Threads::Threads ${HOGWEED} ${GMP} ${NETTLE} ${IDN})
# for LUASCRIPT support we add liblua, libdl (lookforfunc) and libm
# Only liblua is linked statically as linking libm and libdl statically is discouraged
if(FTL_LUA STREQUAL "true")
find_library(LUA liblua${CMAKE_STATIC_LIBRARY_SUFFIX})
find_library(DL dl)
find_library(MATH m)
target_link_libraries(pihole-FTL ${LUA} ${DL} ${MATH})
endif()
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
set(CMAKE_INSTALL_PREFIX "/usr" CACHE PATH "..." FORCE)
endif()

View File

@ -50,5 +50,8 @@ set(sources
add_library(dnsmasq OBJECT ${sources})
target_compile_definitions(dnsmasq PRIVATE VERSION=\"${DNSMASQ_VERSION}\" HAVE_DNSSEC HAVE_DNSSEC_STATIC HAVE_IDN)
if(FTL_LUA STREQUAL "true")
target_compile_definitions(dnsmasq PRIVATE HAVE_LUASCRIPT)
endif()
target_compile_options(dnsmasq PRIVATE -Wno-maybe-uninitialized)
target_include_directories(dnsmasq PRIVATE ${PROJECT_SOURCE_DIR}/src)