Skip to content

Commit

Permalink
fix(static): check command go and xcaddy in build-static.sh (#1298)
Browse files Browse the repository at this point in the history
Co-authored-by: Kévin Dunglas <[email protected]>
  • Loading branch information
ddevsr and dunglas authored Jan 8, 2025
1 parent 479ba0a commit 72120d7
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions build-static.sh
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,15 @@ else
${spcCommand} build --debug --enable-zts --build-embed ${extraOpts} "${PHP_EXTENSIONS}" --with-libs="${PHP_EXTENSION_LIBS}"
fi

if ! type "xcaddy" >/dev/null 2>&1; then
if ! type "go" >/dev/null 2>&1; then
echo "The \"go\" command must be installed."
exit 1
fi

XCADDY_COMMAND="xcaddy"
if ! type "$XCADDY_COMMAND" >/dev/null 2>&1; then
go install github.com/caddyserver/xcaddy/cmd/xcaddy@latest
XCADDY_COMMAND="$(go env GOPATH)/bin/xcaddy"
fi

curlGitHubHeaders=(--header "X-GitHub-Api-Version: 2022-11-28")
Expand Down Expand Up @@ -296,7 +303,7 @@ cd caddy/
CGO_ENABLED=1 \
XCADDY_GO_BUILD_FLAGS="-buildmode=pie -tags cgo,netgo,osusergo,static_build,nobadger,nomysql,nopgx -ldflags \"-linkmode=external -extldflags '-static-pie ${extraExtldflags}' ${extraLdflags} -X 'github.com/caddyserver/caddy/v2.CustomVersion=FrankenPHP ${FRANKENPHP_VERSION} PHP ${LIBPHP_VERSION} Caddy'\"" \
XCADDY_DEBUG="${XCADDY_DEBUG}" \
xcaddy build \
${XCADDY_COMMAND} build \
--output "../dist/${bin}" \
${XCADDY_ARGS} \
--with github.com/dunglas/frankenphp=.. \
Expand Down

0 comments on commit 72120d7

Please sign in to comment.