From 222072d3188200cac3d9c1ea23a466498e9ddc07 Mon Sep 17 00:00:00 2001 From: Nameless Date: Fri, 21 Jun 2024 13:18:56 -0500 Subject: [PATCH 01/11] build: clean up build system, update cmake This is an amalgamation of many changes: - remove make.bat, use nmake compatible Makefile instead - remove appveyor.yml, use exclusively GitHub Actions - reorganize the cmake build to make use of new features - configure openssl during the configure step - make dependencies more consistent - always use luac.lua to compile lua files - this makes a static luvi build more possible --- CMakeLists.txt | 269 +++++++----------- Makefile | 347 ++++++++++++++---------- appveyor.yml | 48 ---- cmake/Modules/FindLPEG.cmake | 8 - cmake/Modules/FindLibluv.cmake | 11 - cmake/Modules/FindLibuv.cmake | 53 +++- cmake/Modules/FindLuaJIT.cmake | 55 +++- cmake/Modules/FindLuv.cmake | 47 ++++ cmake/Modules/LuaAddExecutable.cmake | 51 ++++ cmake/Modules/LuaJITAddExecutable.cmake | 71 ----- cmake/Modules/luac.lua | 86 ++++++ deps/lpeg.cmake | 13 +- deps/lrexlib.cmake | 19 +- deps/lua-openssl.cmake | 35 +-- deps/lua-zlib.cmake | 22 +- deps/openssl.cmake | 138 ++++++---- deps/pcre.cmake | 40 +-- deps/zlib.cmake | 19 +- make.bat | 165 ----------- 19 files changed, 715 insertions(+), 782 deletions(-) delete mode 100644 appveyor.yml delete mode 100644 cmake/Modules/FindLPEG.cmake delete mode 100644 cmake/Modules/FindLibluv.cmake create mode 100644 cmake/Modules/FindLuv.cmake create mode 100644 cmake/Modules/LuaAddExecutable.cmake delete mode 100644 cmake/Modules/LuaJITAddExecutable.cmake create mode 100644 cmake/Modules/luac.lua delete mode 100644 make.bat diff --git a/CMakeLists.txt b/CMakeLists.txt index 7aa6eaa5..78a89a44 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,97 +1,77 @@ -cmake_minimum_required(VERSION 2.8.9) - -if(WIN32) - set(projects C ASM ASM_MASM) -else() - set(projects C ASM) -endif() - -project(luvi ${projects}) - -set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/") - -# use, i.e. don't skip the full RPATH for the build tree -SET(CMAKE_SKIP_BUILD_RPATH FALSE CACHE INTERNAL "") -# when building, don't use the install RPATH already -# (but later on when installing) -SET(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE CACHE INTERNAL "") -SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib" CACHE INTERNAL "") -# add the automatically determined parts of the RPATH -# which point to directories outside the build tree to the install RPATH -SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE CACHE INTERNAL "") -# the RPATH to be used when installing, but only if it's not a system directory -LIST(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES "${CMAKE_INSTALL_PREFIX}/lib" isSystemDir) -IF("${isSystemDir}" STREQUAL "-1") - SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib") -ENDIF("${isSystemDir}" STREQUAL "-1") - -if(MSVC) +cmake_minimum_required(VERSION 3.15) + +project(luvi C) + +list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules") + +if (MSVC) + cmake_policy(SET CMP0091 NEW) # Statically build against C runtime (use the right version for Release/Debug) - set(CompilerFlags - CMAKE_CXX_FLAGS - CMAKE_CXX_FLAGS_DEBUG - CMAKE_CXX_FLAGS_RELEASE - CMAKE_C_FLAGS - CMAKE_C_FLAGS_DEBUG - CMAKE_C_FLAGS_RELEASE - ) - foreach(CompilerFlag ${CompilerFlags}) - string(REPLACE "/MD" "/MT" ${CompilerFlag} "${${CompilerFlag}}") - endforeach() -endif() - -if(CMAKE_COMPILER_IS_GNUCC) - add_definitions( -Wno-unused-function) -endif() + set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>") +endif () + +if (CMAKE_COMPILER_IS_GNUCC) + add_compile_options(-Wno-unused-function) +endif () + +if (MINGW) + add_compile_options(-Wno-error=incompatible-pointer-types) +endif () + +if (UNIX) + add_compile_options(-Wall) +endif () if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/VERSION") file (STRINGS "${CMAKE_CURRENT_SOURCE_DIR}/VERSION" LUVI_VERSION) message("-- Found luvi version: ${LUVI_VERSION}") -else() - exec_program( - "git" - ${CMAKE_CURRENT_SOURCE_DIR} - ARGS "describe" "--tags" - OUTPUT_VARIABLE LUVI_VERSION) +else () + execute_process( + COMMAND git describe --tags + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + OUTPUT_VARIABLE LUVI_VERSION + OUTPUT_STRIP_TRAILING_WHITESPACE) + + # Handle shallow clones + if (LUVI_VERSION STREQUAL "") + execute_process( + COMMAND git rev-parse --short HEAD + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + OUTPUT_VARIABLE LUVI_VERSION + OUTPUT_STRIP_TRAILING_WHITESPACE) + + set(LUVI_VERSION "v0.0.0-0-g${LUVI_VERSION}") + endif () message("-- Found luvi git version: ${LUVI_VERSION}") -endif() +endif () option(WithSharedLibluv "Shared or Static libluv" OFF) option(WithOpenSSL "Include OpenSSL" OFF) -option(WithOpenSSLASM "Enable Assembly Optimizations" OFF) -option(WithSharedOpenSSL "Shared or Static OpenSSL" ON) +option(WithOpenSSLASM "Enable Assembly Optimizations" ON) +option(WithSharedOpenSSL "Shared or Static OpenSSL" OFF) option(WithPCRE "Include PCRE" OFF) option(WithSharedPCRE "Shared or Static PCRE" OFF) option(WithLPEG "Include LPEG" OFF) option(WithSharedLPEG "Shared or Static LPEG" OFF) option(WithZLIB "Include ZLIB" OFF) -option(WithSharedZLIB "Shared or Static ZLIB" ON) -option(WithPackageSH "Build shell-installable package." OFF) -option(WithPackageTGZ "Build gziped tarball package." OFF) -option(WithPackageTBZ2 "Build bzip2'd tarball package." OFF) -option(WithPackageDEB "Build DEB package." OFF) -option(WithPackageRPM "Build RPM package." OFF) -option(WithPackageNSIS "Build NSIS package." OFF) -option(WithPackageBUNDLE "Build OSX bundle." OFF) +option(WithSharedZLIB "Shared or Static ZLIB" OFF) find_package(Threads) +set (LUVI_LIBRARIES ${CMAKE_THREAD_LIBS_INIT}) +# When linking against a shared libluv, we assume that luajit and libuv are also shared +# Luvi does not support linking a static libluv *and* a static lua/luajit or libuv if (WithSharedLibluv) - # Building against a shared libluv provides that libluajit and libuv exists - find_package(Libluv) - find_package(LuaJIT) - find_package(Libuv) - if (LIBLUV_FOUND) - include_directories(${LIBLUV_INCLUDE_DIR}) - endif (LIBLUV_FOUND) - if (LUAJIT_FOUND) - include_directories(${LUAJIT_INCLUDE_DIR}) - endif (LUAJIT_FOUND) - if (LIBUV_FOUND) - include_directories(${LIBUV_INCLUDE_DIR}) - endif (LIBUV_FOUND) - include(LuaJITAddExecutable) - set(LUVI_LIBRARIES ${LIBLUV_LIBRARIES} ${LUAJIT_LIBRARIES} ${LIBUV_LIBRARIES}) + find_package(Libluv REQUIRED) + include_directories(${LIBLUV_INCLUDE_DIR}) + + find_package(LuaJIT REQUIRED) + include_directories(${LUAJIT_INCLUDE_DIR}) + + find_package(Libuv REQUIRED) + include_directories(${LIBUV_INCLUDE_DIR}) + + list(APPEND LUVI_LIBRARIES ${LIBLUV_LIBRARIES} ${LUAJIT_LIBRARIES} ${LIBUV_LIBRARIES}) else (WithSharedLibluv) # Build luv as static library instead of as module set(BUILD_MODULE OFF CACHE BOOL "Turn off building luv as module") @@ -100,66 +80,53 @@ else (WithSharedLibluv) include_directories(deps/luv/deps/libuv/include) if (WITH_LUA_ENGINE STREQUAL Lua) include_directories(deps/luv/deps/lua) - set(LUVI_LIBRARIES libluv_a lualib uv_a) - else() + list(APPEND LUVI_LIBRARIES lualib) + else () include_directories(deps/luv/deps/luajit/src) - set(LUVI_LIBRARIES libluv_a luajit-5.1 uv_a) - endif() - add_subdirectory(deps/luv) + list(APPEND LUVI_LIBRARIES luajit-5.1) + endif () + + list(APPEND LUVI_LIBRARIES libluv_a uv_a) + add_subdirectory(deps/luv) # Build luv endif (WithSharedLibluv) -set(LUA_COMPAT53_DIR deps/luv/deps/lua-compat-5.3) -if(DEFINED ENV{LUA_COMPAT53_DIR}) - set(LUA_COMPAT53_DIR $ENV{LUA_COMPAT53_DIR}) -endif() +set(LUA_COMPAT53_DIR "${CMAKE_CURRENT_SOURCE_DIR}/deps/luv/deps/lua-compat-5.3" CACHE PATH "Path to lua-compat-5.3") include_directories(${LUA_COMPAT53_DIR}) include_directories(${LUA_COMPAT53_DIR}/c-api) if (WithOpenSSL) - include(deps/openssl.cmake) -endif (WithOpenSSL) + include(deps/lua-openssl.cmake) +endif () if (WithPCRE) - include (deps/pcre.cmake) -endif (WithPCRE) + include(deps/lrexlib.cmake) +endif () if (WithLPEG) - set(LPEGLIB_DIR ${CMAKE_CURRENT_SOURCE_DIR}/deps/lpeg) - if(DEFINED ENV{LPEGLIB_DIR}) - set(LPEGLIB_DIR $ENV{LPEGLIB_DIR}) - endif() - - include (deps/lpeg.cmake) -endif (WithLPEG) + include(deps/lpeg.cmake) + set(lpeg_re_lua ${LPEGLIB_DIR}/re.lua) +endif () if (WithZLIB) - include(deps/zlib.cmake) -endif (WithZLIB) - -add_definitions( -DLUVI_VERSION="${LUVI_VERSION}" ) + include(deps/lua-zlib.cmake) +endif () -if(WIN32) +if (WIN32) set(winsvc src/winsvc.h src/winsvcaux.h src/winsvc.c src/winsvcaux.c) - if(WithSharedLibluv) + if (WithSharedLibluv) add_definitions( -DLUA_BUILD_AS_DLL -DBUILDING_UV_SHARED ) - endif() + endif () add_definitions( -DWITH_WINSVC ) add_definitions( -D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_WARNINGS ) add_library (luvi_renamed src/luvi_renamed.c) -endif() - -if(UNIX) - add_definitions(-Wall) -endif() +endif () if (WITH_LUA_ENGINE STREQUAL Lua) add_definitions(-DWITH_PLAIN_LUA) endif () -if(LPEGLIB_DIR) - set(lpeg_re_lua ${LPEGLIB_DIR}/re.lua) -endif() +include(LuaAddExecutable) lua_add_executable(luvi ${winsvc} src/main.c @@ -170,79 +137,27 @@ lua_add_executable(luvi ${lpeg_re_lua} ) -if(${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD") +if (${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD") set(CMAKE_EXE_LINKER_FLAGS "-Wl,-E") -endif() +endif () -if("${CMAKE_SYSTEM_NAME}" MATCHES "Linux") - set(EXTRA_LIBS ${EXTRA_LIBS} rt) -endif() +if (${CMAKE_SYSTEM_NAME} MATCHES "Linux") + set(list APPEND LUVI_LIBRARIES rt) +endif () -target_link_libraries(luvi ${LUVI_LIBRARIES} ${EXTRA_LIBS} ${CMAKE_THREAD_LIBS_INIT}) +target_link_libraries(luvi ${LUVI_LIBRARIES} ${EXTRA_LIBS}) set_target_properties(luvi PROPERTIES ENABLE_EXPORTS ON) -############################################################################### -## Installation Targets -############################################################################### +target_compile_definitions(luvi PRIVATE LUVI_VERSION="${LUVI_VERSION}") +target_compile_definitions(luvi PRIVATE ${LUVI_DEFINITIONS}) # Add any extra definitions, like the WITH_{LIB} defines -install(TARGETS luvi DESTINATION bin) +message("Configuration Summary:") +message(" LUVI_VERSION: ${LUVI_VERSION}") +message(" LUVI_DEFINITIONS: ${LUVI_DEFINITIONS}") +message(" LUVI_LIBRARIES: ${LUVI_LIBRARIES}") ############################################################################### -## Packaging +## Installation Targets ############################################################################### -if(WithPackageSH OR WithPackageTGZ OR WithPackageTBZ2 OR WithPackageDEB - OR WithPackageRPM OR WithPackageNSIS OR WithPackageBUNDLE) - - set(CPACK_PACKAGE_NAME "luvi") - set(CPACK_PACKAGE_VENDOR "Luvit Authors") - set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "A project in-between luv and luvit") - set(CPACK_PACKAGE_VERSION "0.7.2") - set(CPACK_PACKAGE_VERSION_MAJOR "0") - set(CPACK_PACKAGE_VERSION_MINOR "7") - set(CPACK_PACKAGE_VERSION_PATCH "2") - set(CPACK_PACKAGE_INSTALL_DIRECTORY "luvi") - set(CPACK_NSIS_MODIFY_PATH ON) - - unset(PACKAGE_LIST) - if (WithPackageSH) - list(APPEND CPACK_GENERATOR "STGZ") - list(APPEND PACKAGE_LIST "Shell-installable package (.sh)") - endif () - if (WithPackageTGZ) - list(APPEND CPACK_GENERATOR "TGZ") - list(APPEND PACKAGE_LIST "gziped tarball (.tar.gz)") - endif () - if (WithPackageTBZ2) - list(APPEND CPACK_GENERATOR "TBZ2") - list(APPEND PACKAGE_LIST "bzip2'd tarball (.tar.bz2)") - endif () - if (WithPackageDEB) - list(APPEND CPACK_GENERATOR "DEB") - list(APPEND PACKAGE_LIST "DEB package (.deb)") - set(CPACK_DEBIAN_PACKAGE_SECTION "net") - set(CPACK_DEBIAN_PACKAGE_MAINTAINER "Luvit Authors") - endif () - if (WithPackageRPM) - list(APPEND CPACK_GENERATOR "RPM") - list(APPEND PACKAGE_LIST "RPM package (.rpm)") - set(CPACK_RPM_PACKAGE_RELEASE 1) - set(CPACK_RPM_PACKAGE_LICENSE "Apache 2") - endif () - if (WithPackageNSIS) - list(APPEND CPACK_GENERATOR "NSIS") - list(APPEND PACKAGE_LIST "NSIS package (.exe)") - endif () - if (WithPackageBUNDLE) - list(APPEND CPACK_GENERATOR "Bundle") - list(APPEND PACKAGE_LIST "OSX Bundle (.dmg)") - set(CPACK_BUNDLE_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/packaging/macosx/Info.plist) - set(CPACK_BUNDLE_ICON ${CMAKE_CURRENT_SOURCE_DIR}/packaging/macosx/Icons.icns) - set(CPACK_BUNDLE_NAME "luvi") - endif () - string(REPLACE ";" ", " PACKAGE_LIST "${PACKAGE_LIST}") - - include(CPack) -else() - set(PACKAGE_LIST "None") -endif() +install(TARGETS luvi DESTINATION bin) diff --git a/Makefile b/Makefile index f41c8840..feb2d5c5 100644 --- a/Makefile +++ b/Makefile @@ -1,187 +1,236 @@ -LUVI_TAG=$(shell git describe --tags) -LUVI_ARCH=$(shell uname -s)_$(shell uname -m) -LUVI_PUBLISH_USER?=luvit -LUVI_PUBLISH_REPO?=luvi -LUVI_PREFIX?=/usr/local -LUVI_BINDIR?=$(LUVI_PREFIX)/bin -OS:=$(shell uname -s) -ARCH:=$(shell uname -m) +################################################################################################### +# Default build options +################################################################################################### +# NPROCS: Number of processors to use for parallel jobs +# GENERATOR: CMake generator to configure and build with +# PREFIX: Where to install luvi, defaults to /usr/local or C:\Program Files\luvit +# BINPREFIX: Where to install luvi binary, defaults to $PREFIX/bin +# EXTRA_CONFIGURE_FLAGS: Extra options to pass to cmake when configuring +# EXTRA_BUILD_FLAGS: Extra options to pass to make when building +# +# CMAKE_BUILD_TYPE: The cmake build type to use, defaults to Release +# WITH_AMALG: Whether to build the lua amalgamated, will use more memory but is faster +# WITH_LUA_ENGINE: Which lua engine to use, defaults to LuaJIT +# WITH_SHARED_LIBLUV: Whether to use libluv as a shared library. +# Note: Shared libluv implies shared libuv and luajit. +# +# WITH_{OPENSSL,PCRE,LPEG,ZLIB}: Whether to include the given library in the build +# WITH_SHARED_{OPENSSL,PCRE,LPEG,ZLIB}: Whether to use shared or static versions of the given library +################################################################################################### + +all: default + +ifdef MAKEDIR: ######################## +!ifdef MAKEDIR #### Start of nmake #### + +!ifndef CMAKE_BUILD_TYPE +CMAKE_BUILD_TYPE = Release +!endif + +!ifndef WITH_AMALG +WITH_AMALG = ON +!endif + +!ifndef WITH_LUA_ENGINE +WITH_LUA_ENGINE = LuaJIT +!endif + +!ifndef WITH_SHARED_LIBLUV +WITH_SHARED_LIBLUV = OFF +!endif + +!ifndef WITH_OPENSSL +WITH_OPENSSL = ON +!endif + +!ifndef WITH_PCRE +WITH_PCRE = ON +!endif + +!ifndef WITH_LPEG +WITH_LPEG = ON +!endif + +!ifndef WITH_ZLIB +WITH_ZLIB = OFF +!endif + +!ifndef WITH_OPENSSL_ASM +WITH_OPENSSL_ASM = ON +!endif + +!ifndef WITH_SHARED_OPENSSL +WITH_SHARED_OPENSSL = OFF +!endif + +!ifndef WITH_SHARED_PCRE +WITH_SHARED_PCRE = OFF +!endif + +!ifndef WITH_SHARED_LPEG +WITH_SHARED_LPEG = OFF +!endif + +!ifndef WITH_SHARED_ZLIB +WITH_SHARED_ZLIB = OFF +!endif + +!ifndef PREFIX +PREFIX = C:\Program Files\luvit +!endif + +!ifndef BINPREFIX +BINPREFIX = $(PREFIX)\bin +!endif + +!ifndef BUILD_PREFIX +BUILD_PREFIX = build +!endif + +RMR = cmd /c rmdir /s /q +RM = cmd /c del /f +INSTALL = cmd /c copy /y +LUVI = cmd /c $(BUILD_PREFIX)\$(CMAKE_BUILD_TYPE)\luvi.exe +TEST_BIN = cmd /c test.bin + +!ifndef CMAKE +CMAKE = cmake +!endif + +!else #### End of nmake #### +else #### Start of gmake #### + +CMAKE_BUILD_TYPE ?= Release + +WITH_AMALG ?= ON +WITH_LUA_ENGINE ?= LuaJIT +WITH_SHARED_LIBLUV ?= OFF -CMAKE_FLAGS+= -H. -Bbuild -DCMAKE_BUILD_TYPE=Release -ifdef GENERATOR - CMAKE_FLAGS+= -G"${GENERATOR}" +WITH_OPENSSL ?= ON +WITH_PCRE ?= ON +WITH_LPEG ?= ON +WITH_ZLIB ?= OFF + +WITH_OPENSSL_ASM ?= ON +WITH_SHARED_OPENSSL ?= OFF +WITH_SHARED_PCRE ?= OFF +WITH_SHARED_LPEG ?= OFF +WITH_SHARED_ZLIB ?= OFF + +OS := $(shell uname -s) +ifeq ($(OS),Windows_NT) + PREFIX ?= C:\Program Files\luvit +else + PREFIX ?= /usr/local endif -ifdef WITHOUT_AMALG - CMAKE_FLAGS+= -DWITH_AMALG=OFF -endif +BINPREFIX ?= $(PREFIX)/bin +BUILD_PREFIX ?= build -ifdef WITH_LUA_ENGINE - CMAKE_FLAGS+= -DWITH_LUA_ENGINE=$(WITH_LUA_ENGINE) -endif +RMR = rm -rf +RM = rm -f +INSTALL = install -p +LUVI = $(BUILD_PREFIX)/luvi +TEST_BIN = ./test.bin -WITH_SHARED_LIBLUV ?= OFF +CMAKE ?= cmake + +endif #### End of gmake #### +!endif : ######################## -CMAKE_FLAGS += \ +############################################################################### + +CONFIGURE_FLAGS = \ + -DCMAKE_BUILD_TYPE=$(CMAKE_BUILD_TYPE) \ + -DWITH_AMALG=$(WITH_AMALG) \ + -DWITH_LUA_ENGINE=$(WITH_LUA_ENGINE) \ -DWithSharedLibluv=$(WITH_SHARED_LIBLUV) -CPACK_FLAGS=-DWithPackageSH=ON -DWithPackageTGZ=ON -DWithPackageTBZ2=ON -ifdef CPACK_DEB - CPACK_FLAGS=-DWithPackageDEB=ON -endif +CONFIGURE_REGULAR_FLAGS = $(CONFIGURE_FLAGS) \ + -DWithOpenSSL=$(WITH_OPENSSL) \ + -DWithPCRE=$(WITH_PCRE) \ + -DWithLPEG=$(WITH_LPEG) \ + -DWithZLIB=$(WITH_ZLIB) \ + -DWithOpenSSLASM=$(WITH_OPENSSL_ASM) \ + -DWithSharedOpenSSL=$(WITH_SHARED_OPENSSL) \ + -DWithSharedPCRE=$(WITH_SHARED_PCRE) \ + -DWithSharedLPEG=$(WITH_SHARED_LPEG) \ + -DWithSharedZLIB=$(WITH_SHARED_ZLIB) -ifdef CPACK_RPM - CPACK_FLAGS=-DWithPackageRPM=ON -endif +ifdef MAKEDIR: ######################## +!ifdef MAKEDIR #### Start of nmake #### -ifdef CPACK_NSIS - CPACK_FLAGS=-DWithPackageNSIS=ON -endif +!ifdef GENERATOR + CONFIGURE_FLAGS += -G"$(GENERATOR)" +!endif -ifdef CPACK_BUNDLE - CPACK_FLAGS=-DWithPackageBUNDLE=ON -endif +!ifdef ARCH + CONFIGURE_FLAGS += -A"$(ARCH)" +!endif -ifndef NPROCS -ifeq ($(OS),Linux) - NPROCS:=$(shell grep -c ^processor /proc/cpuinfo) -else ifeq ($(OS),Darwin) - NPROCS:=$(shell sysctl hw.ncpu | awk '{print $$2}') -endif +!else #### End of nmake #### +else #### Start of gmake #### + +ifdef GENERATOR + CONFIGURE_FLAGS += -G"$(GENERATOR)" endif ifdef NPROCS - EXTRA_OPTIONS:=-j${NPROCS} + BUILD_OPTIONS += -j$(NPROCS) endif -# This does the actual build and configures as default flavor is there is no build folder. -luvi: build - cmake --build build -- ${EXTRA_OPTIONS} - -build: - @echo "Please run tiny' or 'regular' make target first to configure" +endif #### End of gmake #### +!endif : ######################## -# Configure the build with minimal dependencies -tiny: deps/luv/CMakeLists.txt - cmake $(CMAKE_FLAGS) $(CPACK_FLAGS) +### Build targets -# Configure the build with openssl statically included -regular: deps/luv/CMakeLists.txt - cmake $(CMAKE_FLAGS) $(CPACK_FLAGS) -DWithOpenSSL=ON -DWithSharedOpenSSL=OFF -DWithPCRE=ON -DWithLPEG=ON -DWithSharedPCRE=OFF +default: luvi -regular-asm: deps/luv/CMakeLists.txt - cmake $(CMAKE_FLAGS) $(CPACK_FLAGS) -DWithOpenSSL=ON -DWithSharedOpenSSL=OFF -DWithOpenSSLASM=ON -DWithPCRE=ON -DWithLPEG=ON -DWithSharedPCRE=OFF +# This does the actual build and configures as default flavor is there is no build folder. +luvi: $(BUILD_PREFIX) + $(CMAKE) --build $(BUILD_PREFIX) --config $(CMAKE_BUILD_TYPE) -- $(BUILD_OPTIONS) $(EXTRA_OPTIONS) -# Configure the build with shared openssl -regular-shared: - cmake $(CMAKE_FLAGS) $(CPACK_FLAGS) -DWithOpenSSL=ON -DWithSharedOpenSSL=ON -DWithPCRE=ON -DWithLPEG=ON -DWithSharedPCRE=OFF +### Directories and dependencies -package: deps/luv/CMakeLists.txt - cmake --build build -- package +# Ensure the build prefix exists, ie. we have configured the build +$(BUILD_PREFIX): + @echo "Please run 'make tiny' or 'make regular' first to configure" # In case the user forgot to pull in submodules, grab them. deps/luv/CMakeLists.txt: git submodule update --init --recursive -clean: - rm -rf build luvi-* +### Configuration targets -test: luvi - rm -f test.bin - build/luvi samples/test.app -- 1 2 3 4 - build/luvi samples/test.app -o test.bin - ./test.bin 1 2 3 4 - rm -f test.bin +# Configure the build with minimal dependencies +tiny: deps/luv/CMakeLists.txt + $(CMAKE) -H. -B$(BUILD_PREFIX) $(CONFIGURE_FLAGS) $(EXTRA_CONFIGURE_FLAGS) + +# Configure the build with any libraries requested +regular: deps/luv/CMakeLists.txt + $(CMAKE) -H. -B$(BUILD_PREFIX) $(CONFIGURE_REGULAR_FLAGS) $(EXTRA_CONFIGURE_FLAGS) + +### Phony targets + +.PHONY: clean test install uninstall reset +clean: + $(RMR) $(BUILD_PREFIX) test.bin install: luvi - install -p build/luvi $(LUVI_BINDIR)/ + install -p $(BUILD_PREFIX)/luvi $(BINPREFIX)/luvi uninstall: - rm -f /usr/local/bin/luvi + $(RM) $(BINPREFIX)/luvi + +test: luvi + $(RM) test.bin + $(LUVI) samples/test.app -- 1 2 3 4 + $(LUVI) samples/test.app -o test.bin + $(TEST_BIN) 1 2 3 4 + $(RM) test.bin reset: git submodule update --init --recursive && \ git clean -f -d && \ git checkout . - -luvi-src.tar.gz: - echo ${LUVI_TAG} > VERSION && \ - COPYFILE_DISABLE=true tar -czvf ../luvi-src.tar.gz \ - --exclude 'luvi-src.tar.gz' --exclude '.git*' --exclude build . && \ - mv ../luvi-src.tar.gz . && \ - rm VERSION - - -travis-publish: reset luvi-src.tar.gz travis-tiny travis-regular-asm - $(MAKE) - mv luvi-src.tar.gz luvi-src-${LUVI_TAG}.tar.gz - -travis-tiny: reset tiny - $(MAKE) - mv build/luvi luvi-tiny-$(OS)_$(ARCH) - -travis-regular-asm: reset regular-asm - $(MAKE) - mv build/luvi luvi-regular-$(OS)_$(ARCH) - -linux-build: linux-build-box-regular linux-build-box32-regular linux-build-box-tiny linux-build-box32-tiny - -linux-build-box-regular: luvi-src.tar.gz - rm -rf build && mkdir -p build - cp packaging/holy-build.sh luvi-src.tar.gz build - mkdir -p build - docker run -i --rm \ - -v `pwd`/build:/io phusion/holy-build-box-64:latest bash /io/holy-build.sh regular-asm - mv build/luvi luvi-regular-Linux_x86_64 - -linux-build-box32-regular: luvi-src.tar.gz - rm -rf build && mkdir -p build - cp packaging/holy-build.sh luvi-src.tar.gz build - docker run -i --rm \ - -v `pwd`/build:/io phusion/holy-build-box-32:latest linux32 bash /io/holy-build.sh regular-asm - mv build/luvi luvi-regular-Linux_i686 - -linux-build-box-tiny: luvi-src.tar.gz - rm -rf build && mkdir -p build - cp packaging/holy-build.sh luvi-src.tar.gz build - mkdir -p build - docker run -i --rm \ - -v `pwd`/build:/io phusion/holy-build-box-64:latest bash /io/holy-build.sh tiny - mv build/luvi luvi-tiny-Linux_x86_64 - -linux-build-box32-tiny: luvi-src.tar.gz - rm -rf build && mkdir -p build - cp packaging/holy-build.sh luvi-src.tar.gz build - docker run -i --rm \ - -v `pwd`/build:/io phusion/holy-build-box-32:latest linux32 bash /io/holy-build.sh tiny - mv build/luvi luvi-tiny-Linux_i686 - -publish-src: reset luvi-src.tar.gz - github-release upload --user ${LUVI_PUBLISH_USER} --repo ${LUVI_PUBLISH_REPO} --tag ${LUVI_TAG} \ - --file luvi-src.tar.gz --name luvi-src-${LUVI_TAG}.tar.gz - -publish: - $(MAKE) clean publish-tiny - $(MAKE) clean publish-regular - -publish-linux: reset - $(MAKE) linux-build && \ - github-release upload --user ${LUVI_PUBLISH_USER} --repo ${LUVI_PUBLISH_REPO} --tag ${LUVI_TAG} \ - --file luvi-regular-Linux_i686 --name luvi-regular-Linux_i686 && \ - github-release upload --user ${LUVI_PUBLISH_USER} --repo ${LUVI_PUBLISH_REPO} --tag ${LUVI_TAG} \ - --file luvi-regular-Linux_x86_64 --name luvi-regular-Linux_x86_64 && \ - github-release upload --user ${LUVI_PUBLISH_USER} --repo ${LUVI_PUBLISH_REPO} --tag ${LUVI_TAG} \ - --file luvi-tiny-Linux_x86_64 --name luvi-tiny-Linux-x86_64 && \ - github-release upload --user ${LUVI_PUBLISH_USER} --repo ${LUVI_PUBLISH_REPO} --tag ${LUVI_TAG} \ - --file luvi-tiny-Linux_i686 --name luvi-tiny-Linux-i686 - -publish-tiny: reset - $(MAKE) tiny test && \ - github-release upload --user ${LUVI_PUBLISH_USER} --repo ${LUVI_PUBLISH_REPO} --tag ${LUVI_TAG} \ - --file build/luvi --name luvi-tiny-${LUVI_ARCH} - -publish-regular: reset - $(MAKE) regular-asm test && \ - github-release upload --user ${LUVI_PUBLISH_USER} --repo ${LUVI_PUBLISH_REPO} --tag ${LUVI_TAG} \ - --file build/luvi --name luvi-regular-${LUVI_ARCH} diff --git a/appveyor.yml b/appveyor.yml deleted file mode 100644 index 6736f7d6..00000000 --- a/appveyor.yml +++ /dev/null @@ -1,48 +0,0 @@ -image: Visual Studio 2017 -configuration: Release - -environment: - matrix: - - BUILD_TYPE: tiny - - BUILD_TYPE: tiny32 - - BUILD_TYPE: regular-asm - - BUILD_TYPE: regular32-asm - -matrix: - fast_finish: true - -install: - - choco install nasm - - set PATH="C:\Program Files\NASM";%PATH% - -build_script: - - git submodule update --init --recursive - - Make.bat %BUILD_TYPE% - - Make.bat - -test_script: - - Make.bat test - -after_build: - - Make.bat artifacts-%BUILD_TYPE% - -artifacts: - - path: artifacts\*.exe - - path: artifacts\*.lib - -cache: - - C:\ProgramData\chocolatey\bin -> appveyor.yml - - C:\ProgramData\chocolatey\lib -> appveyor.yml - - C:\Program Files\NASM -> appveyor.yml - -deploy: - description: '' # appveyor says this is mandatory - provider: GitHub - auth_token: - secure: ZQtPAVaybUWlOtbbHkn1HkoE6zrEUE7wjEXUqCA1vdVRqZYHZUvmVowHxzMtQpLC - artifact: /.*/ # everything - draft: false - prerelease: false - force_update: true - on: - APPVEYOR_REPO_TAG: true # tags only diff --git a/cmake/Modules/FindLPEG.cmake b/cmake/Modules/FindLPEG.cmake deleted file mode 100644 index 8d9b00a4..00000000 --- a/cmake/Modules/FindLPEG.cmake +++ /dev/null @@ -1,8 +0,0 @@ -# Look for the library. -FIND_LIBRARY(LPEGLIB NAMES lpeg PATH_SUFFIXES) - -# Handle the QUIETLY and REQUIRED arguments and set LPEG_FOUND to TRUE if all listed variables are TRUE. -INCLUDE(FindPackageHandleStandardArgs) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(LPEG DEFAULT_MSG LPEGLIB) - -MARK_AS_ADVANCED(LPEGLIB) diff --git a/cmake/Modules/FindLibluv.cmake b/cmake/Modules/FindLibluv.cmake deleted file mode 100644 index c4145bf9..00000000 --- a/cmake/Modules/FindLibluv.cmake +++ /dev/null @@ -1,11 +0,0 @@ -# Locate libluv library -# This module defines -# LIBLUV_FOUND, if false, do not try to link to libluv -# LIBLUV_LIBRARIES -# LIBLUV_INCLUDE_DIR, where to find uv.h - -FIND_PATH(LIBLUV_INCLUDE_DIR luv.h PATH_SUFFIXES luv) -FIND_LIBRARY(LIBLUV_LIBRARIES luv) - -INCLUDE(FindPackageHandleStandardArgs) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(LIBLUV DEFAULT_MSG LIBLUV_LIBRARIES LIBLUV_INCLUDE_DIR) diff --git a/cmake/Modules/FindLibuv.cmake b/cmake/Modules/FindLibuv.cmake index 585bce71..55738e43 100644 --- a/cmake/Modules/FindLibuv.cmake +++ b/cmake/Modules/FindLibuv.cmake @@ -1,11 +1,46 @@ -# Locate libuv library -# This module defines -# LIBUV_FOUND, if false, do not try to link to libuv -# LIBUV_LIBRARIES -# LIBUV_INCLUDE_DIR, where to find uv.h +#[=======================================================================[.rst: +FindLibuv +-------- -FIND_PATH(LIBUV_INCLUDE_DIR uv.h) -FIND_LIBRARY(LIBUV_LIBRARIES uv) +Find the native libuv headers and libraries. -INCLUDE(FindPackageHandleStandardArgs) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(LIBUV DEFAULT_MSG LIBUV_LIBRARIES LIBUV_INCLUDE_DIR) +Result Variables +^^^^^^^^^^^^^^^^ + +This module defines the following variables: + +``UV_FOUND`` + "True" if ``libuv`` found. + +``UV_INCLUDE_DIRS`` + where to find ``uv.h``, etc. + +``UV_LIBRARIES`` + List of libraries when using ``uv``. + +#]=======================================================================] + +include(FindPackageHandleStandardArgs) + +find_package(PkgConfig QUIET) +if(PKG_CONFIG_FOUND) + pkg_check_modules(PC_UV QUIET libuv) +endif() + +find_path(UV_INCLUDE_DIR + NAMES uv.h + HINTS ${PC_UV_INCLUDE_DIRS}) +mark_as_advanced(UV_INCLUDE_DIR) + +find_library(UV_LIBRARY + NAMES uv + HINTS ${PC_UV_LIBRARY_DIRS}) +mark_as_advanced(UV_LIBRARY) + +find_package_handle_standard_args(uv + REQUIRED_VARS UV_INCLUDE_DIR UV_LIBRARY) + +if (UV_FOUND) # Set the output variables + set(UV_LIBRARIES ${UV_LIBRARY}) + set(UV_INCLUDE_DIRS ${UV_INCLUDE_DIR}) +endif () diff --git a/cmake/Modules/FindLuaJIT.cmake b/cmake/Modules/FindLuaJIT.cmake index f99da77e..630dac6b 100644 --- a/cmake/Modules/FindLuaJIT.cmake +++ b/cmake/Modules/FindLuaJIT.cmake @@ -1,11 +1,48 @@ -# Locate LuaJIT library -# This module defines -# LUAJIT_FOUND, if false, do not try to link to Lua JIT -# LUAJIT_LIBRARIES -# LUAJIT_INCLUDE_DIR, where to find lua.h +#[=======================================================================[.rst: +FindLuajit +-------- -FIND_PATH(LUAJIT_INCLUDE_DIR NAMES lua.h PATH_SUFFIXES luajit-2.0) -FIND_LIBRARY(LUAJIT_LIBRARIES NAMES luajit-5.1 PATH_SUFFIXES luajit-2.0) +Find the native luajit headers and libraries. -INCLUDE(FindPackageHandleStandardArgs) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(LUAJIT DEFAULT_MSG LUAJIT_LIBRARIES LUAJIT_INCLUDE_DIR) +Result Variables +^^^^^^^^^^^^^^^^ + +This module defines the following variables: + +``LUAJIT_FOUND`` + "True" if ``luajit`` found. + +``LUAJIT_INCLUDE_DIRS`` + where to find ``lua.h``, etc. + +``LUAJIT_LIBRARIES`` + List of libraries when using ``luajit``. + +#]=======================================================================] + +include(FindPackageHandleStandardArgs) + +find_package(PkgConfig QUIET) +if(PKG_CONFIG_FOUND) + pkg_check_modules(PC_LUAJIT QUIET luajit) +endif() + +find_path(LUAJIT_INCLUDE_DIR + NAMES lua.h + HINTS ${PC_LUAJIT_INCLUDE_DIRS} + PATH_SUFFIXES luajit-2.0) +mark_as_advanced(LUAJIT_INCLUDE_DIR) + +find_library(LUAJIT_LIBRARY + NAMES luajit-5.1 + HINTS ${PC_LUAJIT_LIBRARY_DIRS} + PATH_SUFFIXES luajit-2.0) +mark_as_advanced(LUAJIT_LIBRARY) + +find_package_handle_standard_args(luajit + REQUIRED_VARS LUAJIT_INCLUDE_DIR LUAJIT_LIBRARY) + +if (LUAJIT_FOUND) # Set the output variables + set(LUAJIT_LIBRARIES ${LUAJIT_LIBRARY}) + set(LUAJIT_INCLUDE_DIRS ${LUAJIT_INCLUDE_DIR}) +endif () diff --git a/cmake/Modules/FindLuv.cmake b/cmake/Modules/FindLuv.cmake new file mode 100644 index 00000000..a0a18b6b --- /dev/null +++ b/cmake/Modules/FindLuv.cmake @@ -0,0 +1,47 @@ +#[=======================================================================[.rst: +FindLuv +-------- + +Find the native luv headers and libraries. + +Result Variables +^^^^^^^^^^^^^^^^ + +This module defines the following variables: + +``LUV_FOUND`` + "True" if ``luv`` found. + +``LUV_INCLUDE_DIRS`` + where to find ``luv.h``, etc. + +``LUV_LIBRARIES`` + List of libraries when using ``luv``. + +#]=======================================================================] + +include(FindPackageHandleStandardArgs) + +find_package(PkgConfig QUIET) +if(PKG_CONFIG_FOUND) + pkg_check_modules(PC_LUV QUIET libluv) +endif() + +find_path(LUV_INCLUDE_DIR + NAMES luv.h + HINTS ${PC_LUV_INCLUDE_DIRS} + PATH_SUFFIXES luv) +mark_as_advanced(LUV_INCLUDE_DIR) + +find_library(LUV_LIBRARY + NAMES luv + HINTS ${PC_LUV_LIBRARY_DIRS}) +mark_as_advanced(LUV_LIBRARY) + +find_package_handle_standard_args(luv + REQUIRED_VARS LUV_INCLUDE_DIR LUV_LIBRARY) + +if (LUV_FOUND) # Set the output variables + set(LUV_LIBRARIES ${LUV_LIBRARY}) + set(LUV_INCLUDE_DIRS ${LUV_INCLUDE_DIR}) +endif () diff --git a/cmake/Modules/LuaAddExecutable.cmake b/cmake/Modules/LuaAddExecutable.cmake new file mode 100644 index 00000000..165d6acc --- /dev/null +++ b/cmake/Modules/LuaAddExecutable.cmake @@ -0,0 +1,51 @@ +# Added LUAJIT_ADD_EXECUTABLE Ryan Phillips +# This CMakeLists.txt has been first taken from LuaDist +# Copyright (C) 2007-2011 LuaDist. +# Created by Peter Drahoš +# Redistribution and use of this file is allowed according to the terms of the MIT license. +# Debugged and (now seriously) modified by Ronan Collobert, for Torch7 +# Stripped-down and modified by Jörg Krause , for +# The Luvit Authors + +macro(LUA_ADD_EXECUTABLE target) + set(LUA_COMMAND luajit) + set(LUA_COMMAND_ARGS "${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules/luac.lua") + if (WITH_LUA_ENGINE STREQUAL Lua) + set(LUA_COMMAND lua) + endif () + + if ($ENV{LUA_PATH}) + set(LUA_COMMAND ${CMAKE_COMMAND} -E env LUA_PATH=$ENV{LUA_PATH} -- ${LUA_COMMAND}) + endif () + + set(target_sources) + + foreach(source_file ${ARGN}) + get_filename_component(source_extension ${source_file} EXT) + get_filename_component(source_name ${source_file} NAME_WE) + + if (${source_extension} STREQUAL ".lua") + set(generated_file "${CMAKE_BINARY_DIR}/compiled_lua/${source_name}_${target}_generated.c") + if (NOT IS_ABSOLUTE ${source_file}) + set(source_file "${CMAKE_CURRENT_SOURCE_DIR}/${source_file}") + endif () + + add_custom_command( + OUTPUT ${generated_file} + MAIN_DEPENDENCY ${source_file} + COMMAND ${LUA_COMMAND} + ARGS ${LUA_COMMAND_ARGS} ${source_file} ${generated_file} + COMMENT "Building Lua ${source_file}: ${generated_file}" + ) + + get_filename_component(basedir ${generated_file} PATH) + file(MAKE_DIRECTORY ${basedir}) + + list(APPEND target_sources ${generated_file}) + else () + list(APPEND target_sources ${source_file}) + endif () + endforeach() + + add_executable(${target} ${target_sources}) +endmacro(LUA_ADD_EXECUTABLE target) diff --git a/cmake/Modules/LuaJITAddExecutable.cmake b/cmake/Modules/LuaJITAddExecutable.cmake deleted file mode 100644 index e250d089..00000000 --- a/cmake/Modules/LuaJITAddExecutable.cmake +++ /dev/null @@ -1,71 +0,0 @@ -# Added LUAJIT_ADD_EXECUTABLE Ryan Phillips -# This CMakeLists.txt has been first taken from LuaDist -# Copyright (C) 2007-2011 LuaDist. -# Created by Peter Drahoš -# Redistribution and use of this file is allowed according to the terms of the MIT license. -# Debugged and (now seriously) modified by Ronan Collobert, for Torch7 -# Stripped-down and modified by Jörg Krause , for -# The Luvit Authors - -MACRO(LUAJIT_add_custom_commands luajit_target) - SET(TARGET_ARCH $ENV{TARGET_ARCH}) - IF(TARGET_ARCH) - SET(LJ_BYTECODE_OPTS ${LJ_BYTECODE_OPTS} -a ${TARGET_ARCH}) - ENDIF(TARGET_ARCH) - SET(LUA_PATH $ENV{LUA_PATH}) - SET(target_srcs "") - FOREACH(file ${ARGN}) - IF(${file} MATCHES ".*\\.lua$") - set(file "${CMAKE_CURRENT_SOURCE_DIR}/${file}") - set(source_file ${file}) - string(LENGTH ${CMAKE_SOURCE_DIR} _luajit_source_dir_length) - string(LENGTH ${file} _luajit_file_length) - math(EXPR _begin "${_luajit_source_dir_length} + 1") - math(EXPR _stripped_file_length "${_luajit_file_length} - ${_luajit_source_dir_length} - 1") - string(SUBSTRING ${file} ${_begin} ${_stripped_file_length} stripped_file) - - set(generated_file "${CMAKE_BINARY_DIR}/jitted_tmp/${stripped_file}_${luajit_target}_generated${CMAKE_C_OUTPUT_EXTENSION}") - - # Only use LUA_PATH if it's set - IF(LUA_PATH) - add_custom_command( - OUTPUT ${generated_file} - MAIN_DEPENDENCY ${source_file} - COMMAND "LUA_PATH=${LUA_PATH}" luajit - ARGS -b ${LJ_BYTECODE_OPTS} - ${source_file} - ${generated_file} - COMMENT "Building Luajitted ${source_file}: ${generated_file}" - ) - ELSE() - add_custom_command( - OUTPUT ${generated_file} - MAIN_DEPENDENCY ${source_file} - COMMAND luajit - ARGS -b ${LJ_BYTECODE_OPTS} - ${source_file} - ${generated_file} - COMMENT "Building Luajitted ${source_file}: ${generated_file}" - ) - ENDIF() - - get_filename_component(basedir ${generated_file} PATH) - file(MAKE_DIRECTORY ${basedir}) - - set(target_srcs ${target_srcs} ${generated_file}) - set_source_files_properties( - ${generated_file} - properties - external_object true # this is an object file - generated true # to say that "it is OK that the obj-files do not exist before build time" - ) - ELSE() - set(target_srcs ${target_srcs} ${file}) - ENDIF(${file} MATCHES ".*\\.lua$") - ENDFOREACH(file) -ENDMACRO() - -MACRO(LUA_ADD_EXECUTABLE luajit_target) - LUAJIT_add_custom_commands(${luajit_target} ${ARGN}) - add_executable(${luajit_target} ${target_srcs}) -ENDMACRO(LUA_ADD_EXECUTABLE luajit_target) diff --git a/cmake/Modules/luac.lua b/cmake/Modules/luac.lua new file mode 100644 index 00000000..5b7747ff --- /dev/null +++ b/cmake/Modules/luac.lua @@ -0,0 +1,86 @@ +--[[ + Copyright 2014 The Luvit Authors. All Rights Reserved. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +s +]] +local src, gen = ... + +local chunk = assert(loadfile(src, nil, '@'..src)) +local bytecode = string.dump(chunk) + +local function basename(name) + return name:match("([^/\\]+)$") +end + +local function basename_noext(name) + return basename(name):match("(.*)%..+") +end + +local function write_chunk(s) + local t = { "{\n " }; + local cc = 7 + for i = 1, #s do + local c = string.byte(s, i, i) + local ss = (" 0x%X"):format(c) + if cc + #ss > 77 then + t[#t+1] = "\n " + t[#t+1] = ss + cc = 7 + #ss + if i ~= #s then + t[#t+1] = "," + cc = cc + 1 + end + else + t[#t+1] = ss + cc = cc + #ss + if i ~= #s then + t[#t+1] = "," + cc = cc + 1 + end + end + end + t[#t+1] = "\n }" + return (table.concat(t)) +end + +local function W(...) + io.write(...) + return W +end + +io.output(gen) +W [[ +/* generated source for Lua codes */ + +#ifndef LUA_LIB +# define LUA_LIB +#endif +#include +#include + +LUALIB_API int luaopen_]](basename_noext(src))[[(lua_State *L) { + size_t len = ]](#bytecode)[[; + const char chunk[] = ]](write_chunk(bytecode))[[; + + if (luaL_loadbuffer(L, chunk, len, "]](basename(src))[[") != 0) + lua_error(L); + lua_insert(L, 1); + lua_call(L, lua_gettop(L)-1, LUA_MULTRET); + return lua_gettop(L); +} + +]] +io.close() + + diff --git a/deps/lpeg.cmake b/deps/lpeg.cmake index d2b8a293..05dbc1b7 100644 --- a/deps/lpeg.cmake +++ b/deps/lpeg.cmake @@ -1,8 +1,6 @@ -include_directories( - ${LPEGLIB_DIR} -) +set(LPEGLIB_DIR "${CMAKE_CURRENT_SOURCE_DIR}/deps/lpeg" CACHE PATH "Path to lpeg") -add_library(LPEGLIB +add_library(lpeglib STATIC ${LPEGLIB_DIR}/lpcap.c ${LPEGLIB_DIR}/lpcode.c ${LPEGLIB_DIR}/lpprint.c @@ -10,8 +8,5 @@ add_library(LPEGLIB ${LPEGLIB_DIR}/lpvm.c ) -set(EXTRA_LIBS ${EXTRA_LIBS} LPEGLIB) - -add_definitions(-DLUA_LIB -DWITH_LPEG) -remove_definitions(-DNDEBUG) -remove_definitions(-DVERSION) +list(APPEND LUVI_LIBRARIES lpeglib) +list(APPEND LUVI_DEFINITIONS WITH_LPEG=1) diff --git a/deps/lrexlib.cmake b/deps/lrexlib.cmake index 61769215..bcdf194f 100644 --- a/deps/lrexlib.cmake +++ b/deps/lrexlib.cmake @@ -1,17 +1,18 @@ -set(LREXLIB_DIR ${CMAKE_CURRENT_SOURCE_DIR}/deps/lrexlib) +include(deps/pcre.cmake) -include_directories( - ${LREXLIB_DIR}/src -) +set(LREXLIB_DIR "${CMAKE_CURRENT_SOURCE_DIR}/deps/lrexlib" CACHE PATH "Path to lrexlib") -add_library(lrexlib +add_library(lrexlib STATIC ${LREXLIB_DIR}/src/common.c ${LREXLIB_DIR}/src/pcre/lpcre.c ${LREXLIB_DIR}/src/pcre/lpcre_f.c ) -set_target_properties(lrexlib PROPERTIES - COMPILE_FLAGS "-DLUA_LIB -DLUA_COMPAT_APIINTCASTS -DVERSION=\\\"2.8.0\\\"") -target_link_libraries(lrexlib pcre) +target_include_directories(lrexlib PUBLIC ${PCRE_INCLUDE_DIR}) +target_link_libraries(lrexlib ${PCRE_LIBRARIES}) +target_compile_definitions(lrexlib PRIVATE + LUA_COMPAT_APIINTCASTS + VERSION="2.8.0") -set(EXTRA_LIBS ${EXTRA_LIBS} lrexlib) +list(APPEND LUVI_LIBRARIES lrexlib ${PCRE_LIBRARIES}) +list(APPEND LUVI_DEFINITIONS WITH_PCRE=1) diff --git a/deps/lua-openssl.cmake b/deps/lua-openssl.cmake index a3aa4a0f..6cd47fc4 100644 --- a/deps/lua-openssl.cmake +++ b/deps/lua-openssl.cmake @@ -1,7 +1,6 @@ -set(LUA_OPENSSL_DIR ${CMAKE_CURRENT_SOURCE_DIR}/deps/lua-openssl) -if(DEFINED ENV{LUA_OPENSSL_DIR}) - set(LUA_OPENSSL_DIR $ENV{LUA_OPENSSL_DIR}) -endif() +include(deps/openssl.cmake) + +set(LUA_OPENSSL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/deps/lua-openssl" CACHE PATH "Path to lua-openssl") include_directories( ${CMAKE_BINARY_DIR}/include @@ -10,21 +9,14 @@ include_directories( ${LUA_OPENSSL_DIR}/src ) -add_definitions( - -DCOMPAT52_IS_LUAJIT -) - if(WIN32) - add_definitions( - -DWIN32_LEAN_AND_MEAN - -D_CRT_SECURE_NO_WARNINGS - ) + add_compile_definitions(WIN32_LEAN_AND_MEAN) + add_compile_definitions(_CRT_SECURE_NO_WARNINGS) else() find_package(Threads) - add_definitions(-DPTHREADS) endif() -add_library(lua_openssl +add_library(lua_openssl STATIC ${LUA_OPENSSL_DIR}/deps/auxiliar/auxiliar.c ${LUA_OPENSSL_DIR}/deps/auxiliar/subsidiar.c ${LUA_OPENSSL_DIR}/src/asn1.c @@ -40,6 +32,7 @@ add_library(lua_openssl ${LUA_OPENSSL_DIR}/src/dsa.c ${LUA_OPENSSL_DIR}/src/ec.c ${LUA_OPENSSL_DIR}/src/engine.c + ${LUA_OPENSSL_DIR}/src/mac.c ${LUA_OPENSSL_DIR}/src/hmac.c ${LUA_OPENSSL_DIR}/src/kdf.c ${LUA_OPENSSL_DIR}/src/lbn.c @@ -49,6 +42,7 @@ add_library(lua_openssl ${LUA_OPENSSL_DIR}/src/oids.txt ${LUA_OPENSSL_DIR}/src/openssl.c ${LUA_OPENSSL_DIR}/src/ots.c + ${LUA_OPENSSL_DIR}/src/param.c ${LUA_OPENSSL_DIR}/src/pkcs12.c ${LUA_OPENSSL_DIR}/src/pkcs7.c ${LUA_OPENSSL_DIR}/src/pkey.c @@ -67,13 +61,8 @@ add_library(lua_openssl ${LUA_OPENSSL_DIR}/src/xstore.c ) -set_target_properties(lua_openssl PROPERTIES COMPILE_FLAGS "-DLUA_LIB") - -if (WithSharedOpenSSL) - target_link_libraries(lua_openssl ssl crypto) -else (WithSharedOpenSSL) - add_dependencies(lua_openssl openssl) - target_link_libraries(lua_openssl openssl_ssl openssl_crypto) -endif (WithSharedOpenSSL) +target_include_directories(lua_openssl PUBLIC ${OPENSSL_INCLUDE_DIR}) +target_link_libraries(lua_openssl ${OPENSSL_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT}) -set(EXTRA_LIBS ${EXTRA_LIBS} lua_openssl) +list(APPEND LUVI_LIBRARIES lua_openssl ${OPENSSL_LIBRARIES}) +list(APPEND LUVI_DEFINITIONS WITH_OPENSSL=1) diff --git a/deps/lua-zlib.cmake b/deps/lua-zlib.cmake index 15e1f7de..4e1328f0 100644 --- a/deps/lua-zlib.cmake +++ b/deps/lua-zlib.cmake @@ -1,22 +1,14 @@ -set(ZLIB_SHARED z) -set(ZLIB_STATIC zlibstatic) +include(deps/zlib.cmake) -set(LUA_ZLIB_DIR ${CMAKE_CURRENT_SOURCE_DIR}/deps/lua-zlib) +set(LUA_ZLIB_DIR "${CMAKE_CURRENT_SOURCE_DIR}/deps/lua-zlib" CACHE STRING "Path to lua-zlib") -if (WithSharedZLIB) - set(LUA_ZLIB_LIB ${ZLIB_SHARED}) -else () - set(LUA_ZLIB_LIB ${ZLIB_STATIC}) -endif() - -add_library(lua_zlib +add_library(lua_zlib STATIC ${LUA_ZLIB_DIR}/lua_zlib.c ${LUA_ZLIB_DIR}/zlib.def ) -set_target_properties(lua_zlib PROPERTIES COMPILE_FLAGS -DLUA_LIB) - -target_link_libraries(lua_zlib ${LUA_ZLIB_LIB}) - -set(EXTRA_LIBS ${EXTRA_LIBS} lua_zlib) +target_include_directories(lua_zlib PUBLIC ${ZLIB_INCLUDE_DIR}) +target_link_libraries(lua_zlib ${ZLIB_LIBRARIES}) +list(APPEND LUVI_LIBRARIES lua_zlib ${ZLIB_LIBRARIES}) +list(APPEND LUVI_DEFINITIONS WITH_ZLIB=1) diff --git a/deps/openssl.cmake b/deps/openssl.cmake index 01168a3a..d0414a4a 100644 --- a/deps/openssl.cmake +++ b/deps/openssl.cmake @@ -1,70 +1,106 @@ if (WithSharedOpenSSL) find_package(OpenSSL REQUIRED) - message("OpenSSL include dir: ${OPENSSL_INCLUDE_DIR}") - message("OpenSSL libraries: ${OPENSSL_LIBRARIES}") - - include_directories(${OPENSSL_INCLUDE_DIR}) - link_directories(${OPENSSL_ROOT_DIR}/lib) - list(APPEND LIB_LIST ${OPENSSL_LIBRARIES}) + message("Enabling Shared OpenSSL") + message("OPENSSL_INCLUDE_DIR: ${OPENSSL_INCLUDE_DIR}") + message("OPENSSL_LIBRARIES: ${OPENSSL_LIBRARIES}") else (WithSharedOpenSSL) message("Enabling Static OpenSSL") - include(ExternalProject) set(OPENSSL_CONFIG_OPTIONS no-unit-test no-shared no-stdio no-idea no-mdc2 no-rc5 --prefix=${CMAKE_BINARY_DIR}) - if(NOT WithOpenSSLASM) + if (WithOpenSSLASM) + enable_language(ASM) + if (MSVC) + enable_language(ASM_NASM) + endif () + else () set(OPENSSL_CONFIG_OPTIONS no-asm ${OPENSSL_CONFIG_OPTIONS}) - endif() - - if(WIN32) - if("${CMAKE_GENERATOR_PLATFORM}" MATCHES "x64") - set(OPENSSL_CONFIGURE_COMMAND perl ./Configure VC-WIN64A ${OPENSSL_CONFIG_OPTIONS}) - else() - set(OPENSSL_CONFIGURE_COMMAND perl ./Configure VC-WIN32 ${OPENSSL_CONFIG_OPTIONS}) - endif() + endif () + + set(OPENSSL_CONFIGURE_TARGET) + set(OPENSSL_BUILD_COMMAND make) + if (WIN32) + if (MSVC) + set(OPENSSL_CONFIGURE_TARGET VC-WIN32) + if ("${CMAKE_VS_PLATFORM_NAME}" MATCHES "x64") + set(OPENSSL_CONFIGURE_TARGET VC-WIN64A) + endif () set(OPENSSL_BUILD_COMMAND nmake) - else() - set(OPENSSL_CONFIGURE_COMMAND ./config ${OPENSSL_CONFIG_OPTIONS}) - - if(DEFINED $ENV{MAKEFLAGS}) - set(OPENSSL_BUILD_COMMAND make $ENV{MAKEFLAGS}) - else() - set(OPENSSL_BUILD_COMMAND make) - endif() - endif() - - ExternalProject_Add(openssl - PREFIX openssl - URL https://www.openssl.org/source/openssl-1.1.1w.tar.gz - URL_HASH SHA256=cf3098950cb4d853ad95c0841f1f9c6d3dc102dccfcacd521d93925208b76ac8 - LOG_BUILD ON - BUILD_IN_SOURCE YES - BUILD_COMMAND ${OPENSSL_BUILD_COMMAND} - CONFIGURE_COMMAND ${OPENSSL_CONFIGURE_COMMAND} - INSTALL_COMMAND "" - TEST_COMMAND "" + elseif (MINGW) + set(OPENSSL_CONFIGURE_TARGET mingw) + if ("${CMAKE_SIZEOF_VOID_P}" EQUAL "8") + set(OPENSSL_CONFIGURE_TARGET mingw64) + endif () + + set(OPENSSL_BUILD_COMMAND mingw32-make) + else () + # TODO: Add support for other Windows compilers + message(FATAL_ERROR "This platform does not support building OpenSSL") + endif () + endif () + + message("OPENSSL_CONFIGURE_TARGET: ${OPENSSL_CONFIGURE_TARGET}") + message("OPENSSL_CONFIG_OPTIONS: ${OPENSSL_CONFIG_OPTIONS}") + message("OPENSSL_BUILD_COMMAND: ${OPENSSL_BUILD_COMMAND}") + include(FetchContent) + + FetchContent_Declare(openssl + URL https://github.com/openssl/openssl/releases/download/openssl-3.0.14/openssl-3.0.14.tar.gz + URL_HASH SHA256=eeca035d4dd4e84fc25846d952da6297484afa0650a6f84c682e39df3a4123ca ) - set(OPENSSL_DIR ${CMAKE_BINARY_DIR}/openssl/src/openssl) - set(OPENSSL_INCLUDE ${OPENSSL_DIR}/include) + FetchContent_MakeAvailable(openssl) + FetchContent_GetProperties(openssl) - if(WIN32) - set(OPENSSL_LIB_CRYPTO ${OPENSSL_DIR}/libcrypto.lib) - set(OPENSSL_LIB_SSL ${OPENSSL_DIR}/libssl.lib) - else() - set(OPENSSL_LIB_CRYPTO ${OPENSSL_DIR}/libcrypto.a) - set(OPENSSL_LIB_SSL ${OPENSSL_DIR}/libssl.a) - endif() + set(OPENSSL_ROOT_DIR ${openssl_SOURCE_DIR}) + + # Configure OpenSSL + + execute_process( + COMMAND perl Configure ${OPENSSL_CONFIGURE_TARGET} ${OPENSSL_CONFIG_OPTIONS} + WORKING_DIRECTORY ${OPENSSL_ROOT_DIR} + RESULT_VARIABLE result + ) + + if (result) + message(FATAL_ERROR "Failed to configure OpenSSL") + endif () + + execute_process( + COMMAND perl configdata.pm --dump + WORKING_DIRECTORY ${OPENSSL_ROOT_DIR} + ) + + if (MSVC) + set(OPENSSL_LIB_CRYPTO ${OPENSSL_ROOT_DIR}/libcrypto.lib) + set(OPENSSL_LIB_SSL ${OPENSSL_ROOT_DIR}/libssl.lib) + else () + set(OPENSSL_LIB_CRYPTO ${OPENSSL_ROOT_DIR}/libcrypto.a) + set(OPENSSL_LIB_SSL ${OPENSSL_ROOT_DIR}/libssl.a) + endif () + + # Build OpenSSL + + add_custom_target(openssl-build + COMMAND ${OPENSSL_BUILD_COMMAND} + BYPRODUCTS ${OPENSSL_LIB_CRYPTO} ${OPENSSL_LIB_SSL} + WORKING_DIRECTORY ${OPENSSL_ROOT_DIR} + USES_TERMINAL + ) + + # Define OpenSSL libraries add_library(openssl_ssl STATIC IMPORTED) set_target_properties(openssl_ssl PROPERTIES IMPORTED_LOCATION ${OPENSSL_LIB_SSL}) + add_dependencies(openssl_ssl openssl-build) + add_library(openssl_crypto STATIC IMPORTED) set_target_properties(openssl_crypto PROPERTIES IMPORTED_LOCATION ${OPENSSL_LIB_CRYPTO}) + add_dependencies(openssl_ssl openssl-build) - include_directories(${OPENSSL_INCLUDE}) - list(APPEND LIB_LIST openssl_ssl openssl_crypto) -endif (WithSharedOpenSSL) - -add_definitions(-DWITH_OPENSSL) -include(deps/lua-openssl.cmake) + set(OPENSSL_INCLUDE_DIR ${OPENSSL_ROOT_DIR}/include) + set(OPENSSL_LIBRARIES openssl_ssl openssl_crypto) + message("OPENSSL_INCLUDE_DIR: ${OPENSSL_INCLUDE_DIR}") + message("OPENSSL_LIBRARIES: ${OPENSSL_LIBRARIES}") +endif (WithSharedOpenSSL) diff --git a/deps/pcre.cmake b/deps/pcre.cmake index eedfb037..fd0b0123 100644 --- a/deps/pcre.cmake +++ b/deps/pcre.cmake @@ -1,26 +1,30 @@ - if (WithSharedPCRE) find_package(PCRE REQUIRED) - message("PCRE include dir: ${PCRE_INCLUDE_DIR}") - message("PCRE libraries: ${PCRE_LIBRARIES}") - include_directories(${PCRE_INCLUDE_DIR}) - link_directories(${PCRE_ROOT_DIR}/lib) - list(APPEND LIB_LIST ${PCRE_LIBRARIES}) + + message("Enabling Shared PCRE") + message("PCRE_INCLUDE_DIR: ${PCRE_INCLUDE_DIR}") + message("PCRE_LIBRARIES: ${PCRE_LIBRARIES}") else (WithSharedPCRE) - SET(PCRE_MATCH_LIMIT "150000" CACHE STRING + message("Enabling Static PCRE") + + set(PCRE_MATCH_LIMIT "150000" CACHE STRING "Default limit on internal looping. See MATCH_LIMIT in config.h.in for details.") - OPTION(PCRE_BUILD_PCREGREP "Build pcregrep" OFF) - OPTION(PCRE_BUILD_TESTS "Build the tests" OFF) - OPTION(PCRE_BUILD_PCRECPP "Build the PCRE C++ library (pcrecpp)." OFF) - SET(PCRE_SUPPORT_UTF ON CACHE BOOL + option(PCRE_BUILD_PCREGREP "Build pcregrep" OFF) + option(PCRE_BUILD_TESTS "Build the tests" OFF) + option(PCRE_BUILD_PCRECPP "Build the PCRE C++ library (pcrecpp)." OFF) + set(PCRE_SUPPORT_UTF ON CACHE BOOL "Enable support for Unicode Transformation Format (UTF-8/UTF-16/UTF-32) encoding.") - include_directories(${CMAKE_BINARY_DIR}/deps/pcre) + set(BUILD_SHARED_LIBS OFF) + add_compile_definitions(PCRE_STATIC) + add_subdirectory(deps/pcre) - message("Enabling Static PCRE") - list(APPEND EXTRA_LIBS pcre) - add_definitions(-DPCRE_STATIC) -endif (WithSharedPCRE) -add_definitions(-DWITH_PCRE) -include(deps/lrexlib.cmake) + set(PCRE_INCLUDE_DIR ${CMAKE_BINARY_DIR}/deps/pcre) + set(PCRE_LIBRARIES pcre) + + message("PCRE_INCLUDE_DIR: ${PCRE_INCLUDE_DIR}") + message("PCRE_LIBRARIES: ${PCRE_LIBRARIES}") + + mark_as_advanced(PCRE_MATCH_LIMIT PCRE_BUILD_PCREGREP PCRE_BUILD_TESTS PCRE_BUILD_PCRECPP PCRE_SUPPORT_UTF) +endif (WithSharedPCRE) diff --git a/deps/zlib.cmake b/deps/zlib.cmake index c5255af5..97035731 100644 --- a/deps/zlib.cmake +++ b/deps/zlib.cmake @@ -1,17 +1,16 @@ if (WithSharedZLIB) find_package(ZLIB REQUIRED) - message("ZLIB include dir: ${ZLIB_INCLUDE_DIR}") - message("ZLIB libraries: ${ZLIB_LIBRARIES}") - - include_directories(${ZLIB_INCLUDE_DIR}) - link_directories(${ZLIB_ROOT_DIR}/lib) + message("Enabling Shared ZLIB") + message("ZLIB_INCLUDE_DIR: ${ZLIB_INCLUDE_DIR}") + message("ZLIB_LIBRARIES: ${ZLIB_LIBRARIES}") else (WithSharedZLIB) message("Enabling Static ZLIB") add_subdirectory(deps/zlib) - include_directories(deps/zlib) - include_directories(build/deps/zlib) -endif (WithSharedZLIB) -add_definitions(-DWITH_ZLIB) -include(deps/lua-zlib.cmake) + set(ZLIB_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/deps/zlib ${CMAKE_BINARY_DIR}/deps/zlib) + set(ZLIB_LIBRARIES zlibstatic) + + message("ZLIB_INCLUDE_DIR: ${ZLIB_INCLUDE_DIR}") + message("ZLIB_LIBRARIES: ${ZLIB_LIBRARIES}") +endif (WithSharedZLIB) diff --git a/make.bat b/make.bat deleted file mode 100644 index 9ed65134..00000000 --- a/make.bat +++ /dev/null @@ -1,165 +0,0 @@ -@ECHO off - -set LUVI_PUBLISH_USER=luvit -set LUVI_PUBLISH_REPO=luvi - -set GENERATOR=Visual Studio 12 -reg query HKEY_CLASSES_ROOT\VisualStudio.DTE.14.0 >nul 2>nul -IF %errorlevel%==0 set GENERATOR=Visual Studio 14 -reg query HKEY_CLASSES_ROOT\VisualStudio.DTE.15.0 >nul 2>nul -IF %errorlevel%==0 set GENERATOR=Visual Studio 15 -reg query HKEY_CLASSES_ROOT\VisualStudio.DTE.16.0 >nul 2>nul -IF %errorlevel%==0 set GENERATOR=Visual Studio 16 -reg query HKEY_CLASSES_ROOT\VisualStudio.DTE.17.0 >nul 2>nul -IF %errorlevel%==0 set GENERATOR=Visual Studio 17 - -for /f %%i in ('git describe --tags') do set LUVI_TAG=%%i -IF NOT "x%1" == "x" GOTO :%1 - -GOTO :build - -:regular -ECHO "Building regular64" -cmake -DWithOpenSSL=ON -DWithSharedOpenSSL=OFF -DWithPCRE=ON -DWithLPEG=ON -DWithSharedPCRE=OFF -H. -Bbuild -G"%GENERATOR%" -Ax64 -GOTO :end - -:regular-asm -ECHO "Building regular64 asm" -cmake -DWithOpenSSLASM=ON -DWithOpenSSL=ON -DWithSharedOpenSSL=OFF -DWithPCRE=ON -DWithLPEG=ON -DWithSharedPCRE=OFF -H. -Bbuild -G"%GENERATOR%" -Ax64 -GOTO :end - -:regular32 -ECHO "Building regular32" -cmake -DWithOpenSSL=ON -DWithSharedOpenSSL=OFF -DWithPCRE=ON -DWithLPEG=ON -DWithSharedPCRE=OFF -H. -Bbuild -G"%GENERATOR%" -AWin32 -GOTO :end - -:regular32-asm -ECHO "Building regular32 asm" -cmake -DWithOpenSSLASM=ON -DWithOpenSSL=ON -DWithSharedOpenSSL=OFF -DWithPCRE=ON -DWithLPEG=ON -DWithSharedPCRE=OFF -H. -Bbuild -G"%GENERATOR%" -AWin32 -GOTO :end - -:tiny -ECHO "Building tiny64" -cmake -H. -Bbuild -G"%GENERATOR%" -Ax64 -GOTO :end - -:tiny32 -ECHO "Building tiny32" -cmake -H. -Bbuild -G"%GENERATOR%" -AWin32 -GOTO :end - -:build -IF NOT EXIST build CALL Make.bat regular -cmake --build build --config Release -- /maxcpucount -COPY build\Release\luvi.exe . -GOTO :end - -:test -IF NOT EXIST luvi.exe CALL Make.bat -luvi.exe samples\test.app -- 1 2 3 4 -luvi.exe samples\test.app -o test.exe -test.exe 1 2 3 4 -DEL /Q test.exe -GOTO :end - -:winsvc -IF NOT EXIST luvi.exe CALL Make.bat -DEL /Q winsvc.exe -luvi.exe samples\winsvc.app -o winsvc.exe -GOTO :end - -:repl -IF NOT EXIST luvi.exe CALL Make.bat -DEL /Q repl.exe -luvi.exe samples/repl.app -o repl.exe -GOTO :end - - -:clean -IF EXIST build RMDIR /S /Q build -IF EXIST luvi.exe DEL /F /Q luvi.exe -GOTO :end - -:reset -git submodule update --init --recursive -git clean -f -d -git checkout . -GOTO :end - -:artifacts-tiny -IF NOT EXIST artifacts MKDIR artifacts -COPY build\Release\luvi.exe artifacts\luvi-tiny-Windows-amd64.exe -COPY build\Release\luvi.lib artifacts\luvi-tiny-Windows-amd64.lib -COPY build\Release\luvi_renamed.lib artifacts\luvi_renamed-tiny-Windows-amd64.lib -GOTO :end - -:artifacts-tiny32 -IF NOT EXIST artifacts MKDIR artifacts -COPY build\Release\luvi.exe artifacts\luvi-tiny-Windows-ia32.exe -COPY build\Release\luvi.lib artifacts\luvi-tiny-Windows-ia32.lib -COPY build\Release\luvi_renamed.lib artifacts\luvi_renamed-tiny-Windows-ia32.lib -GOTO :end - -:artifacts-regular -:artifacts-regular-asm -IF NOT EXIST artifacts MKDIR artifacts -COPY build\Release\luvi.exe artifacts\luvi-regular-Windows-amd64.exe -COPY build\Release\luvi.lib artifacts\luvi-regular-Windows-amd64.lib -COPY build\Release\luvi_renamed.lib artifacts\luvi_renamed-regular-Windows-amd64.lib -GOTO :end - -:artifacts-regular32 -:artifacts-regular32-asm -IF NOT EXIST artifacts MKDIR artifacts -COPY build\Release\luvi.exe artifacts\luvi-regular-Windows-ia32.exe -COPY build\Release\luvi.lib artifacts\luvi-regular-Windows-ia32.lib -COPY build\Release\luvi_renamed.lib artifacts\luvi_renamed-regular-Windows-ia32.lib -GOTO :end - -:publish-tiny -CALL make.bat reset -CALL make.bat tiny -CALL make.bat test -github-release upload --user %LUVI_PUBLISH_USER% --repo %LUVI_PUBLISH_REPO% --tag %LUVI_TAG% --file luvi.exe --name luvi-tiny-Windows-amd64.exe -github-release upload --user %LUVI_PUBLISH_USER% --repo %LUVI_PUBLISH_REPO% --tag %LUVI_TAG% --file build\Release\luvi.lib --name luvi-tiny-Windows-amd64.lib -github-release upload --user %LUVI_PUBLISH_USER% --repo %LUVI_PUBLISH_REPO% --tag %LUVI_TAG% --file build\Release\luvi_renamed.lib --name luvi_renamed-tiny-Windows-amd64.lib -GOTO :end - -:publish-tiny32 -CALL make.bat reset -CALL make.bat tiny32 -CALL make.bat test -github-release upload --user %LUVI_PUBLISH_USER% --repo %LUVI_PUBLISH_REPO% --tag %LUVI_TAG% --file luvi.exe --name luvi-tiny-Windows-ia32.exe -github-release upload --user %LUVI_PUBLISH_USER% --repo %LUVI_PUBLISH_REPO% --tag %LUVI_TAG% --file build\Release\luvi.lib --name luvi-tiny-Windows-ia32.lib -github-release upload --user %LUVI_PUBLISH_USER% --repo %LUVI_PUBLISH_REPO% --tag %LUVI_TAG% --file build\Release\luvi_renamed.lib --name luvi_renamed-tiny-Windows-ia32.lib -GOTO :end - -:publish-regular -CALL make.bat reset -CALL make.bat regular-asm -CALL make.bat test -github-release upload --user %LUVI_PUBLISH_USER% --repo %LUVI_PUBLISH_REPO% --tag %LUVI_TAG% --file luvi.exe --name luvi-regular-Windows-amd64.exe -github-release upload --user %LUVI_PUBLISH_USER% --repo %LUVI_PUBLISH_REPO% --tag %LUVI_TAG% --file build\Release\luvi.lib --name luvi-regular-Windows-amd64.lib -github-release upload --user %LUVI_PUBLISH_USER% --repo %LUVI_PUBLISH_REPO% --tag %LUVI_TAG% --file build\Release\luvi_renamed.lib --name luvi_renamed-regular-Windows-amd64.lib -GOTO :end - -:publish-regular32 -CALL make.bat reset -CALL make.bat regular32-asm -CALL make.bat test -github-release upload --user %LUVI_PUBLISH_USER% --repo %LUVI_PUBLISH_REPO% --tag %LUVI_TAG% --file luvi.exe --name luvi-regular-Windows-ia32.exe -github-release upload --user %LUVI_PUBLISH_USER% --repo %LUVI_PUBLISH_REPO% --tag %LUVI_TAG% --file build\Release\luvi.lib --name luvi-regular-Windows-ia32.lib -github-release upload --user %LUVI_PUBLISH_USER% --repo %LUVI_PUBLISH_REPO% --tag %LUVI_TAG% --file build\Release\luvi_renamed.lib --name luvi_renamed-regular-Windows-ia32.lib -GOTO :end - -:publish -CALL make.bat clean -CALL make.bat publish-tiny -CALL make.bat clean -CALL make.bat publish-tiny32 -CALL make.bat clean -CALL make.bat publish-regular -CALL make.bat clean -CALL make.bat publish-regular32 - -:end From b39122b50930252449f466569a8e856cb334f718 Mon Sep 17 00:00:00 2001 From: Nameless Date: Fri, 21 Jun 2024 13:24:08 -0500 Subject: [PATCH 02/11] prepare luvi for plain lua 5.3+ --- src/luvi.h | 10 +++++++- src/luvi_compat.c | 4 ++++ src/main.c | 59 +++++++++++++++++++---------------------------- src/winsvc.c | 25 +++++++++++--------- src/winsvcaux.c | 7 ++++-- 5 files changed, 56 insertions(+), 49 deletions(-) diff --git a/src/luvi.h b/src/luvi.h index 6f500d1a..382d05fa 100644 --- a/src/luvi.h +++ b/src/luvi.h @@ -33,7 +33,7 @@ #include #endif -#if (LUA_VERSION_NUM!=503) +#if (LUA_VERSION_NUM < 503) #include "compat-5.3.h" #endif @@ -42,6 +42,7 @@ #endif #ifdef WITH_PCRE #include "pcre.h" +int luaopen_rex_pcre(lua_State* L); #endif #ifdef WITH_ZLIB #include "zlib.h" @@ -54,7 +55,14 @@ LUALIB_API int luaopen_zlib(lua_State * const L); #ifdef WITH_LPEG int luaopen_lpeg(lua_State* L); #endif +#ifdef WITH_PLAIN_LUA +LUALIB_API int luaopen_bit(lua_State *L); +#endif void luvi_openlibs(lua_State *L); + +LUALIB_API int luaopen_init(lua_State *L); +LUALIB_API int luaopen_luvibundle(lua_State *L); +LUALIB_API int luaopen_luvipath(lua_State *L); #endif diff --git a/src/luvi_compat.c b/src/luvi_compat.c index b5899f17..45cb30a7 100644 --- a/src/luvi_compat.c +++ b/src/luvi_compat.c @@ -24,6 +24,10 @@ #endif #endif +#ifdef WITH_PLAIN_LUA +#include "../deps/bit.c" +#endif + void luvi_openlibs(lua_State *L) { luaL_openlibs(L); #if (LUA_VERSION_NUM < 503) diff --git a/src/main.c b/src/main.c index 62fa6c9f..86fb0091 100644 --- a/src/main.c +++ b/src/main.c @@ -25,12 +25,6 @@ #endif #include "lminiz.c" #include "snapshot.c" -#ifdef WITH_PCRE -int luaopen_rex_pcre(lua_State* L); -#endif -#ifdef WITH_PLAIN_LUA -#include "../deps/bit.c" -#endif #ifdef WITH_CUSTOM int luvi_custom(lua_State* L); @@ -70,9 +64,13 @@ static lua_State* vm_acquire(){ lua_getfield(L, -1, "loaded"); // load luv into uv in advance so that the metatables for async work. - lua_pushcfunction(L, luaopen_luv); - lua_call(L, 0, 1); - lua_setfield(L, -2, "uv"); + luaL_requiref(L, "uv", luaopen_luv, 0); + lua_setfield(L, -2, "luv"); + +#ifdef WITH_PLAIN_LUA + luaL_requiref(L, "bit", luaopen_bit, 1); + lua_pop(L, 1); +#endif // remove package.loaded lua_remove(L, -1); @@ -102,10 +100,6 @@ static lua_State* vm_acquire(){ lua_setfield(L, -2, "rex"); #endif - // Store luvi module definition at preload.luvi - lua_pushcfunction(L, luaopen_luvi); - lua_setfield(L, -2, "luvi"); - #ifdef WITH_OPENSSL // Store openssl module definition at preload.openssl lua_pushcfunction(L, luaopen_openssl); @@ -118,22 +112,25 @@ static lua_State* vm_acquire(){ lua_setfield(L, -2, "zlib"); #endif -#ifdef WITH_PLAIN_LUA - { - LUALIB_API int luaopen_init(lua_State *L); - LUALIB_API int luaopen_luvibundle(lua_State *L); - LUALIB_API int luaopen_luvipath(lua_State *L); - lua_pushcfunction(L, luaopen_init); - lua_setfield(L, -2, "init"); - lua_pushcfunction(L, luaopen_luvibundle); - lua_setfield(L, -2, "luvibundle"); - lua_pushcfunction(L, luaopen_luvipath); - lua_setfield(L, -2, "luvipath"); - luaL_requiref(L, "bit", luaopen_bit, 1); - lua_pop(L, 1); - } +#ifdef WITH_WINSVC + // Store luvi module definition at preload.winsvc + lua_pushcfunction(L, luaopen_winsvc); + lua_setfield(L, -2, "winsvc"); + lua_pushcfunction(L, luaopen_winsvcaux); + lua_setfield(L, -2, "winsvcaux"); #endif + // Store luvi module definition at preload.luvi + lua_pushcfunction(L, luaopen_luvi); + lua_setfield(L, -2, "luvi"); + + lua_pushcfunction(L, luaopen_init); + lua_setfield(L, -2, "init"); + lua_pushcfunction(L, luaopen_luvibundle); + lua_setfield(L, -2, "luvibundle"); + lua_pushcfunction(L, luaopen_luvipath); + lua_setfield(L, -2, "luvipath"); + #ifdef WITH_CUSTOM luvi_custom(L); #endif @@ -162,14 +159,6 @@ int main(int argc, char* argv[] ) { return 1; } -#ifdef WITH_WINSVC - // Store luvi module definition at preload.openssl - lua_pushcfunction(L, luaopen_winsvc); - lua_setfield(L, -2, "winsvc"); - lua_pushcfunction(L, luaopen_winsvcaux); - lua_setfield(L, -2, "winsvcaux"); -#endif - /* push debug function */ lua_pushcfunction(L, luvi_traceback); errfunc = lua_gettop(L); diff --git a/src/winsvc.c b/src/winsvc.c index cbc1dc24..a661562c 100644 --- a/src/winsvc.c +++ b/src/winsvc.c @@ -20,6 +20,9 @@ #include #include #include +#if (LUA_VERSION_NUM < 503) +#include "compat-5.3.h" +#endif typedef struct { SERVICE_TABLE_ENTRY* svc_table; @@ -100,7 +103,7 @@ static void svchandler_cb(uv_async_t* handle) { lua_pushlightuserdata(L, baton->block.lpEventData); lua_pushlightuserdata(L, baton->block.lpContext); if (lua_pcall(L, 4, 1, -6) == 0) { - baton->block.return_code = luaL_checkint(L, -1); + baton->block.return_code = luaL_checkinteger(L, -1); } else { baton->block.return_code = ERROR; @@ -253,7 +256,7 @@ static int lua_SetServiceStatus(lua_State *L) { static int lua_ControlService(lua_State *L) { SERVICE_STATUS status; SC_HANDLE SvcCtrlHandler = lua_touserdata(L, 1); - DWORD dwControl = luaL_checkint(L, 2); + DWORD dwControl = luaL_checkinteger(L, 2); BOOL set = ControlService(SvcCtrlHandler, dwControl, (LPSERVICE_STATUS)&status); lua_pushboolean(L, set); @@ -420,7 +423,7 @@ static int lua_SpawnServiceCtrlDispatcher(lua_State *L) { static int lua_OpenSCManager(lua_State *L) { const char* machinename = lua_tostring(L, 1); const char* databasename = lua_tostring(L, 2); - DWORD access = luaL_checkint(L, 3); + DWORD access = luaL_checkinteger(L, 3); SC_HANDLE h = OpenSCManager(machinename, databasename, access); if (h != NULL) { lua_pushlightuserdata(L, h); @@ -435,7 +438,7 @@ static int lua_OpenService(lua_State *L) { SC_HANDLE hSCManager = lua_touserdata(L, 1); const char* servicename = luaL_checkstring(L, 2); - DWORD access = luaL_checkint(L, 3); + DWORD access = luaL_checkinteger(L, 3); SC_HANDLE h = OpenService(hSCManager, servicename, access); if (h != NULL) { lua_pushlightuserdata(L, h); @@ -450,10 +453,10 @@ static int lua_CreateService(lua_State *L) { SC_HANDLE hSCManager = lua_touserdata(L, 1); const char* servicename = luaL_checkstring(L, 2); const char* displayname = luaL_checkstring(L, 3); - DWORD access = luaL_checkint(L, 4); - DWORD servicetype = luaL_checkint(L, 5); - DWORD starttype = luaL_checkint(L, 6); - DWORD errorcontrol = luaL_checkint(L, 7); + DWORD access = luaL_checkinteger(L, 4); + DWORD servicetype = luaL_checkinteger(L, 5); + DWORD starttype = luaL_checkinteger(L, 6); + DWORD errorcontrol = luaL_checkinteger(L, 7); const char* pathname = luaL_checkstring(L, 8); const char* loadordergroup = lua_tostring(L, 9); DWORD tagid = 0; @@ -497,7 +500,7 @@ static int lua_DeleteService(lua_State *L) { static int lua_ChangeServiceConfig2(lua_State *L) { SC_HANDLE h = lua_touserdata(L, 1); - DWORD dwInfoLevel = luaL_checkint(L, 2); + DWORD dwInfoLevel = luaL_checkinteger(L, 2); union { SERVICE_DESCRIPTION description; SERVICE_FAILURE_ACTIONS failure_actions; @@ -534,7 +537,7 @@ static int lua_ChangeServiceConfig2(lua_State *L) { lua_pushstring(L, "lpsaActions"); lua_gettable(L, -2); if (lua_type(L, -1) == LUA_TTABLE) { - info.failure_actions.cActions = lua_objlen(L, -1); + info.failure_actions.cActions = lua_rawlen(L, -1); if (info.failure_actions.cActions) { info.failure_actions.lpsaActions = LocalAlloc(LPTR, sizeof(SC_ACTION) * info.failure_actions.cActions); } @@ -626,7 +629,7 @@ static const luaL_Reg winsvclib[] = { ** Open Windows service library */ LUALIB_API int luaopen_winsvc(lua_State *L) { - luaL_register(L, "winsvc", winsvclib); + luaL_newlib(L, winsvclib); // Some Windows Defines SETINT(ERROR); diff --git a/src/winsvcaux.c b/src/winsvcaux.c index b9f252bb..224ab29d 100644 --- a/src/winsvcaux.c +++ b/src/winsvcaux.c @@ -16,6 +16,9 @@ */ #define LUA_LIB #include "luvi.h" +#if (LUA_VERSION_NUM < 503) +#include "compat-5.3.h" +#endif #include @@ -36,7 +39,7 @@ static int lua_GetModuleFileName(lua_State *L) static int lua_GetErrorString(lua_State *L) { - DWORD err = luaL_checkint(L, 1); + DWORD err = luaL_checkinteger(L, 1); LPTSTR lpMsgBuf = NULL; DWORD len = FormatMessage( @@ -73,6 +76,6 @@ static const luaL_Reg winsvcauxlib[] = { ** Open Windows Service Aux library */ LUALIB_API int luaopen_winsvcaux(lua_State *L) { - luaL_register(L, "winsvcaux", winsvcauxlib); + luaL_newlib(L, winsvcauxlib); return 1; } From 25c274e7388b66fdb8c0883e5d183d25af53f186 Mon Sep 17 00:00:00 2001 From: Nameless Date: Fri, 21 Jun 2024 13:26:06 -0500 Subject: [PATCH 03/11] ci: update to new configuration, more builds --- .github/workflows/ci.yml | 274 +++++++++++++++++++++++++++++------- packaging/Dockerfile.in | 8 -- packaging/docker-build.sh | 38 ----- packaging/holy-build.sh | 27 ---- packaging/linux-build.sh | 41 ++++++ packaging/linux-run.sh | 25 ++++ packaging/macosx/Icons.icns | Bin 43112 -> 0 bytes packaging/macosx/Info.plist | 38 ----- 8 files changed, 293 insertions(+), 158 deletions(-) delete mode 100644 packaging/Dockerfile.in delete mode 100755 packaging/docker-build.sh delete mode 100755 packaging/holy-build.sh create mode 100644 packaging/linux-build.sh create mode 100644 packaging/linux-run.sh delete mode 100644 packaging/macosx/Icons.icns delete mode 100644 packaging/macosx/Info.plist diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 826dee91..7b0b4b3b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -3,25 +3,28 @@ name: CI on: [push, pull_request] jobs: - build: + build-posix: runs-on: ${{ matrix.os }} strategy: + fail-fast: false matrix: - os: [macos-latest, ubuntu-latest] - build_type: [tiny, regular-asm] + os: [macos-13, macos-latest] + build_type: [tiny, regular] lua_engine: [LuaJIT, Lua] env: - BUILD_TYPE: ${{ matrix.build_type }} - WITH_LUA_ENGINE: ${{ matrix.lua_engine }} - NPROCS: 1 + MAKEFLAGS: -j4 + NPROCS: 4 + CFLAGS: -I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include -L/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib -Wno-nullability-completeness steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 with: + fetch-depth: 0 submodules: recursive - name: Configure - run: WITHOUT_AMALG=1 make ${BUILD_TYPE} WITH_LUA_ENGINE=${WITH_LUA_ENGINE} + run: | + make ${{ matrix.build_type }} WITH_LUA_ENGINE=${{ matrix.lua_engine }} - name: Build run: make @@ -29,59 +32,236 @@ jobs: - name: Test run: make test - deploy-linux: - if: startsWith(github.ref, 'refs/tags/') - needs: [build] + - name: Fetch System Name + run: | + OS=$(uname -s) + ARCH=$(uname -m) + LUA=${{ matrix.lua_engine }} + BUILD=${{ matrix.build_type }} + + echo "ARTIFACT=$OS-$ARCH-$(echo $LUA | awk '{print tolower($0)}')-$BUILD" >> $GITHUB_ENV + + - name: Rename Artifacts + run: | + cp build/luvi luvi-${{ env.ARTIFACT }} + + - name: Publish Artifacts + uses: actions/upload-artifact@v4 + with: + name: ${{ env.ARTIFACT }} + path: | + luvi-${{ env.ARTIFACT }} + + build-linux: runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + build_type: [tiny, regular] + lua_engine: [LuaJIT, Lua] + arch: [x86_64, i686, aarch64] + libc: [glibc, musl] + env: + MAKEFLAGS: -j4 + NPROCS: 4 + steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 with: + fetch-depth: 0 submodules: recursive - - name: Fetch - run: git fetch --unshallow --no-recurse-submodules + - name: Setup QEMU + if: matrix.arch == 'aarch64' + run: | + sudo apt-get install -y qemu-user-static - name: Build - run: make linux-build + run: | + bash packaging/linux-run.sh ${{ matrix.libc }} ${{ matrix.arch }} ${{ matrix.build_type }} ${{ matrix.lua_engine }} + + - name: Fetch System Name + run: | + OS=$(uname -s) + ARCH=${{ matrix.arch }} + LUA=${{ matrix.lua_engine }} + BUILD=${{ matrix.build_type }} + if [ ${{ matrix.libc }} == "glibc" ]; then + LIBC="" + else + LIBC=-${{ matrix.libc }} + fi + + echo "ARTIFACT=$OS-$ARCH-${LUA,,}-$BUILD$LIBC" >> $GITHUB_ENV + + - name: Rename Artifacts + run: | + cp build/luvi luvi-${{ env.ARTIFACT }} - - name: Github Release - id: create_release - uses: softprops/action-gh-release@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Publish Artifacts + uses: actions/upload-artifact@v4 with: - files: | - luvi-regular-Linux_x86_64 - luvi-tiny-Linux_x86_64 - luvi-regular-Linux_i686 - luvi-tiny-Linux_i686 - draft: false - prerelease: false - - deploy-macos: - if: startsWith(github.ref, 'refs/tags/') - needs: [build] - runs-on: macos-latest + name: ${{ env.ARTIFACT }} + path: | + luvi-${{ env.ARTIFACT }} + + build-mingw: + runs-on: windows-latest + strategy: + fail-fast: false + matrix: + build_type: [tiny, regular] + lua_engine: [LuaJIT, Lua] + msystem: [mingw32, mingw64] + env: + MAKEFLAGS: -j4 + NPROCS: 4 + steps: - - uses: actions/checkout@v2 + - name: 'Setup MSYS2' + uses: msys2/setup-msys2@v2 + with: + msystem: ${{ matrix.msystem }} + update: true + pacboy: toolchain:p cmake:p + install: git + + - name: Install NASM + if: matrix.build_type == 'regular' + run: | + choco install nasm + echo "C:\Program Files\NASM" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append + + - uses: actions/checkout@v4 with: + fetch-depth: 0 submodules: recursive - - name: Fetch - run: git fetch --unshallow --no-recurse-submodules + - name: Configure + shell: msys2 {0} + run: mingw32-make ${{ matrix.build_type }} WITH_LUA_ENGINE=${{ matrix.lua_engine }} GENERATOR="MinGW Makefiles" - name: Build - run: make travis-publish + shell: msys2 {0} + run: mingw32-make + + - name: Test + shell: msys2 {0} + run: mingw32-make test + + - name: Fetch System Name + run: | + $MSYSTEM="${{ matrix.msystem }}" + $LUA="${{ matrix.lua_engine }}" + $BUILD="${{ matrix.build_type }}" + + echo "ARTIFACT=Windows-$MSYSTEM-$($LUA.ToLower())-$BUILD" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append + + - name: Rename Artifacts + run: | + cp build/luvi.exe luvi-${{ env.ARTIFACT }}.exe + + - name: Publish Artifacts + uses: actions/upload-artifact@v4 + with: + name: ${{ env.ARTIFACT }} + path: luvi-${{ env.ARTIFACT }}.exe + + build-msvc: + runs-on: windows-latest + strategy: + fail-fast: false + matrix: + build_type: [tiny, regular] + lua_engine: [LuaJIT, Lua] + arch: [amd64, x86] + + steps: + - name: Setup MSVC Developer Prompt + uses: ilammy/msvc-dev-cmd@v1 + with: + arch: ${{ matrix.arch }} + + - name: Install NASM + if: matrix.build_type == 'regular' + run: | + choco install nasm + echo "C:\Program Files\NASM" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append + + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + submodules: recursive + + - name: Configure + run: nmake ${{ matrix.build_type }} WITH_LUA_ENGINE=${{ matrix.lua_engine }} + + - name: Build + run: nmake + + - name: Test + run: nmake test + + - name: Fetch System Name + run: | + $ARCH="${{ matrix.arch }}" + $LUA="${{ matrix.lua_engine }}" + $BUILD="${{ matrix.build_type }}" + + echo "ARTIFACT=Windows-$ARCH-$($LUA.ToLower())-$BUILD" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append + + - name: Rename Artifacts + run: | + cp build/Release/luvi.exe build/luvi-${{ env.ARTIFACT }}.exe + cp build/Release/luvi.lib build/luvi-${{ env.ARTIFACT }}.lib + cp build/Release/luvi_renamed.lib build/luvi-${{ env.ARTIFACT }}_renamed.lib + + - name: Publish Artifacts + uses: actions/upload-artifact@v4 + with: + name: ${{ env.ARTIFACT }} + path: | + build/luvi-${{ env.ARTIFACT }}* + + package-source: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + submodules: recursive + + - name: Package Source + run: | + git describe --tags > VERSION + touch deps/luv/deps/luajit/src/luajit_relver.txt + + tar -czvf /tmp/luvi-source.tar.gz --exclude-vcs --exclude 'git*' . + + - name: Publish Source + uses: actions/upload-artifact@v4 + with: + name: luvi-source + path: /tmp/luvi-source.tar.gz + + publish: + needs: [build-posix, build-linux, build-mingw, build-msvc, package-source] + runs-on: ubuntu-latest + steps: + - name: Download Artifacts + uses: actions/download-artifact@v4 + with: + path: download + merge-multiple: true + + - name: Publish Artifact + uses: actions/upload-artifact@v4 + with: + name: artifacts + path: download - - name: Github Release - id: create_release - uses: softprops/action-gh-release@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Create Release + if: startsWith(github.ref, 'refs/tags/') + uses: softprops/action-gh-release@v2 with: - files: | - luvi-regular-Darwin_x86_64 - luvi-tiny-Darwin_x86_64 - luvi-src-*.tar.gz - draft: false - prerelease: false + files: download/* \ No newline at end of file diff --git a/packaging/Dockerfile.in b/packaging/Dockerfile.in deleted file mode 100644 index 2d36bb2a..00000000 --- a/packaging/Dockerfile.in +++ /dev/null @@ -1,8 +0,0 @@ -from multiarch/ubuntu-core:@@ARCH@@-bionic - -ENV DEBIAN_FRONTEND noninteractive - -RUN apt-get update && apt-get -y upgrade -RUN apt-get install -y build-essential cmake git gzip - -WORKDIR /src diff --git a/packaging/docker-build.sh b/packaging/docker-build.sh deleted file mode 100755 index 23913bf0..00000000 --- a/packaging/docker-build.sh +++ /dev/null @@ -1,38 +0,0 @@ -#!/bin/bash - -set -eou pipefail -set -x - -cd $(dirname $0) - -build() { - arch=$1 - build_name=$2 - tmpdir=$(mktemp -d) - image_name=luvi-builder-$arch - - echo "Building: $arch $build_name" - - sed "s:@@ARCH@@:$arch:g" Dockerfile.in > $tmpdir/Dockerfile - docker build --rm -t $image_name -f $tmpdir/Dockerfile . - docker run -v $PWD/..:/src $image_name make clean - docker run -v $PWD/..:/src -e SHAREDSSL=false $image_name make $build_name luvi - - if [[ "$build_name" == "regular-asm" ]]; then - build_name="regular" - fi - - cp -f ../build/luvi ../packaging/luvi-$build_name-Linux_$arch - - rm -rf $tmpdir -} - -docker run --rm --privileged multiarch/qemu-user-static:register --reset - -ARCHS=("armhf" "x86" "x86_64") -BUILD_NAMES=("tiny" "regular-asm") -for i in "${!ARCHS[@]}"; do - for j in "${!BUILD_NAMES[@]}"; do - build ${ARCHS[$i]} ${BUILD_NAMES[$j]} - done -done diff --git a/packaging/holy-build.sh b/packaging/holy-build.sh deleted file mode 100755 index 0361df54..00000000 --- a/packaging/holy-build.sh +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/bash - -BUILD_TYPE=${1:-regular-asm} -NPROCS=$(grep -c ^processor /proc/cpuinfo) - -echo "Build Type: ${BUILD_TYPE}" - -set -e - -# Activate Holy Build Box environment. -source /hbb_exe/activate -# Remove -fvisibility=hidden and -g from CFLAGS -CFLAGS=${CFLAGS//-fvisibility=hidden} -CFLAGS=${CFLAGS//-g} - -set -x - -# Extract and enter source -# Use /luvi dir to avoid CMake assertion failure in / -mkdir -p luvi -tar xzf /io/luvi-src.tar.gz --directory luvi -cd luvi -make ${BUILD_TYPE} -make -j${NPROCS} -ldd build/luvi -libcheck build/luvi -cp build/luvi /io diff --git a/packaging/linux-build.sh b/packaging/linux-build.sh new file mode 100644 index 00000000..840262de --- /dev/null +++ b/packaging/linux-build.sh @@ -0,0 +1,41 @@ +#!/bin/bash + +set -xeuo pipefail + +ARCH=$1 +BUILD_TYPE=$2 +LUA_ENGINE=$3 + +NPROCS=$(grep -c ^processor /proc/cpuinfo) + +if which yum; then + if [ "$ARCH" != "i686" ]; then + yum install -y epel-release + yum install -y cmake3 + else # the version of cmake install is too old, and cmake3 is not available for i686 + yum install -y openssl-devel + + curl -fLO https://github.com/Kitware/CMake/releases/download/v3.22.3/cmake-3.22.3.tar.gz + tar -zxf cmake-3.22.3.tar.gz + cd cmake-3.22.3 + ./bootstrap --parallel=$NPROCS + make -j$NPROCS + make install + cd .. + fi + yum install -y perl-core +else + apk add cmake +fi + +git config --global --add safe.directory /github/workspace +git config --global --add safe.directory /github/workspace/deps/luv/deps/luajit + +WITH_OPENSSL_ASM=ON +if [ "$ARCH" == "i686" ]; then + WITH_OPENSSL_ASM=OFF +fi + +make $BUILD_TYPE WITH_LUA_ENGINE=$LUA_ENGINE WITH_OPENSSL_ASM=$WITH_OPENSSL_ASM +make +make test diff --git a/packaging/linux-run.sh b/packaging/linux-run.sh new file mode 100644 index 00000000..aa82f65d --- /dev/null +++ b/packaging/linux-run.sh @@ -0,0 +1,25 @@ +#!/bin/bash + +set -xeuo pipefail + +LIBC=$1 +ARCH=$2 + +shift 2 + +if [ x$LIBC == xglibc ]; then + container_host="quay.io/pypa/manylinux2014_$ARCH" +else + container_host="quay.io/pypa/musllinux_1_2_$ARCH" +fi + +# try to pull the image 3 times, because quay.io sometimes fails +for i in 1 2 3; do + docker pull $container_host && break +done + +docker run --rm \ + -v "$GITHUB_WORKSPACE":"/github/workspace" \ + -w /github/workspace \ + $container_host \ + /bin/bash packaging/linux-build.sh $ARCH $@ diff --git a/packaging/macosx/Icons.icns b/packaging/macosx/Icons.icns deleted file mode 100644 index 3d2fc4721e7e6b0f7c3f37e6105be2595052dcd0..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 43112 zcmeFZXPlH(wm$k+&bhjB&ec`b)j8)3-A$IDh>Aedp*qk3=mx3krb&{c1Q8V#vyM3u zx*M7t6co&P9K(!Z#%$eZzYWgJIp>~x{=a)aoDa7g8L4;gwfA0o#b>Rz8g6arpr`}$ z8#>ZbDT?vkeH2&7WwTgpem}*w$#n{LlwvYif+%Iu3AtRgR>0!0DF&CKm@FoPA=b%+ zGA@I`jZq>7lfx79*h~h+;$sqPYE|wHrC0R zOa@cxjZ&$RpvioFy-%u@GuQ@-EtCpb+|0)EV6lnC(qRn-OQ^P`+2tZGQ|iV6WX4dG z(j|#m45rME=RAqV<)P#WS{0k2pr|Orz!D_Rok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u}lDa4T;EAghFKGxLT|k575P~$G z&pP$^;a^|@!wQ-wq-Evo;YWx{*ng?^12zr)Z{Pp*x%&&yfTC{@g8KO3{p;t{KE^}+ zJs&z+>+7n@%c~zee)9h7_Y*flK-VdVLCdkvWQdO_KxrNv%aqKWJpF+OdrucVhn@K? z#Q)yB1{xp)he+uC3N&<1xmS!1di?L9s@-8;+xTX&`~aUy!Hk)+7fBl0d-#Qr6Vi^{ zYJ6W+TKBl&ar=w6ou8>pKs5ADzEO;W(mcIA8s+Z_A@~V>XD6WtcmQ5y_W5hHZQT8W zN%1KM&*fapExJpotZ#lsWkMec#xdBeX^^qU-dj5fo{)mTF#bkE3Zh^Z8|QK*3s>JD zB1E8%o;!W$?A6?RwTKBQ`v2|kzzCqVNQ!VOG1@M$;}~A2`Sk(?!Wqqc7Q22p`o59x!JqO!QQUsBAD;* z@6J9A9T){vCM;Q|>+KgD9u=RGl|y;-va65UXnm9nlmrPx4SepX%GsX~MS$Ri7C-d$ zpjT6AUj9>$Kmj@#fC*ee+SYDfenH{n*j=dyPFvnVRat(O!PgeKl|P^(1npfdCx f{uuAq|M#erWO_{D+$1047tS8*5o diff --git a/packaging/macosx/Info.plist b/packaging/macosx/Info.plist deleted file mode 100644 index 2e616c90..00000000 --- a/packaging/macosx/Info.plist +++ /dev/null @@ -1,38 +0,0 @@ - - - - - CFBundleDevelopmentRegion - English - CFBundleExecutable - luvi - CFBundleIconFile - luvi.icns - CFBundleIdentifier - org.luvit - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - luvi - CFBundlePackageType - APPL - CFBundleShortVersionString - {VERSION} - CFBundleSignature - luvi - CFBundleVersion - {VERSION}.{COMMITS} - NSPrincipalClass - NSApplication - CFBundleDocumentTypes - - - CFBundleTypeRole - Viewer - LSItemContentTypes - - - - - - From abf22435956b56a1ad3ee48ed8ae4b2f3b212d5d Mon Sep 17 00:00:00 2001 From: Nameless Date: Fri, 21 Jun 2024 13:28:25 -0500 Subject: [PATCH 04/11] update luv to 1.48.0-2 --- deps/luv | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deps/luv b/deps/luv index 7c0735f4..7233e6de 160000 --- a/deps/luv +++ b/deps/luv @@ -1 +1 @@ -Subproject commit 7c0735f46cda5ef68c2e5c4fba8d4a7573fcf132 +Subproject commit 7233e6dea92498a244feb51b790c1ba51e8abbff From 4346d2f7b8f7976fb1f279a1cc55efdf644eb62e Mon Sep 17 00:00:00 2001 From: Nameless Date: Fri, 21 Jun 2024 13:29:04 -0500 Subject: [PATCH 05/11] update zlib to 1.3.1 --- deps/zlib | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deps/zlib b/deps/zlib index 8de57bce..51b7f2ab 160000 --- a/deps/zlib +++ b/deps/zlib @@ -1 +1 @@ -Subproject commit 8de57bce969eb9dafc1f1f5c256ac608d0a73ec4 +Subproject commit 51b7f2abdade71cd9bb0e7a373ef2610ec6f9daf From 5e828f5fda0305fdf97cddbf05b93c063cfcd60f Mon Sep 17 00:00:00 2001 From: Nameless Date: Fri, 21 Jun 2024 13:32:05 -0500 Subject: [PATCH 06/11] use madler/zlib instead of luvit fork --- .gitmodules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitmodules b/.gitmodules index 86682718..c60533f1 100644 --- a/.gitmodules +++ b/.gitmodules @@ -6,7 +6,7 @@ url = https://github.com/luvit/luv.git [submodule "deps/zlib"] path = deps/zlib - url = https://github.com/luvit/zlib.git + url = https://github.com/madler/zlib.git [submodule "deps/lua-zlib"] path = deps/lua-zlib url = https://github.com/brimworks/lua-zlib.git From 55d8245e1b39a97fe0d93ab8a3c1bd9a718ca812 Mon Sep 17 00:00:00 2001 From: Nameless Date: Fri, 21 Jun 2024 14:06:58 -0500 Subject: [PATCH 07/11] update to pcre2 --- .gitmodules | 6 +++--- CMakeLists.txt | 6 +++--- Makefile | 16 ++++++++-------- cmake/Modules/FindPCRE.cmake | 24 ------------------------ cmake/Modules/FindPCRE2.cmake | 24 ++++++++++++++++++++++++ deps/lrexlib.cmake | 14 +++++++------- deps/pcre | 1 - deps/pcre.cmake | 30 ------------------------------ deps/pcre2 | 1 + deps/pcre2.cmake | 30 ++++++++++++++++++++++++++++++ src/luvi.c | 7 ++++--- src/luvi.h | 6 +++--- src/main.c | 6 +++--- 13 files changed, 86 insertions(+), 85 deletions(-) delete mode 100644 cmake/Modules/FindPCRE.cmake create mode 100644 cmake/Modules/FindPCRE2.cmake delete mode 160000 deps/pcre delete mode 100644 deps/pcre.cmake create mode 160000 deps/pcre2 create mode 100644 deps/pcre2.cmake diff --git a/.gitmodules b/.gitmodules index c60533f1..3f805cf3 100644 --- a/.gitmodules +++ b/.gitmodules @@ -13,9 +13,9 @@ [submodule "deps/lrexlib"] path = deps/lrexlib url = https://github.com/rrthomas/lrexlib.git -[submodule "deps/pcre"] - path = deps/pcre - url = https://github.com/luvit/pcre.git [submodule "deps/lpeg"] path = deps/lpeg url = https://github.com/luvit/lpeg.git +[submodule "deps/pcre2"] + path = deps/pcre2 + url = https://github.com/PCRE2Project/pcre2 diff --git a/CMakeLists.txt b/CMakeLists.txt index 78a89a44..2d396150 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -49,8 +49,8 @@ option(WithSharedLibluv "Shared or Static libluv" OFF) option(WithOpenSSL "Include OpenSSL" OFF) option(WithOpenSSLASM "Enable Assembly Optimizations" ON) option(WithSharedOpenSSL "Shared or Static OpenSSL" OFF) -option(WithPCRE "Include PCRE" OFF) -option(WithSharedPCRE "Shared or Static PCRE" OFF) +option(WithPCRE2 "Include PCRE2" OFF) +option(WithSharedPCRE2 "Shared or Static PCRE2" OFF) option(WithLPEG "Include LPEG" OFF) option(WithSharedLPEG "Shared or Static LPEG" OFF) option(WithZLIB "Include ZLIB" OFF) @@ -98,7 +98,7 @@ if (WithOpenSSL) include(deps/lua-openssl.cmake) endif () -if (WithPCRE) +if (WithPCRE2) include(deps/lrexlib.cmake) endif () diff --git a/Makefile b/Makefile index feb2d5c5..cfd23a50 100644 --- a/Makefile +++ b/Makefile @@ -44,8 +44,8 @@ WITH_SHARED_LIBLUV = OFF WITH_OPENSSL = ON !endif -!ifndef WITH_PCRE -WITH_PCRE = ON +!ifndef WITH_PCRE2 +WITH_PCRE2 = ON !endif !ifndef WITH_LPEG @@ -64,8 +64,8 @@ WITH_OPENSSL_ASM = ON WITH_SHARED_OPENSSL = OFF !endif -!ifndef WITH_SHARED_PCRE -WITH_SHARED_PCRE = OFF +!ifndef WITH_SHARED_PCRE2 +WITH_SHARED_PCRE2 = OFF !endif !ifndef WITH_SHARED_LPEG @@ -108,13 +108,13 @@ WITH_LUA_ENGINE ?= LuaJIT WITH_SHARED_LIBLUV ?= OFF WITH_OPENSSL ?= ON -WITH_PCRE ?= ON +WITH_PCRE2 ?= ON WITH_LPEG ?= ON WITH_ZLIB ?= OFF WITH_OPENSSL_ASM ?= ON WITH_SHARED_OPENSSL ?= OFF -WITH_SHARED_PCRE ?= OFF +WITH_SHARED_PCRE2 ?= OFF WITH_SHARED_LPEG ?= OFF WITH_SHARED_ZLIB ?= OFF @@ -149,12 +149,12 @@ CONFIGURE_FLAGS = \ CONFIGURE_REGULAR_FLAGS = $(CONFIGURE_FLAGS) \ -DWithOpenSSL=$(WITH_OPENSSL) \ - -DWithPCRE=$(WITH_PCRE) \ + -DWithPCRE2=$(WITH_PCRE2) \ -DWithLPEG=$(WITH_LPEG) \ -DWithZLIB=$(WITH_ZLIB) \ -DWithOpenSSLASM=$(WITH_OPENSSL_ASM) \ -DWithSharedOpenSSL=$(WITH_SHARED_OPENSSL) \ - -DWithSharedPCRE=$(WITH_SHARED_PCRE) \ + -DWithSharedPCRE2=$(WITH_SHARED_PCRE2) \ -DWithSharedLPEG=$(WITH_SHARED_LPEG) \ -DWithSharedZLIB=$(WITH_SHARED_ZLIB) diff --git a/cmake/Modules/FindPCRE.cmake b/cmake/Modules/FindPCRE.cmake deleted file mode 100644 index 9c472e14..00000000 --- a/cmake/Modules/FindPCRE.cmake +++ /dev/null @@ -1,24 +0,0 @@ - -FIND_PATH(PCRE_INCLUDE_DIR NAMES pcre.h) - -# Look for the library. -FIND_LIBRARY(PCRE_LIBRARY NAMES pcre) - -# Handle the QUIETLY and REQUIRED arguments and set PCRE_FOUND to TRUE if all listed variables are TRUE. -INCLUDE(FindPackageHandleStandardArgs) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(PCRE DEFAULT_MSG PCRE_LIBRARY PCRE_INCLUDE_DIR) - -# Copy the results to the output variables. -IF(PCRE_FOUND) - SET(PCRE_LIBRARIES ${PCRE_LIBRARY}) - SET(PCRE_INCLUDE_DIRS ${PCRE_INCLUDE_DIR}) - SET(PCRE_UNIT_WIDTH ${PCRE_CODE_UNIT_WIDTH}) -ELSE(PCRE_FOUND) - SET(PCRE_LIBRARIES) - SET(PCRE_INCLUDE_DIRS) - SET(PCRE_UNIT_WIDTH) -ENDIF(PCRE_FOUND) - -ADD_DEFINITIONS( -DPCRE_CODE_UNIT_WIDTH=${PCRE_UNIT_WIDTH} ) - -MARK_AS_ADVANCED(PCRE_INCLUDE_DIRS PCRE_LIBRARIES PCRE_UNIT_WIDTH) diff --git a/cmake/Modules/FindPCRE2.cmake b/cmake/Modules/FindPCRE2.cmake new file mode 100644 index 00000000..c2e61e0b --- /dev/null +++ b/cmake/Modules/FindPCRE2.cmake @@ -0,0 +1,24 @@ + +FIND_PATH(PCRE2_INCLUDE_DIR NAMES pcre2.h) + +# Look for the library. +FIND_LIBRARY(PCRE2_LIBRARY NAMES pcre2) + +# Handle the QUIETLY and REQUIRED arguments and set PCRE2_FOUND to TRUE if all listed variables are TRUE. +INCLUDE(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(PCRE2 DEFAULT_MSG PCRE2_LIBRARY PCRE2_INCLUDE_DIR) + +# Copy the results to the output variables. +IF(PCRE2_FOUND) + SET(PCRE2_LIBRARIES ${PCRE2_LIBRARY}) + SET(PCRE2_INCLUDE_DIRS ${PCRE2_INCLUDE_DIR}) + SET(PCRE2_UNIT_WIDTH ${PCRE2_CODE_UNIT_WIDTH}) +ELSE(PCRE2_FOUND) + SET(PCRE2_LIBRARIES) + SET(PCRE2_INCLUDE_DIRS) + SET(PCRE2_UNIT_WIDTH) +ENDIF(PCRE2_FOUND) + +ADD_DEFINITIONS( -DPCRE2_CODE_UNIT_WIDTH=${PCRE2_UNIT_WIDTH} ) + +MARK_AS_ADVANCED(PCRE2_INCLUDE_DIRS PCRE2_LIBRARIES PCRE2_UNIT_WIDTH) diff --git a/deps/lrexlib.cmake b/deps/lrexlib.cmake index bcdf194f..e79a1e1b 100644 --- a/deps/lrexlib.cmake +++ b/deps/lrexlib.cmake @@ -1,18 +1,18 @@ -include(deps/pcre.cmake) +include(deps/pcre2.cmake) set(LREXLIB_DIR "${CMAKE_CURRENT_SOURCE_DIR}/deps/lrexlib" CACHE PATH "Path to lrexlib") add_library(lrexlib STATIC ${LREXLIB_DIR}/src/common.c - ${LREXLIB_DIR}/src/pcre/lpcre.c - ${LREXLIB_DIR}/src/pcre/lpcre_f.c + ${LREXLIB_DIR}/src/pcre2/lpcre2.c + ${LREXLIB_DIR}/src/pcre2/lpcre2_f.c ) -target_include_directories(lrexlib PUBLIC ${PCRE_INCLUDE_DIR}) -target_link_libraries(lrexlib ${PCRE_LIBRARIES}) +target_include_directories(lrexlib PUBLIC ${PCRE2_INCLUDE_DIR}) +target_link_libraries(lrexlib ${PCRE2_LIBRARIES}) target_compile_definitions(lrexlib PRIVATE LUA_COMPAT_APIINTCASTS VERSION="2.8.0") -list(APPEND LUVI_LIBRARIES lrexlib ${PCRE_LIBRARIES}) -list(APPEND LUVI_DEFINITIONS WITH_PCRE=1) +list(APPEND LUVI_LIBRARIES lrexlib ${PCRE2_LIBRARIES}) +list(APPEND LUVI_DEFINITIONS WITH_PCRE2=1) diff --git a/deps/pcre b/deps/pcre deleted file mode 160000 index 5c78f7d5..00000000 --- a/deps/pcre +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 5c78f7d5d7f41bdd4be4867ef3a1030af3e973e3 diff --git a/deps/pcre.cmake b/deps/pcre.cmake deleted file mode 100644 index fd0b0123..00000000 --- a/deps/pcre.cmake +++ /dev/null @@ -1,30 +0,0 @@ -if (WithSharedPCRE) - find_package(PCRE REQUIRED) - - message("Enabling Shared PCRE") - message("PCRE_INCLUDE_DIR: ${PCRE_INCLUDE_DIR}") - message("PCRE_LIBRARIES: ${PCRE_LIBRARIES}") -else (WithSharedPCRE) - message("Enabling Static PCRE") - - set(PCRE_MATCH_LIMIT "150000" CACHE STRING - "Default limit on internal looping. See MATCH_LIMIT in config.h.in for details.") - option(PCRE_BUILD_PCREGREP "Build pcregrep" OFF) - option(PCRE_BUILD_TESTS "Build the tests" OFF) - option(PCRE_BUILD_PCRECPP "Build the PCRE C++ library (pcrecpp)." OFF) - set(PCRE_SUPPORT_UTF ON CACHE BOOL - "Enable support for Unicode Transformation Format (UTF-8/UTF-16/UTF-32) encoding.") - - set(BUILD_SHARED_LIBS OFF) - add_compile_definitions(PCRE_STATIC) - - add_subdirectory(deps/pcre) - - set(PCRE_INCLUDE_DIR ${CMAKE_BINARY_DIR}/deps/pcre) - set(PCRE_LIBRARIES pcre) - - message("PCRE_INCLUDE_DIR: ${PCRE_INCLUDE_DIR}") - message("PCRE_LIBRARIES: ${PCRE_LIBRARIES}") - - mark_as_advanced(PCRE_MATCH_LIMIT PCRE_BUILD_PCREGREP PCRE_BUILD_TESTS PCRE_BUILD_PCRECPP PCRE_SUPPORT_UTF) -endif (WithSharedPCRE) diff --git a/deps/pcre2 b/deps/pcre2 new file mode 160000 index 00000000..9a51f31d --- /dev/null +++ b/deps/pcre2 @@ -0,0 +1 @@ +Subproject commit 9a51f31da1c2d45e1f31d6a0d6b2f62975fed373 diff --git a/deps/pcre2.cmake b/deps/pcre2.cmake new file mode 100644 index 00000000..2a3b1380 --- /dev/null +++ b/deps/pcre2.cmake @@ -0,0 +1,30 @@ +if (WithSharedPCRE2) + find_package(PCRE2 REQUIRED) + + message("Enabling Shared PCRE2") + message("PCRE2_INCLUDE_DIR: ${PCRE2_INCLUDE_DIR}") + message("PCRE2_LIBRARIES: ${PCRE2_LIBRARIES}") +else (WithSharedPCRE2) + message("Enabling Static PCRE2") + + set(PCRE2_ROOT_DIR "${CMAKE_CURRENT_SOURCE_DIR}/deps/pcre2" CACHE STRING "Path to pcre2") + + set(PCRE2_BUILD_PCRE2GREP OFF CACHE BOOL "Build pcre2grep") + set(PCRE2_BUILD_TESTS OFF CACHE BOOL "Build tests") + set(PCRE2_STATIC_RUNTIME ON CACHE BOOL "Use static runtime") + set(PCRE2_SUPPORT_LIBBZ2 OFF CACHE BOOL "Support libbz2") + set(PCRE2_SUPPORT_LIBZ OFF CACHE BOOL "Support libz") + set(PCRE2_SUPPORT_LIBEDIT OFF CACHE BOOL "Support libedit") + set(PCRE2_SUPPORT_LIBREADLINE OFF CACHE BOOL "Support libreadline") + + add_compile_definitions(PCRE2_CODE_UNIT_WIDTH=8) + add_compile_definitions(PCRE2_STATIC) + + add_subdirectory(deps/pcre2) + + set(PCRE2_INCLUDE_DIR ${PCRE2_HEADERS}) + set(PCRE2_LIBRARIES pcre2-8-static) + + message("PCRE2_INCLUDE_DIR: ${PCRE2_INCLUDE_DIR}") + message("PCRE2_LIBRARIES: ${PCRE2_LIBRARIES}") +endif (WithSharedPCRE2) diff --git a/src/luvi.c b/src/luvi.c index e3f7952d..924db691 100644 --- a/src/luvi.c +++ b/src/luvi.c @@ -18,7 +18,7 @@ #include "./luvi.h" LUALIB_API int luaopen_luvi(lua_State *L) { -#if defined(WITH_OPENSSL) || defined(WITH_PCRE) +#if defined(WITH_OPENSSL) || defined(WITH_PCRE2) char buffer[1024]; #endif lua_newtable(L); @@ -33,8 +33,9 @@ LUALIB_API int luaopen_luvi(lua_State *L) { lua_pushstring(L, buffer); lua_setfield(L, -2, "ssl"); #endif -#ifdef WITH_PCRE - lua_pushstring(L, pcre_version()); +#ifdef WITH_PCRE2 + pcre2_config(PCRE2_CONFIG_VERSION, buffer); + lua_pushstring(L, buffer); lua_setfield(L, -2, "rex"); #endif #ifdef WITH_ZLIB diff --git a/src/luvi.h b/src/luvi.h index 382d05fa..a1f827e7 100644 --- a/src/luvi.h +++ b/src/luvi.h @@ -40,9 +40,9 @@ #ifdef WITH_OPENSSL #include "openssl.h" #endif -#ifdef WITH_PCRE -#include "pcre.h" -int luaopen_rex_pcre(lua_State* L); +#ifdef WITH_PCRE2 +#include "pcre2.h" +int luaopen_rex_pcre2(lua_State* L); #endif #ifdef WITH_ZLIB #include "zlib.h" diff --git a/src/main.c b/src/main.c index 86fb0091..3ea38be4 100644 --- a/src/main.c +++ b/src/main.c @@ -93,10 +93,10 @@ static lua_State* vm_acquire(){ lua_setfield(L, -2, "lpeg"); #endif -#ifdef WITH_PCRE - lua_pushcfunction(L, luaopen_rex_pcre); +#ifdef WITH_PCRE2 + lua_pushcfunction(L, luaopen_rex_pcre2); lua_pushvalue(L, -1); - lua_setfield(L, -3, "rex_pcre"); + lua_setfield(L, -3, "rex_pcre2"); lua_setfield(L, -2, "rex"); #endif From e059e2c0e5a33fbcd903762a60a85ce1a83c10dc Mon Sep 17 00:00:00 2001 From: Nameless Date: Fri, 21 Jun 2024 16:33:02 -0500 Subject: [PATCH 08/11] allow workflow to be dispatched --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7b0b4b3b..4cb7e4c3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,6 +1,6 @@ name: CI -on: [push, pull_request] +on: [push, pull_request, workflow_dispatch] jobs: build-posix: From fc5eb491eef6ddc0d72f014abe13ca6c0e65af11 Mon Sep 17 00:00:00 2001 From: Nameless Date: Tue, 25 Jun 2024 08:27:41 -0500 Subject: [PATCH 09/11] improve os checks in luvi libraries --- src/lua/luvibundle.lua | 5 ++--- src/lua/luvipath.lua | 6 +++--- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/lua/luvibundle.lua b/src/lua/luvibundle.lua index e62afe5a..46ca9be8 100644 --- a/src/lua/luvibundle.lua +++ b/src/lua/luvibundle.lua @@ -6,10 +6,9 @@ local pathJoin = luviPath.pathJoin local getenv = require('os').getenv local loadstring = loadstring or load -local unpack = unpack or _G.table.unpack +local unpack = unpack or table.unpack -local tmpBase = luviPath.isWindows and (getenv("TMP") or uv.cwd()) or - (getenv("TMPDIR") or '/tmp') +local tmpBase = getenv("TMPDIR") or getenv("TMP") or getenv("TEMP") or (uv.fs_access("/tmp", "r") and "/tmp") or uv.cwd() -- Bundle from folder on disk local function folderBundle(base) diff --git a/src/lua/luvipath.lua b/src/lua/luvipath.lua index 598fee52..73814f32 100644 --- a/src/lua/luvipath.lua +++ b/src/lua/luvipath.lua @@ -2,10 +2,10 @@ local luvi = require('luvi') local getPrefix, splitPath, joinParts local isWindows -if _G.jit then - isWindows = _G.jit.os == "Windows" +if pcall(require, 'jit') then + isWindows = require('jit').os == "Windows" else - isWindows = not not package.path:match("\\") + isWindows = not not (package.config:sub(1, 1) == "\\" or package.path:find("\\", 1, true) or package.cpath:find("\\", 1, true)) end if isWindows then From 11c4087b1067df6f1eec343f9f85b70c50308291 Mon Sep 17 00:00:00 2001 From: Nameless Date: Wed, 3 Jul 2024 21:56:49 -0500 Subject: [PATCH 10/11] clean up README for new changes --- README.md | 169 ++++++++++++++++-------------------------------------- 1 file changed, 51 insertions(+), 118 deletions(-) diff --git a/README.md b/README.md index d789e933..b9175272 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,6 @@ # luvi -[![Linux Build Status](https://github.com/luvit/luvi/actions/workflows/ci.yml/badge.svg)](https://github.com/luvit/luvi/actions/workflows/ci.yml) -[![Windows Build status](https://ci.appveyor.com/api/projects/status/h643wg5hkwsnu0wd/branch/master?svg=true)](https://ci.appveyor.com/project/racker-buildbot/luvi/branch/master) -[![Code Quality: Cpp](https://img.shields.io/lgtm/grade/cpp/g/luvit/luvi.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/luvit/luvi/context:cpp) -[![Total Alerts](https://img.shields.io/lgtm/alerts/g/luvit/luvi.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/luvit/luvi/alerts) +[![Build Status](https://github.com/luvit/luvi/actions/workflows/ci.yml/badge.svg)](https://github.com/luvit/luvi/actions/workflows/ci.yml) A project in-between [luv][] and [luvit][]. @@ -34,12 +31,14 @@ luvi myapp -o mybinary --strip ## Main API -Your `main.lua` is run in a mostly stock [luajit][] environment with a few extra things added. This means you can use -the luajit [extensions][] including `DLUAJIT_ENABLE_LUA52COMPAT` features, which we turn on. +Your `main.lua` is run in either a mostly stock [lua][] or [luajit][] environment with a few extra things added. Luajit +is built with `LUAJIT_ENABLE_LUA52COMPAT` features turned on, and all luajit [extensions][] are available. Lua is built +with the `bit` library included, for parity with luajit. ### Libuv is baked in The "uv" module contains bindings to [libuv][] as defined in the [luv][] project. Simply `require("uv")` to access it. +The "uv" module is also provided under the name "luv" for parity with luarocks, so `require("luv")` will also work. Use this for file I/O, network I/O, timers, or various interfaces with the operating system. This lets you write fast non-blocking network servers or frameworks. The APIs in [luv][] mirror what's in [libuv][] allowing you to add @@ -48,6 +47,14 @@ whatever API sugar you want on top be it callbacks, coroutines, or whatever. Just be sure to call `uv.run()` and the end of your script to start the event loop if you want to actually wait for any events to happen. +[extensions]: http://luajit.org/extensions.html +[lua]: https://www.lua.org/ +[luajit]: https://luajit.org/ +[libuv]: https://github.com/joyent/libuv +[luv]: https://github.com/luvit/luv +[luvit]: https://luvit.io/ +[derivatives]: http://virgoagent.com/ + ```lua local uv = require('uv') @@ -75,44 +82,19 @@ uv.run() ### Integration with C's main function -The raw `argc` and `argv` from C side is exposed as a **zero** indexed lua table of strings at `args`. +The raw `argc` and `argv` from C side is exposed as a **zero** indexed lua table of strings at `args`. The `0`-th +element is generally the name of the binary that was executed. ```lua -print("Your arguments were", args) +print("Your arguments were") +for i = 0, #args do + print(i, args[i]) +end ``` The "env" module provides read/write access to your local environment variables via `env.keys`, `env.get`, `env.put`, `env.set`, and `env.unset`. -```lua -local env = require('env') - --- Convert the module to a mutable magic table. -local environment = setmetatable({}, { - __pairs = function (table) - local keys = env.keys() - local index = 0 - return function (...) - index = index + 1 - local name = keys[index] - if name then - return name, table[name] - end - end - end, - __index = function (table, name) - return env.get(name) - end, - __newindex = function (table, name, value) - if value then - env.set(name, value, 1) - else - env.unset(name) - end - end -})) -``` - If you return an integer from `main.lua` it will be your program's exit code. ### Bundle I/O @@ -127,8 +109,8 @@ local files = bundle.readdir("") #### bundle.stat(path) -Load metadata about a file in the bundle. This includes `type` ("file" or -"directory"), `mtime` (in ms since epoch), and `size` (in bytes). +Load metadata about a file in the bundle. This includes `type` ("file" or "directory"), `mtime` (in ms since epoch), +and `size` (in bytes). If the file doesn't exist, it returns `nil`. @@ -140,60 +122,39 @@ If the directory doesn't exist, it return `nil`. #### bundle.readfile(path) -Read the contents of a file. Returns a string if the file exists and `nil` if -it doesn't. +Read the contents of a file. Returns a string if the file exists and `nil` if it doesn't. -### Utils +## Building from Source -There is also a "utils" module that has some useful debugging stuff like a colorized -pretty printer. +We maintain several [binary releases of luvi](https://github.com/luvit/luvi/releases) to ease bootstrapping of lit and +luvit apps. -```lua -local uv = require('uv') -local dump = require('utils').dump --- Create a global p() function that pretty prints any values --- to stdout using libuv's APIs -_G.p = function (...) - local n = select('#', ...) - local arguments = { ... } - - for i = 1, n do - arguments[i] = dump(arguments[i]) - end +The following platforms are actively supported and tested by the CI system: - local toWrite = table.concat(arguments, "\t") .. "\n" - uv.write(stdout, toWrite); -end -``` +- Windows >= 10 (x86_64 / i386) +- Linux >= 3.10, glibc >= 2.17 OR musl >= 1.0 (x86_64 / i386 / aarch64) + - Debian 8+ + - Ubuntu 13.10+ + - Fedora 19+ +- OSX 13+ (x86_64 / aarch64) -[extensions]: http://luajit.org/extensions.html -[luajit]: http://luajit.org/ -[libuv]: https://github.com/joyent/libuv -[luv]: https://github.com/luvit/luv -[luvit]: https://luvit.io/ -[derivatives]: http://virgoagent.com/ +The following platforms are supported but not actively tested by the CI system: -## Building from Source +- Windows >= 8 (x86_64 / i386) +- OSX 11+ (x86_64 / aarch64) +- FreeBSD 12+ -We maintain several [binary releases of luvi](https://github.com/luvit/luvi/releases) to ease bootstrapping of lit and -luvit apps. +Platform support is primarily based on libuv's [platform support](https://github.com/libuv/libuv/blob/v1.x/SUPPORTED_PLATFORMS.md). -The following platforms are supported: +Architecture support is primarily based on luajit's [platform support](https://luajit.org/luajit.html). -- Windows (x86_64 / i386) -- FreeBSD 10.1 (x86_64) -- Raspberry PI Raspbian (armv6) -- Raspberry PI 2 Raspbian (armv7) -- Debian 9 "Stretch" (x86_64) -- OSX 10.14 "Mojave" (x86_64) +### Build Dependencies If you want to not wait for pre-built binaries and dive right in, building is based on CMake and is pretty simple. -### Build Dependencies - - Git - CMake -- A C Compiler (visual studio on Windows) +- A C Compiler (Visual Studio 15+ OR MinGW on Windows) - Perl (required for OpenSSL) - NASM (required for OpenSSL ASM optimizations on Windows) @@ -203,16 +164,18 @@ First clone this repo recursively. git clone --recursive https://github.com/luvit/luvi.git ``` -Then run the makefile inside it. (Note this assumes you have cmake in your path.) -If you're on windows, there is a `make.bat` file that works mostly like the unix -`Makefile`. +> [!IMPORTANT] +> If you're on windows, for all following steps you will need to be in a [Visual Studio Command Prompt](https://learn.microsoft.com/en-us/visualstudio/ide/reference/command-prompt-powershell?view=vs-2022). +> +> You will need to replace `make` with `nmake` in the following commands. + +Then enter the directory and run the makefile inside it, which will assume you have all the dependencies installed, +primarily CMake. -Prior to building the `luvi` binary you must configure the version of `luvi` -that you want to build. Currently there are three versions: +Prior to building luvi you must configure the version of luvi that you want to build. Currently there are two versions: -- tiny: only the necessities; omits OpenSSL, LPeg, and lrexlib -- regular: the normal luvit experience; includes OpenSSL, lpeg and lrexlib -- regular-asm: includes OpenSSL's ASM optimizations +- `tiny`: only the necessities, includes only Lua, Libuv, miniz, and minimal luvi modules. +- `regular`: the normal luvit experience, includes OpenSSL, LPeg, and lrexlib. ```sh cd luvi @@ -221,7 +184,7 @@ make make test ``` -When that's done you should have a shiny little binary in `build/luvi`. +When that's done you should have a luvi binary in `build/luvi`. ```sh $ ls -lh build/luvi @@ -316,33 +279,3 @@ cmake \ -DOPENSSL_LIBRARIES=/usr/local/opt/openssl/lib \ .. ``` - -## Holy Build - -Executables across Linux distributions are not largely portable for various -differences. We can leverage the -[holy-build-box](https://github.com/phusion/holy-build-box) to create a -portable executable for i686 and x86_64 environments. - -Note: If you are attempting this on OSX, please install GNU tar from homebrew: - -```sh -brew install gnu-tar -``` - -To get started: - -1. Create a docker machine: - - ```sh - docker-machine create --driver vmwarefusion --vmwarefusion-cpu-count 3 holy-build-box - eval $(docker-machine env holy-build-box) - ``` - -2. Start the build - - ```sh - make linux-build - ``` - -3. Results should be the current working directory. From 984e52d8c8d384446c477b6a041a572f349800a4 Mon Sep 17 00:00:00 2001 From: Nameless Date: Wed, 3 Jul 2024 22:36:40 -0500 Subject: [PATCH 11/11] add jit.vmdef when statically building luajit --- CMakeLists.txt | 6 ++++++ src/luvi.h | 3 +++ src/main.c | 5 +++++ 3 files changed, 14 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2d396150..073f0107 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -84,6 +84,11 @@ else (WithSharedLibluv) else () include_directories(deps/luv/deps/luajit/src) list(APPEND LUVI_LIBRARIES luajit-5.1) + + set(luajit_vmdef ${CMAKE_CURRENT_BINARY_DIR}/deps/luv/vmdef.lua) + set_source_files_properties(${luajit_vmdef} PROPERTIES GENERATED TRUE) + + list(APPEND LUVI_DEFINITIONS WITH_LJ_VMDEF) endif () list(APPEND LUVI_LIBRARIES libluv_a uv_a) @@ -134,6 +139,7 @@ lua_add_executable(luvi src/lua/init.lua src/lua/luvipath.lua src/lua/luvibundle.lua + ${luajit_vmdef} ${lpeg_re_lua} ) diff --git a/src/luvi.h b/src/luvi.h index a1f827e7..8f39a9f7 100644 --- a/src/luvi.h +++ b/src/luvi.h @@ -58,6 +58,9 @@ int luaopen_lpeg(lua_State* L); #ifdef WITH_PLAIN_LUA LUALIB_API int luaopen_bit(lua_State *L); #endif +#ifdef WITH_LJ_VMDEF +LUALIB_API int luaopen_vmdef(lua_State *L); +#endif void luvi_openlibs(lua_State *L); diff --git a/src/main.c b/src/main.c index 3ea38be4..90629766 100644 --- a/src/main.c +++ b/src/main.c @@ -131,6 +131,11 @@ static lua_State* vm_acquire(){ lua_pushcfunction(L, luaopen_luvipath); lua_setfield(L, -2, "luvipath"); +#ifdef WITH_LJ_VMDEF + lua_pushcfunction(L, luaopen_vmdef); + lua_setfield(L, -2, "jit.vmdef"); +#endif + #ifdef WITH_CUSTOM luvi_custom(L); #endif