diff options
-rw-r--r-- | .github/workflows/build.yml | 10 | ||||
-rw-r--r-- | README.md | 14 | ||||
-rw-r--r-- | lpm.lua | 17 |
3 files changed, 32 insertions, 9 deletions
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index dc9409f..6ed7949 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -14,7 +14,7 @@ jobs: run: git submodule update --init --depth=1 - name: Build Linux run: | - ./build.sh -DLPM_VERSION='"'$VERSION-x86_64-linux-`git rev-parse --short HEAD`'"' && tar -czvf lpm-$VERSION-x86_64-linux.tar.gz lpm + SSL_CONFIGURE="no-tests" ./build.sh -DLPM_VERSION='"'$VERSION-x86_64-linux-`git rev-parse --short HEAD`'"' && tar -czvf lpm-$VERSION-x86_64-linux.tar.gz lpm cp lpm lpm.x86_64-linux - name: Package Debian/Ubuntu env: { REV: "1", ARCH: "amd64", DESCRIPTION: "A plugin manager for the lite-xl text editor.", MAINTAINER: "Adam Harrison <adamdharrison@gmail.com>" } @@ -25,7 +25,7 @@ jobs: dpkg-deb --build --root-owner-group $NAME - name: Build Windows run: | - sudo apt-get install mingw-w64 && ./build.sh clean && CC=x86_64-w64-mingw32-gcc AR=x86_64-w64-mingw32-gcc-ar WINDRES=x86_64-w64-mingw32-windres LZMA_CONFIGURE="--host=x86_64-w64-mingw32" ARCHIVE_CONFIGURE="-DCMAKE_FIND_ROOT_PATH_MODE_PROGRAM=NEVER -DCMAKE_FIND_ROOT_PATH_MODE_LIBRARY=ONLY -DCMAKE_FIND_ROOT_PATH_MODE_INCLUDE=ONLY -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DCMAKE_SYSTEM_NAME=Windows" CURL_CONFIGURE="-DCMAKE_FIND_ROOT_PATH_MODE_PROGRAM=NEVER -DCMAKE_FIND_ROOT_PATH_MODE_LIBRARY=ONLY -DCMAKE_FIND_ROOT_PATH_MODE_INCLUDE=ONLY -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DCMAKE_SYSTEM_NAME=Windows" GIT2_CONFIGURE="-DCMAKE_FIND_ROOT_PATH_MODE_PROGRAM=NEVER -DCMAKE_FIND_ROOT_PATH_MODE_LIBRARY=ONLY -DCMAKE_FIND_ROOT_PATH_MODE_INCLUDE=ONLY -DBUILD_CLAR=OFF -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DCMAKE_SYSTEM_NAME=Windows -DDLLTOOL=x86_64-w64-mingw32-dlltool" SSL_CONFIGURE=mingw ./build.sh -DLPM_VERSION='"'$VERSION-x86_64-windows-`git rev-parse --short HEAD`'"' && zip -r lpm-$VERSION-x86_64-windows.zip lpm.exe + sudo apt-get install mingw-w64 && ./build.sh clean && CC=x86_64-w64-mingw32-gcc AR=x86_64-w64-mingw32-gcc-ar WINDRES=x86_64-w64-mingw32-windres LZMA_CONFIGURE="--host=x86_64-w64-mingw32" ARCHIVE_CONFIGURE="-DCMAKE_FIND_ROOT_PATH_MODE_PROGRAM=NEVER -DCMAKE_FIND_ROOT_PATH_MODE_LIBRARY=ONLY -DCMAKE_FIND_ROOT_PATH_MODE_INCLUDE=ONLY -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DCMAKE_SYSTEM_NAME=Windows" CURL_CONFIGURE="-DCMAKE_FIND_ROOT_PATH_MODE_PROGRAM=NEVER -DCMAKE_FIND_ROOT_PATH_MODE_LIBRARY=ONLY -DCMAKE_FIND_ROOT_PATH_MODE_INCLUDE=ONLY -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DCMAKE_SYSTEM_NAME=Windows" GIT2_CONFIGURE="-DCMAKE_FIND_ROOT_PATH_MODE_PROGRAM=NEVER -DCMAKE_FIND_ROOT_PATH_MODE_LIBRARY=ONLY -DCMAKE_FIND_ROOT_PATH_MODE_INCLUDE=ONLY -DBUILD_CLAR=OFF -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DCMAKE_SYSTEM_NAME=Windows -DDLLTOOL=x86_64-w64-mingw32-dlltool" SSL_CONFIGURE="no-tests mingw" ./build.sh -DLPM_VERSION='"'$VERSION-x86_64-windows-`git rev-parse --short HEAD`'"' && zip -r lpm-$VERSION-x86_64-windows.zip lpm.exe cp lpm.exe lpm.x86_64-windows.exe - name: Create Release(s) env: { GITHUB_TOKEN: "${{ github.token }}" } @@ -37,9 +37,9 @@ jobs: gh release create -t v$RELEASE v$RELEASE lpm.x86_64-linux lpm.x86_64-windows.exe git checkout master && git config user.email "adamdharrison@gmail.com" && git config user.name "Adam Harrison" cat manifest.json | - jq ".plugins[0].files[0].checksum = "'"'"`sha256sum lpm.x86_64-linux | sed 's/ .*//'`"'"' | - jq ".plugins[0].files[1].checksum = "'"'"`sha256sum lpm.x86_64-windows.exe | sed 's/ .*//'`"'"' | - jq ".plugins[0].version = "'"'"$RELEASE"'"' > new-manifest.json + jq ".plugins[0].files[0].checksum = "'"'"`sha256sum lpm.x86_64-linux | sed 's/ .*//'`"'"' | + jq ".plugins[0].files[1].checksum = "'"'"`sha256sum lpm.x86_64-windows.exe | sed 's/ .*//'`"'"' | + jq ".plugins[0].version = "'"'"$RELEASE"'"' > new-manifest.json mv new-manifest.json manifest.json && git add manifest.json && git commit -m 'Updated manifest.json with updated release checksums.' && git push fi @@ -28,6 +28,20 @@ CI is enabled on this repository, so you can grab Windows and Linux builds from You can get a feel for how to use `lpm` by typing `./lpm --help`. +## Supporting Libraries + +Unlike lite, due to the precense of the beast of a library that is OpenSSL, I've made no attempt to limit the amount +of libraries being linked in here, I'm only ensuring that everything can be linked statically as much as possible. As +seen with the `lib` folder, the following external libraries are used to build `lpm`: + +* lua (core program written in) +* OpenSSL (https/SSL support) +* libgit2 (accessing git repositories directly) +* liblzma (supporting library for archives) +* libz (supporting library for everything) +* libcurl (for fetching .tar.gz and .zip files) +* libarchive (for unpacking .tar.gz and .zip files) + ## Use in CI To make pre-fab lite builds, you can easily use `lpm` in CI. If you had a linux build container, you could do something like: @@ -872,6 +872,7 @@ function LiteXL.new(repository, metadata) repository = repository, version = metadata.version, remote = metadata.remote, + url = metadata.url, tags = metadata.tags or {}, mod_version = metadata.mod_version, path = metadata.path, @@ -895,7 +896,7 @@ function LiteXL:is_installed() end function LiteXL:install() - if self:is_installed() then log_warning("lite-xl " .. self.version .. " already installed") end + if self:is_installed() then log_warning("lite-xl " .. self.version .. " already installed") return end common.mkdirp(self.local_path) if system_bottle.lite_xl == self then -- system lite-xl. We have to copy it because we can't really set the user directory. local executable, datadir = common.path("lite-xl") @@ -910,16 +911,24 @@ function LiteXL:install() elseif self.path and not self.repository then -- local repository system.symlink(self.local_path .. PATHSEP .. "lite_xl", self.path .. PATHSEP .. "lite_xl") else - system.init(self.local_path, self.remote) - system.reset(self.local_path, self.commit or self.branch) + if self.remote then + system.init(self.local_path, self.remote) + system.reset(self.local_path, self.commit or self.branch) + end for i,file in ipairs(self.files or {}) do if file.arch and file.arch == ARCH then if not file.checksum then error("requires a checksum") end - local path = self.local_path .. PATHSEP .. "lite-xl" + local archive = basename:find("%.zip$") or basename:find("%.tar%.gz$") + local basename = common.basename(file.url) + local path = self.local_path .. PATHSEP .. (archive and basename or "lite-xl") log_action("Downloading file " .. file.url .. "...") common.get(file.url, path, file.checksum) log_action("Downloaded file " .. file.url .. " to " .. path) if system.hash(path, "file") ~= file.checksum then fatal_warning("checksum doesn't match for " .. path) end + if archive then + log_action("Extracting file " .. basename .. " in " .. self.local_path) + system.extract(path, self.local_path) + end end end end |