aboutsummaryrefslogtreecommitdiff
path: root/build.sh
diff options
context:
space:
mode:
authorAdam Harrison <adamdharrison@gmail.com>2022-11-26 14:55:21 -0500
committerAdam Harrison <adamdharrison@gmail.com>2022-11-26 14:55:21 -0500
commit3836606e2b735ba7b2dc0f580231843660587fb4 (patch)
tree68132a66fe0c4352b74c0c65b51c4539bbd0cbdc /build.sh
parent632eaa2f13c24519f29ac124de4da32f5497297e (diff)
downloadlite-xl-plugin-manager-3836606e2b735ba7b2dc0f580231843660587fb4.tar.gz
lite-xl-plugin-manager-3836606e2b735ba7b2dc0f580231843660587fb4.zip
Compiled lua file before embedding it.
Diffstat (limited to 'build.sh')
-rwxr-xr-xbuild.sh10
1 files changed, 6 insertions, 4 deletions
diff --git a/build.sh b/build.sh
index 9c569db..5e65bc2 100755
--- a/build.sh
+++ b/build.sh
@@ -8,7 +8,7 @@
SRCS="src/*.c"
LDFLAGS="$LDFLAGS -lm -pthread -static-libgcc"
-[[ "$@" == "clean" ]] && rm -rf lib/libgit2/build lib/zlib/build lib/openssl/build lib/curl/build lib/libarchive/build-tmp lib/liblzma/build lib/prefix $BIN *.exe && exit 0
+[[ "$@" == "clean" ]] && rm -rf lib/libgit2/build lib/zlib/build lib/openssl/build lib/curl/build lib/libarchive/build-tmp lib/liblzma/build lib/prefix lua $BIN *.exe src/lpm.luac src/lpm.lua.c && exit 0
[[ $OSTYPE == 'msys'* || $CC == *'mingw'* ]] && SSL_CONFIGURE="mingw64"
# Build supporting libraries, libgit2, libz, libssl (with libcrypto)
@@ -18,7 +18,7 @@ if [[ "$@" != *"-lz"* ]]; then
LDFLAGS="$LDFLAGS -Llib/libz/build -l:libz.a" && CFLAGS="$CFLAGS -Ilib/prefix/include" && LDFLAGS="$LDFLAGS -Llib/prefix/lib -Llib/prefix/lib64"
fi
if [[ "$@" != *"-lssl"* && "$@" != *"-lcrypto"* ]]; then
- [ ! -e "lib/openssl/build" ] && cd lib/openssl && mkdir build && cd build && ../Configure --prefix=`pwd`/../../prefix no-asm no-ssl2 no-zlib no-rc2 no-idea no-bf no-cast no-md2 no-mdc2 no-dh no-err no-ripemd no-rc5 no-camellia no-seed -DOPENSSL_SMALL_FOOTPRINT $SSL_CONFIGURE && $MAKE -j $JOBS && $MAKE install_sw install_ssldirs && cd ../../../ && ln -sf lib/prefix/lib64/libcrypto.a lib/prefix/lib/libcyrpto.a
+ [ ! -e "lib/openssl/build" ] && cd lib/openssl && mkdir build && cd build && ../Configure --prefix=`pwd`/../../prefix no-asm no-zlib no-rc2 no-idea no-bf no-cast no-md2 no-mdc2 no-dh no-err no-rc5 no-camellia no-seed no-tests -DOPENSSL_SMALL_FOOTPRINT $SSL_CONFIGURE && $MAKE -j $JOBS && $MAKE install_sw install_ssldirs && cd ../../../ && ln -sf lib/prefix/lib64/libcrypto.a lib/prefix/lib/libcyrpto.a
CFLAGS="$CFLAGS -Ilib/prefix/include" && LDFLAGS="$LDFLAGS -Llib/prefix/lib -Llib/prefix/lib64 -l:libssl.a -l:libcrypto.a"
fi
if [[ "$@" != *"-lgit2"* ]]; then
@@ -26,7 +26,7 @@ if [[ "$@" != *"-lgit2"* ]]; then
LDFLAGS="-Llib/libgit2/build -l:libgit2.a $LDFLAGS -Llib/prefix/lib -Llib/prefix/lib64" && CFLAGS="$CFLAGS -Ilib/prefix/include"
fi
if [[ "$@" != *"-lcurl"* ]]; then
- [ ! -e "lib/curl/build" ] && cd lib/curl && mkdir build && cd build && cmake .. -G "Unix Makefiles" $CURL_CONFIGURE -DCMAKE_BUILD_TYPE=Release -DCURL_USE_LIBPSL=OFF -DCURL_DISABLE_LDAPS=ON -DUSE_OPENSSL=ON -DCURL_DISABLE_LDAP=ON -DCMAKE_INSTALL_PREFIX=`pwd`/../../prefix -DUSE_LIBIDN2=OFF -DENABLE_UNICODE=OFF -DBUILD_CURL_EXE=OFF -DCURL_USE_LIBSSH2=OFF -DOPENSSL_ROOT_DIR=`pwd`/../../prefix -DBUILD_SHARED_LIBS=OFF -DCMAKE_INSTALL_LIBDIR=lib && $MAKE -j $JOBS && $MAKE install && cd ../../../
+ [ ! -e "lib/curl/build" ] && cd lib/curl && mkdir build && cd build && cmake .. -G "Unix Makefiles" $CURL_CONFIGURE -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=OFF -DCURL_USE_LIBPSL=OFF -DCURL_DISABLE_LDAPS=ON -DUSE_OPENSSL=ON -DCURL_DISABLE_LDAP=ON -DCMAKE_INSTALL_PREFIX=`pwd`/../../prefix -DUSE_LIBIDN2=OFF -DENABLE_UNICODE=OFF -DBUILD_CURL_EXE=OFF -DCURL_USE_LIBSSH2=OFF -DOPENSSL_ROOT_DIR=`pwd`/../../prefix -DBUILD_SHARED_LIBS=OFF -DCMAKE_INSTALL_LIBDIR=lib && $MAKE -j $JOBS && $MAKE install && cd ../../../
LDFLAGS="-Llib/curl/build -Llib/prefix/lib -l:libcurl.a $LDFLAGS" && CFLAGS="$CFLAGS -Ilib/prefix/include -DCURL_STATICLIB"
fi
if [[ "$@" != *"-llzma"* ]]; then
@@ -41,7 +41,9 @@ fi
[[ "$@" != *"-llua"* ]] && CFLAGS="$CFLAGS -Ilib/lua -DMAKE_LIB=1" && SRCS="$SRCS lib/lua/onelua.c"
# Build the pre-packaged lua file into the executbale.
-xxd -i src/lpm.lua > src/lpm.lua.c
+[[ ! -e "lua" ]] && $CC -Ilib/lua -o lua -DMAKE_=1 lib/lua/onelua.c -lm
+./lua -e 'io.open("src/lpm.luac", "wb"):write(string.dump(assert(loadfile("src/lpm.lua"))))'
+xxd -i src/lpm.luac > src/lpm.lua.c
[[ $OSTYPE != 'msys'* && $CC != *'mingw'* && $CC != "emcc" ]] && LDFLAGS=" $LDFLAGS -ldl -pthread"
[[ $OSTYPE == 'msys'* || $CC == *'mingw'* ]] && LDFLAGS="$LDFLAGS -lbcrypt -lws2_32 -lz -lwinhttp -lole32 -lcrypt32 -lrpcrt4"