Skip to content

Commit 215acc0

Browse files
committed
use tabs everywhere
1 parent 21e4baa commit 215acc0

File tree

1 file changed

+56
-56
lines changed

1 file changed

+56
-56
lines changed

build-static.sh

Lines changed: 56 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -29,19 +29,19 @@ os="$(uname -s | tr '[:upper:]' '[:lower:]')"
2929

3030
# init spc command, if we use spc binary, just use it instead of fetching source
3131
if [ -z "${SPC_REL_TYPE}" ]; then
32-
SPC_REL_TYPE="source"
32+
SPC_REL_TYPE="source"
3333
fi
3434
# init spc build additional args
3535
if [ -z "${SPC_OPT_BUILD_ARGS}" ]; then
36-
SPC_OPT_BUILD_ARGS="--debug"
36+
SPC_OPT_BUILD_ARGS="--debug"
3737
fi
3838
# init spc download additional args
3939
if [ -z "${SPC_OPT_DOWNLOAD_ARGS}" ]; then
40-
SPC_OPT_DOWNLOAD_ARGS="--prefer-pre-built --debug --ignore-cache-sources=php-src"
40+
SPC_OPT_DOWNLOAD_ARGS="--prefer-pre-built --debug --ignore-cache-sources=php-src"
4141
fi
4242
# if we need debug symbols, disable strip
4343
if [ -n "${DEBUG_SYMBOLS}" ]; then
44-
SPC_OPT_BUILD_ARGS="${SPC_OPT_BUILD_ARGS} --no-strip"
44+
SPC_OPT_BUILD_ARGS="${SPC_OPT_BUILD_ARGS} --no-strip"
4545
fi
4646
# php version to build
4747
if [ -z "${PHP_VERSION}" ]; then
@@ -83,11 +83,11 @@ elif [ -d ".git/" ]; then
8383

