diff options
| author | Adam Malczewski <[email protected]> | 2026-06-02 21:57:06 +0900 |
|---|---|---|
| committer | Adam Malczewski <[email protected]> | 2026-06-02 21:57:06 +0900 |
| commit | 4b45d33c256cf580a53054078be6fd7148fa6302 (patch) | |
| tree | 0f549e08607f083d1f04306ce35e132923d6e3d3 /packaging | |
| parent | d9f53727845dface3e6d8a84ba2270b1de55482b (diff) | |
| download | dispatch-4b45d33c256cf580a53054078be6fd7148fa6302.tar.gz dispatch-4b45d33c256cf580a53054078be6fd7148fa6302.zip | |
Fix build scripts and deployment port issue
Diffstat (limited to 'packaging')
| -rw-r--r-- | packaging/PKGBUILD | 51 |
1 files changed, 32 insertions, 19 deletions
diff --git a/packaging/PKGBUILD b/packaging/PKGBUILD index 878b15f..323f9cc 100644 --- a/packaging/PKGBUILD +++ b/packaging/PKGBUILD @@ -61,25 +61,38 @@ build() { rm -rf node_modules bun install --frozen-lockfile --production - # --- Build the patched `cs` code-search binary for the search_code tool --- - # Clone the pinned cs commit, apply the Luau declaration + fuzzy-distance - # patches, and build a - # statically-linked binary. cs vendors its deps, so `go build -mod=vendor` - # needs no network beyond the clone. Mirrors the Docker cs-builder stage. - # - # rm -rf first so a rerun (makepkg -e, or two invocations without -C) that - # reuses $srcdir doesn't abort on "destination path already exists". This - # PKGBUILD intentionally avoids source=() (the s6 service files share - # basenames and would collide in $srcdir), so we clone here rather than via - # makepkg's VCS source handling. - rm -rf "${srcdir}/cs-src" - git clone https://github.com/boyter/cs.git "${srcdir}/cs-src" - cd "${srcdir}/cs-src" - git checkout "${_cs_commit}" - git apply "${_projectdir}/docker/cs/luau-declarations.patch" - git apply "${_projectdir}/docker/cs/fuzzy-distance.patch" - CGO_ENABLED=0 GOFLAGS=-mod=vendor GOPATH="${srcdir}/gopath" GOCACHE="${srcdir}/gocache" \ - go build -ldflags="-s -w" -o "${srcdir}/cs" . + # --- Provide the patched `cs` code-search binary for the search_code tool --- + # Building cs means a network clone + Go compile every run, which is wasted + # work when a matching cs is already on the system: the code-search package + # owns /usr/bin/cs and is pinned to the same _cs_commit. If it's already + # installed, reuse that binary instead of recloning/recompiling. Force a + # fresh build with DISPATCH_FORCE_CS_BUILD=1 (required when bumping + # _cs_commit, since the installed binary won't reflect the new commit). + if [ -z "${DISPATCH_FORCE_CS_BUILD:-}" ] && pacman -Qq code-search &>/dev/null \ + && [ -x /usr/bin/cs ]; then + echo "cs: code-search already installed — reusing /usr/bin/cs" \ + "(set DISPATCH_FORCE_CS_BUILD=1 to rebuild)" + cp /usr/bin/cs "${srcdir}/cs" + else + # Clone the pinned cs commit, apply the Luau declaration + fuzzy-distance + # patches, and build a statically-linked binary. cs vendors its deps, so + # `go build -mod=vendor` needs no network beyond the clone. Mirrors the + # Docker cs-builder stage. + # + # rm -rf first so a rerun (makepkg -e, or two invocations without -C) + # that reuses $srcdir doesn't abort on "destination path already exists". + # This PKGBUILD intentionally avoids source=() (the s6 service files + # share basenames and would collide in $srcdir), so we clone here rather + # than via makepkg's VCS source handling. + rm -rf "${srcdir}/cs-src" + git clone https://github.com/boyter/cs.git "${srcdir}/cs-src" + cd "${srcdir}/cs-src" + git checkout "${_cs_commit}" + git apply "${_projectdir}/docker/cs/luau-declarations.patch" + git apply "${_projectdir}/docker/cs/fuzzy-distance.patch" + CGO_ENABLED=0 GOFLAGS=-mod=vendor GOPATH="${srcdir}/gopath" GOCACHE="${srcdir}/gocache" \ + go build -ldflags="-s -w" -o "${srcdir}/cs" . + fi "${srcdir}/cs" --version } |
