diff options
author | Adam Harrison <adamdharrison@gmail.com> | 2024-12-01 14:34:55 -0500 |
---|---|---|
committer | Adam Harrison <adamdharrison@gmail.com> | 2024-12-01 14:34:55 -0500 |
commit | 28915241adaa8dfd089f595b74f47457128367a5 (patch) | |
tree | 42c1052a06c0c992240b9508e0f4f780b87e01e8 | |
parent | 983b04f089ca0ed41148f3f99482ce4f6052d344 (diff) | |
download | lite-xl-plugin-manager-28915241adaa8dfd089f595b74f47457128367a5.tar.gz lite-xl-plugin-manager-28915241adaa8dfd089f595b74f47457128367a5.zip |
Changed naming conventions.
-rwxr-xr-x | build.sh | 24 | ||||
-rw-r--r-- | src/lpm.c | 53 |
2 files changed, 48 insertions, 29 deletions
@@ -7,15 +7,21 @@ : ${BIN=lpm} : ${JOBS=4} -# The build options are available: -# clean Cleans the build directory. -# -g Compile with debug support. -# -l<library> Compiles against the shared system version of the specified library. -# -DLPM_NO_GIT Compiles without libgit2 support. -# -DLPM_NO_NETWORK Compiles without network support. -# -DLPM_NO_THREADS Compiles without threading support. -# -DLPM_VERSION Sets the specific version. -# -DLPM_STATIC Bundles lpm.lua into the binary executable. +# The non-exhaustive build options are available: +# clean Cleans the build directory. +# -g Compile with debug support. +# -l<library> Compiles against the shared system version of the specified library. +# -DLPM_NO_GIT Compiles without libgit2 support. +# -DLPM_NO_NETWORK Compiles without network support. +# -DLPM_NO_THREADS Compiles without threading support. +# -DLPM_NO_REMOTE_EXECUTABLE Compiles without the ability to download remote executables. +# -DLPM_STATIC Compiles lpm.lua into the binary executable. +# -DLPM_ARCH_TUPLE Specifies the arch tuple for this build. +# -DLPM_DEFAULT_REPOSITORY Specifies the default repository to download on init. +# -DLPM_DEFAULT_RELEASE Specifies the default release for lpm for `self-upgrade`. +# -DLPM_VERSION Specifies the lpm version. +# -DLPM_ARCH_PROCESSOR Manually specifies the processor archiecture. +# -DLPM_ARCH_PLATFORM Manually specifies the operating system. SRCS="src/*.c" COMPILE_FLAGS="$CFLAGS -I`pwd`/lib/prefix/include" # We specifically rename this and LDFLAGS, because exotic build environments export these to subprocesses. @@ -1882,38 +1882,38 @@ static const luaL_Reg system_lib[] = { { NULL, NULL } }; -#ifndef ARCH_PROCESSOR +#ifndef LPM_ARCH_PROCESSOR #if defined(__x86_64__) || defined(_M_AMD64) || defined(__MINGW64__) - #define ARCH_PROCESSOR "x86_64" + #define LPM_ARCH_PROCESSOR "x86_64" #elif defined(__i386__) || defined(_M_IX86) || defined(__MINGW32__) - #define ARCH_PROCESSOR "x86" + #define LPM_ARCH_PROCESSOR "x86" #elif defined(__aarch64__) || defined(_M_ARM64) || defined (_M_ARM64EC) - #define ARCH_PROCESSOR "aarch64" + #define LPM_ARCH_PROCESSOR "aarch64" #elif defined(__arm__) || defined(_M_ARM) - #define ARCH_PROCESSOR "arm" + #define LPM_ARCH_PROCESSOR "arm" #elif defined(__riscv_xlen) && __riscv_xlen == 32 - #define ARCH_PROCESSOR "riscv32" + #define LPM_ARCH_PROCESSOR "riscv32" #elif defined(__riscv_xlen) && __riscv_xlen == 64 - #define ARCH_PROCESSOR "riscv64" + #define LPM_ARCH_PROCESSOR "riscv64" #else - #error "Please define -DARCH_PROCESSOR." + #error "Please define -DLPM_ARCH_PROCESSOR." #endif #endif -#ifndef ARCH_PLATFORM +#ifndef LPM_ARCH_PLATFORM #if _WIN32 - #define ARCH_PLATFORM "windows" + #define LPM_ARCH_PLATFORM "windows" #elif __ANDROID__ - #define ARCH_PLATFORM "android" + #define LPM_ARCH_PLATFORM "android" #elif __linux__ - #define ARCH_PLATFORM "linux" + #define LPM_ARCH_PLATFORM "linux" #elif __APPLE__ - #define ARCH_PLATFORM "darwin" + #define LPM_ARCH_PLATFORM "darwin" #else - #error "Please define -DARCH_PLATFORM." + #error "Please define -DLPM_ARCH_PLATFORM." #endif #endif -#ifndef LITE_ARCH_TUPLE - #define LITE_ARCH_TUPLE ARCH_PROCESSOR "-" ARCH_PLATFORM +#ifndef LPM_ARCH_TUPLE + #define LPM_ARCH_TUPLE LPM_ARCH_PROCESSOR "-" LPM_ARCH_PLATFORM #endif @@ -1926,9 +1926,9 @@ static const luaL_Reg system_lib[] = { // If this is defined as empty string, we disable self-upgrading, as well as switching the executable symlink. #ifndef LPM_DEFAULT_RELEASE #if _WIN32 - #define LPM_DEFAULT_RELEASE "https://github.com/lite-xl/lite-xl-plugin-manager/releases/download/%r/lpm." LITE_ARCH_TUPLE ".exe" + #define LPM_DEFAULT_RELEASE "https://github.com/lite-xl/lite-xl-plugin-manager/releases/download/%r/lpm." LPM_ARCH_TUPLE ".exe" #else - #define LPM_DEFAULT_RELEASE "https://github.com/lite-xl/lite-xl-plugin-manager/releases/download/%r/lpm." LITE_ARCH_TUPLE + #define LPM_DEFAULT_RELEASE "https://github.com/lite-xl/lite-xl-plugin-manager/releases/download/%r/lpm." LPM_ARCH_TUPLE #endif #endif @@ -1937,6 +1937,7 @@ static const luaL_Reg system_lib[] = { extern unsigned int lpm_luac_len; #endif + int main(int argc, char* argv[]) { lua_State* L = luaL_newstate(); luaL_openlibs(L); @@ -1950,7 +1951,7 @@ int main(int argc, char* argv[]) { lua_setglobal(L, "ARGV"); lua_pushliteral(L, LPM_VERSION); lua_setglobal(L, "VERSION"); - lua_pushliteral(L, ARCH_PLATFORM); + lua_pushliteral(L, LPM_ARCH_PLATFORM); lua_setglobal(L, "PLATFORM"); #ifdef LPM_NO_NETWORK lua_pushboolean(L, 1); @@ -1964,6 +1965,18 @@ int main(int argc, char* argv[]) { lua_pushboolean(L, 0); #endif lua_setglobal(L, "NO_GIT"); + #ifdef LPM_NO_LXL + lua_pushboolean(L, 1); + #else + lua_pushboolean(L, 0); + #endif + lua_setglobal(L, "NO_LXL"); + #ifdef LPM_NO_REMOTE_EXECUTABLE + lua_pushboolean(L, 1); + #else + lua_pushboolean(L, 0); + #endif + lua_setglobal(L, "NO_REMOTE_EXEUCTABLE"); #if _WIN32 DWORD handles[] = { STD_OUTPUT_HANDLE, STD_ERROR_HANDLE }; int setVirtualProcessing = 0; @@ -2012,7 +2025,7 @@ int main(int argc, char* argv[]) { #endif lua_setglobal(L, "EXEFILE"); - lua_pushliteral(L, LITE_ARCH_TUPLE); + lua_pushliteral(L, LPM_ARCH_TUPLE); lua_setglobal(L, "DEFAULT_ARCH"); lua_pushliteral(L, LPM_DEFAULT_REPOSITORY); lua_setglobal(L, "DEFAULT_REPO_URL"); |