8484
if echo "${FRANKENPHP_VERSION}" | grep -F -q "."; then
8585
# Tag
86-
86+
8787
# Trim "v" prefix if any
8888
FRANKENPHP_VERSION=${FRANKENPHP_VERSION#v}
8989
export FRANKENPHP_VERSION
90-
90+
9191
git checkout "v${FRANKENPHP_VERSION}"
9292
else
9393
git checkout "${FRANKENPHP_VERSION}"
@@ -129,42 +129,42 @@ else
129129
fi
130130

131131
if [ "${SPC_REL_TYPE}" = "binary" ]; then
132-
mkdir static-php-cli/
133-
cd static-php-cli/
134-
curl -o spc -fsSL https://dl.static-php.dev/static-php-cli/spc-bin/nightly/spc-linux-$(uname -m)
135-
chmod +x spc
136-
spcCommand="./spc"
137-
elif [ -d "static-php-cli/src" ]; then
138-
cd static-php-cli/
139-
git pull
140-
composer install --no-dev -a
141-
spcCommand="./bin/spc"
142-
else
143-
git clone --depth 1 https://github.com/crazywhalecc/static-php-cli --branch main
144-
cd static-php-cli/
145-
composer install --no-dev -a
146-
spcCommand="./bin/spc"
147-
fi
148-
149-
# extensions to build
150-
if [ -z "${PHP_EXTENSIONS}" ]; then
151-
# enable EMBED mode, first check if project has dumped extensions
152-
if [ -n "${EMBED}" ] && [ -f "${EMBED}/composer.json" ] && [ -f "${EMBED}/composer.lock" ] && [ -f "${EMBED}/vendor/installed.json" ]; then
153-
cd "${EMBED}"
154-
# read the extensions using spc dump-extensions
155-
PHP_EXTENSIONS=$(${spcCommand} dump-extensions "${EMBED}" --format=text --no-dev --no-ext-output="${defaultExtensions}")
156-
else
157-
PHP_EXTENSIONS="${defaultExtensions}"
158-
fi
159-
fi
160-
# additional libs to build
161-
if [ -z "${PHP_EXTENSION_LIBS}" ]; then
162-
PHP_EXTENSION_LIBS="${defaultExtensionLibs}"
163-
fi
164-
# The Brotli library must always be built as it is required by http://github.com/dunglas/caddy-cbrotli
165-
if ! echo "${PHP_EXTENSION_LIBS}" | grep -q "\bbrotli\b"; then
166-
PHP_EXTENSION_LIBS="${PHP_EXTENSION_LIBS},brotli"
167-
fi
132+
mkdir static-php-cli/
133+
cd static-php-cli/
134+
curl -o spc -fsSL https://dl.static-php.dev/static-php-cli/spc-bin/nightly/spc-linux-$(uname -m)
135+
chmod +x spc
136+
spcCommand="./spc"
137+
elif [ -d "static-php-cli/src" ]; then
138+
cd static-php-cli/
139+
git pull
140+
composer install --no-dev -a
141+
spcCommand="./bin/spc"
142+
else
143+
git clone --depth 1 https://github.com/crazywhalecc/static-php-cli --branch main
144+
cd static-php-cli/
145+
composer install --no-dev -a
146+
spcCommand="./bin/spc"
147+
fi
148+
149+
# extensions to build
150+
if [ -z "${PHP_EXTENSIONS}" ]; then
151+
# enable EMBED mode, first check if project has dumped extensions
152+
if [ -n "${EMBED}" ] && [ -f "${EMBED}/composer.json" ] && [ -f "${EMBED}/composer.lock" ] && [ -f "${EMBED}/vendor/installed.json" ]; then
153+
cd "${EMBED}"
154+
# read the extensions using spc dump-extensions
155+
PHP_EXTENSIONS=$(${spcCommand} dump-extensions "${EMBED}" --format=text --no-dev --no-ext-output="${defaultExtensions}")
156+
else
157+
PHP_EXTENSIONS="${defaultExtensions}"
158+
fi
159+
fi
160+
# additional libs to build
161+
if [ -z "${PHP_EXTENSION_LIBS}" ]; then
162+
PHP_EXTENSION_LIBS="${defaultExtensionLibs}"
163+
fi
164+
# The Brotli library must always be built as it is required by http://github.com/dunglas/caddy-cbrotli
165+
if ! echo "${PHP_EXTENSION_LIBS}" | grep -q "\bbrotli\b"; then
166+
PHP_EXTENSION_LIBS="${PHP_EXTENSION_LIBS},brotli"
167+
fi
168168

169169
${spcCommand} doctor --auto-fix
170170
${spcCommand} download --with-php="${PHP_VERSION}" --for-extensions="${PHP_EXTENSIONS}" --for-libs="${PHP_EXTENSION_LIBS}" ${SPC_OPT_DOWNLOAD_ARGS}
@@ -192,17 +192,17 @@ fi
192192
mkdir -p watcher
193193
cd watcher
194194
curl -f --retry 5 "${curlGitHubHeaders[@]}" https://api.github.com/repos/e-dant/watcher/releases/latest |
195-
grep tarball_url |
196-
awk '{ print $2 }' |
197-
sed 's/,$//' |
198-
sed 's/"//g' |
199-
xargs curl -fL --retry 5 "${curlGitHubHeaders[@]}" |
200-
tar xz --strip-components 1
195+
grep tarball_url |
196+
awk '{ print $2 }' |
197+
sed 's/,$//' |
198+
sed 's/"//g' |
199+
xargs curl -fL --retry 5 "${curlGitHubHeaders[@]}" |
200+
tar xz --strip-components 1
201201
cd watcher-c
202202
if [ -z "${CC}" ]; then
203-
watcherCC=cc
203+
watcherCC=cc
204204
else
205-
watcherCC="${CC}"
205+
watcherCC="${CC}"
206206
fi
207207
${watcherCC} -c -o libwatcher-c.o ./src/watcher-c.cpp -I ./include -I ../include -std=c++17 -Wall -Wextra "${fpic}"
208208
ar rcs libwatcher-c.a libwatcher-c.o
@@ -227,7 +227,7 @@ elif [ "${os}" = "linux" ] && [ -z "${DEBUG_SYMBOLS}" ]; then
227227
CGO_LDFLAGS="-Wl,-O1 -pie"
228228
fi
229229
if [ "${os}" = "linux" ] && [ "${SPC_LIBC}" = "glibc" ]; then
230-
CGO_LDFLAGS="${CGO_LDFLAGS} -Wl,--allow-multiple-definition -Wl,--export-dynamic"
230+
CGO_LDFLAGS="${CGO_LDFLAGS} -Wl,--allow-multiple-definition -Wl,--export-dynamic"
231231
fi
232232

233233
CGO_LDFLAGS="${CGO_LDFLAGS} ${PWD}/buildroot/lib/libbrotlicommon.a ${PWD}/buildroot/lib/libbrotlienc.a ${PWD}/buildroot/lib/libbrotlidec.a ${PWD}/buildroot/lib/libwatcher-c.a $(${spcCommand} spc-config "${PHP_EXTENSIONS}" --with-libs="${PHP_EXTENSION_LIBS}" --libs)"
@@ -236,9 +236,9 @@ if [ "${os}" = "linux" ]; then
236236
CGO_LDFLAGS="${CGO_LDFLAGS} -lstdc++"
237237
fi
238238
if [ "${SPC_LIBC}" = "glibc" ]; then
239-
CGO_LDFLAGS=$(echo "$CGO_LDFLAGS" | sed 's|-lphp|-Wl,--whole-archive -lphp -Wl,--no-whole-archive|g')
240-
ar d ${PWD}/buildroot/lib/libphp.a $(ar t ${PWD}/buildroot/lib/libphp.a | grep '\.a$')
241-
fi
239+
CGO_LDFLAGS=$(echo "$CGO_LDFLAGS" | sed 's|-lphp|-Wl,--whole-archive -lphp -Wl,--no-whole-archive|g')
240+
ar d ${PWD}/buildroot/lib/libphp.a $(ar t ${PWD}/buildroot/lib/libphp.a | grep '\.a$')
241+
fi
242242
fi
243243

244244
export CGO_LDFLAGS
@@ -348,9 +348,9 @@ fi
348348
go env
349349
cd caddy/
350350
if [ -z "${SPC_LIBC}" ] || [ "${SPC_LIBC}" = "musl" ]; then
351-
xcaddyGoBuildFlags="-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'\""
351+
xcaddyGoBuildFlags="-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'\""
352352
elif [ "${SPC_LIBC}" = "glibc" ]; then
353-
xcaddyGoBuildFlags="-buildmode=pie -tags cgo,netgo,osusergo,nobadger,nomysql,nopgx -ldflags \"-linkmode=external -extldflags '-pie ${extraExtldflags}' ${extraLdflags} -X 'github.com/caddyserver/caddy/v2.CustomVersion=FrankenPHP ${FRANKENPHP_VERSION} PHP ${LIBPHP_VERSION} Caddy'\""
353+
xcaddyGoBuildFlags="-buildmode=pie -tags cgo,netgo,osusergo,nobadger,nomysql,nopgx -ldflags \"-linkmode=external -extldflags '-pie ${extraExtldflags}' ${extraLdflags} -X 'github.com/caddyserver/caddy/v2.CustomVersion=FrankenPHP ${FRANKENPHP_VERSION} PHP ${LIBPHP_VERSION} Caddy'\""
354354
fi
355355

356356
# shellcheck disable=SC2086

0 commit comments

Comments
 (0)