Skip to content

Commit

Permalink
Modify static build for collation feature
Browse files Browse the repository at this point in the history
  • Loading branch information
izderadicka committed Nov 27, 2021
1 parent 0a7087e commit e564aad
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 7 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ transcoding-cache=["simple-file-cache", "tokio-util"]
partially-static = ["collection/partially-static"]
static = ["collection/static"]
collation = ["collection/collation"]

collation-static = ["collection/collation-static"]



Expand Down
2 changes: 1 addition & 1 deletion Dockerfile.static
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ ENV FEATURES=""
RUN apk update &&\
apk upgrade &&\
apk add git bash curl yasm build-base openssl-dev openssl-libs-static\
wget zlib-dev zlib-static bzip2-static bzip2-dev rustup npm &&\
wget zlib-dev zlib-static bzip2-static bzip2-dev rustup npm clang-static icu-static perl &&\
rustup-init -y &&\
chmod -R 0777 /root &&\
mkdir /src &&\
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,7 @@ To add non-default features (like `transcoding-cache`) compile with this option
| static | Enables fully static build of audioserve. Check above notes for static build | No |
| partially-static | Statically links libavformat (and related).Enables to run audioserve on systems, which do not have required version of libavformat | No |
| folder-download-default-tar | Default folder download format is tar (instead of zip) | No |
| collation | Supports locale collation (does not work with static build now) | No | Env. variables AUDIOSERVE_COLLATE, LC_ALL, LC_COLLATE, LANG determine locale used |
| collation or collation-static | Supports locale collation (for static build second option must be used!) | No | Env. variables AUDIOSERVE_COLLATE, LC_ALL, LC_COLLATE, LANG determine locale used |

## License

Expand Down
10 changes: 10 additions & 0 deletions _build_static.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,16 @@ BUILD_DIR="_static_build"
TARGET=x86_64-unknown-linux-musl
export HOME=/root

#Workaround for static builb of rust_uci
if [[ "$FEATURES" =~ "collation" ]]; then
# assure that collation-static is used
FEATURES=$(echo $FEATURES | perl -pe 's/collation(?!\-static)/collation-static/g' )
export RUST_ICU_MAJOR_VERSION_NUMBER=67
export RUSTFLAGS=$RUSTFLAGS" -L native=/usr/lib -l static=clang -l static=icui18n -l static=icuuc -l static=icudata -l static=stdc++"
fi

echo "RUSTFLAGS: $RUSTFLAGS"

cargo build --target $TARGET --release ${CARGO_ARGS} --features static,${FEATURES}
cd client
npm install
Expand Down
5 changes: 3 additions & 2 deletions build_static.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,6 @@ if [[ -n "$CARGO_ARGS" ]]; then
fi

docker build --tag audioserve-builder -f Dockerfile.static .
# if repeated build are done it can be made faster by mapping volumes to /.cargo and /.npm
docker run -i --rm -v $(pwd):/src -u $(id -u) $OPTS_ARGS audioserve-builder
# if repeated build are done it can be made faster by mapping volumes to root/.cargo and root/.npm
docker run -i --rm -v $(pwd):/src -u $(id -u) --mount type=volume,src=audioserve_static_build_cargo,dst=/root/.cargo \
$OPTS_ARGS audioserve-builder
5 changes: 3 additions & 2 deletions crates/collection/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,12 @@ crossbeam-channel = "0.5"
enum_dispatch = "0.3"

tokio = {version="1", optional=true, features=["rt"]}
rust_icu_ucol = {version="1.0", optional=true}
rust_icu_ucol = {version="1.0", default-features=false, features=["renaming"], optional=true}

[features]
partially-static = ["media_info/partially-static"]
static = ["media_info/static"]
async = ["tokio"]
symlinks = []
collation = ["rust_icu_ucol"]
collation = ["rust_icu_ucol/use-bindgen", "rust_icu_ucol/icu_config"]
collation-static = ["rust_icu_ucol/renaming", "rust_icu_ucol/icu_version_in_env"]

0 comments on commit e564aad

Please sign in to comment.