Skip to content
This repository was archived by the owner on Apr 10, 2025. It is now read-only.

Commit 7f225e2

Browse files
authored
Add format_binary_url.sh (#1331)
1 parent 4d728fc commit 7f225e2

File tree

4 files changed

+28
-3
lines changed

4 files changed

+28
-3
lines changed

PSOL_BINARY_URL

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
In a release this file would contain the URL to download the pre-compiled PSOL
22
binary, but on development branches (like this one) you have to build PSOL from
33
source yourself. See:
4-
https://github.com/pagespeed/ngx_pagespeed/wiki/Building-PSOL-From-Source
4+
https://github.com/pagespeed/ngx_pagespeed/wiki/Building-PSOL-From-Source

config

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ if [ "$mod_pagespeed_dir" = "unset" ] ; then
2626
if [ ! -e "$mod_pagespeed_dir" ] ; then
2727
echo "ngx_pagespeed: pagespeed optimization library not found:"
2828

29-
psol_binary_url="$(cat $ngx_addon_dir/PSOL_BINARY_URL)"
29+
psol_binary_url="$($ngx_addon_dir/scripts/format_binary_url.sh \
30+
$ngx_addon_dir/PSOL_BINARY_URL)"
3031
if [[ "$psol_binary_url" != https://* ]]; then
3132
echo "
3233
This is a development branch of ngx_pagespeed, which means there is no

scripts/build_ngx_pagespeed.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -614,7 +614,7 @@ Not deleting $directory; name is suspiciously short. Something is wrong."
614614
elif [ -e PSOL_BINARY_URL ]; then
615615
# Releases after 1.11.33.4 there is a PSOL_BINARY_URL file that tells us
616616
# where to look.
617-
psol_url="$(cat PSOL_BINARY_URL)"
617+
psol_url="$(scripts/format_binary_url.sh PSOL_BINARY_URL)"
618618
if [[ "$psol_url" != https://* ]]; then
619619
fail "Got bad psol binary location information: $psol_url"
620620
fi

scripts/format_binary_url.sh

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#!/bin/bash
2+
3+
set -e
4+
set -u
5+
6+
if [ $# -ne 1 ]; then
7+
echo "Usage: $(basename $0) <url_file>" >&2
8+
exit 1
9+
fi
10+
11+
url_file=$1
12+
13+
if [ ! -e "$url_file" ]; then
14+
echo "Url file '$url_file' missing!" >&2
15+
fi
16+
17+
# The size names must match install/build_psol.sh in mod_pagespeed
18+
if [ "$(uname -m)" = x86_64 ]; then
19+
bit_size_name=x64
20+
else
21+
bit_size_name=ia32
22+
fi
23+
24+
sed -e 's/$BIT_SIZE_NAME\b/'$bit_size_name'/g' $url_file

0 commit comments

Comments
 (0)