Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,21 @@ jobs:
strategy:
matrix:
EMSCRIPTEN_VERSION: [ '3.1.12','3.1.34','3.1.56' ]
multithreaded: [true, false]
simd: [true, false]
steps:
- uses: actions/checkout@v2

- name: Build unoicu.a
run: |
pushd src/unoicu
docker build --build-arg EMSCRIPTEN_VERSION=${{ matrix.EMSCRIPTEN_VERSION }} --output type=local,dest=./out .
docker build --build-arg EMSCRIPTEN_VERSION=${{ matrix.EMSCRIPTEN_VERSION }} --build-arg IS_MULTITHREADED=${{ matrix.multithreaded }} --build-arg IS_SIMD_SUPPORTED=${{ matrix.simd }} --output type=local,dest=out/${{ matrix.EMSCRIPTEN_VERSION }}/${{ matrix.multithreaded == 'true' && 'mt' || 'st' }}${{ matrix.simd == 'true' && ',simd' || '' }} .
popd

- name: Upload unoicu.a
uses: actions/upload-artifact@v4
with:
name: unoicu-${{ matrix.EMSCRIPTEN_VERSION }}
name: unoicu-${{ matrix.EMSCRIPTEN_VERSION }}-${{ matrix.multithreaded == 'true' && 'mt' || 'st' }}-${{ matrix.simd == 'true' && 'simd' || 'nosimd' }}
path: ./src/unoicu/out

build_icudt:
Expand Down Expand Up @@ -86,9 +88,7 @@ jobs:
mkdir -p ./nuget/buildTransitive/native/unoicu.a
pushd merged-artifacts
for dir in unoicu-*; do
new_name="${dir#unoicu-}"
mkdir -p ../nuget/buildTransitive/native/unoicu.a/"$new_name"/st
cp -r "$dir"/unoicu.a ../nuget/buildTransitive/native/unoicu.a/"$new_name"/st/unoicu.a
cp -r "$dir"/** ../nuget/buildTransitive/native/unoicu.a/
done
popd

Expand Down
18 changes: 15 additions & 3 deletions src/unoicu/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Build this Dockerfile with "docker build --build-arg EMSCRIPTEN_VERSION=<your-version> --output type=local,dest=. ." to get the unoicu.a file in the currect directory
# Build this Dockerfile with "docker build --build-arg EMSCRIPTEN_VERSION=<your-version> --build-arg IS_MULTITHREADED=<true|false> --build-arg IS_SIMD_SUPPORTED=<true|false> --output type=local,dest=. ." to get the unoicu.a file in the currect directory
ARG EMSCRIPTEN_VERSION

FROM docker.io/emscripten/emsdk:${EMSCRIPTEN_VERSION} AS build
Expand All @@ -11,10 +11,23 @@ RUN wget https://github.com/unicode-org/icu/archive/refs/tags/release-77-1.zip
RUN unzip release-77-1.zip
WORKDIR icu-release-77-1/icu4c/source

ARG IS_MULTITHREADED
ARG IS_SIMD_SUPPORTED


# Thanks to https://github.com/echogarden-project/icu-segmentation-wasm/blob/1f0c7381f76e0d38784dd6ad23fed5f6365da319/docs/Building.md
# for documenting the necessary configure options

RUN emconfigure ./configure --enable-static --disable-shared --with-data-packaging=static --disable-tests --disable-samples --disable-tools --disable-extras CFLAGS="-O3 -std=c11" CXXFLAGS="-O3 -std=c++17"
RUN emconfigure ./configure \
--enable-static \
--disable-shared \
--with-data-packaging=static \
--disable-tests \
--disable-samples \
--disable-tools \
--disable-extras \
CFLAGS="-O3 -std=c11 $([ "$IS_MULTITHREADED" = "true" ] && echo "-pthread") $([ "$IS_SIMD_SUPPORTED" = "true" ] && echo "-msimd128")" \
CXXFLAGS="-O3 -std=c++17 $([ "$IS_MULTITHREADED" = "true" ] && echo "-pthread") $([ "$IS_SIMD_SUPPORTED" = "true" ] && echo "-msimd128")"
RUN emmake make -j $(nproc)

COPY unoicu.c .
Expand All @@ -23,6 +36,5 @@ RUN emar x lib/libicuuc.a
RUN emar x stubdata/libicudata.a
RUN emar rc unoicu.a *.ao unoicu.o


FROM scratch
COPY --from=build /icu/icu-release-77-1/icu4c/source/unoicu.a /
Loading