Skip to content

Commit 476e037

Browse files
macos and windows
1 parent 6673245 commit 476e037

File tree

5 files changed

+70
-13
lines changed

5 files changed

+70
-13
lines changed

.github/docker/Dockerfile.glibc

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
ARG UBUNTU_VERSION=bionic
2+
FROM ubuntu:${UBUNTU_VERSION} AS build
3+
4+
ARG NODE_VERSION=16.20.1
5+
# Possible values: s390x, arm64, x64
6+
ARG NODE_ARCH
7+
ADD https://nodejs.org/dist/v${NODE_VERSION}/node-v${NODE_VERSION}-linux-${NODE_ARCH}.tar.gz /
8+
RUN mkdir -p /nodejs && tar -xzf /node-v${NODE_VERSION}-linux-${NODE_ARCH}.tar.gz --strip-components=1 -C /nodejs
9+
ENV PATH=$PATH:/nodejs/bin
10+
11+
WORKDIR /zstd
12+
COPY . .
13+
14+
RUN apt-get -qq update && apt-get -qq install -y python3 build-essential curl cmake && ldd --version
15+
16+
RUN npm run install-zstd && npm install
17+
18+
ARG RUN_TEST
19+
RUN [ -n "$RUN_TEST" ] && npm test || echo 'skipping testing!'

.github/docker/Dockerfile.musl

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
2+
ARG PLATFORM=amd64
3+
ARG NODE_VERSION=16.20.1
4+
5+
FROM ${PLATFORM}/node:${NODE_VERSION}-alpine AS node
6+
7+
WORKDIR /zstd
8+
COPY . .
9+
10+
RUN apk --no-cache add make g++ libc-dev curl bash python3 py3-pip vim cmake
11+
RUN npm run install-zstd && npm i
12+
13+
ARG RUN_TEST
14+
RUN [ -n "$RUN_TEST" ] && npm test || echo 'skipping testing!'

.github/workflows/test.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@ jobs:
1111
host_tests:
1212
strategy:
1313
matrix:
14-
# os: [macos-latest, windows-2019]
15-
os: ['ubuntu-latest']
14+
os: [macos-latest, windows-2019]
1615
node: [16.20.1, 18.x, 20.x, 22.x]
1716
runs-on: ${{ matrix.os }}
1817
steps:

binding.gyp

Lines changed: 32 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,22 +17,45 @@
1717
'addon/compression.h',
1818
'addon/compression.cpp'
1919
],
20+
'conditions': [
21+
[
22+
'OS=="win"',
23+
{
24+
'link_settings': {
25+
'libraries': [
26+
'<(module_root_dir)/deps/zstd/build/cmake/lib/Debug/zstd_static.lib'
27+
]
28+
},
29+
},
30+
{ # macos and linux
31+
'link_settings': {
32+
'libraries': [
33+
'<(module_root_dir)/deps/zstd/build/cmake/lib/libzstd.a',
34+
]
35+
},
36+
}
37+
]
38+
],
39+
'cflags!': [ '-fno-exceptions' ],
40+
'cflags_cc!': [ '-fno-exceptions' ],
41+
'cflags_cc': ['-std=c++17'],
2042
'xcode_settings': {
2143
'GCC_ENABLE_CPP_EXCEPTIONS': 'YES',
2244
'CLANG_CXX_LIBRARY': 'libc++',
2345
'MACOSX_DEPLOYMENT_TARGET': '11',
2446
'GCC_SYMBOLS_PRIVATE_EXTERN': 'YES', # -fvisibility=hidden
47+
'OTHER_CFLAGS': [
48+
'-std=c++17',
49+
'-stdlib=libc++'
50+
],
2551
},
26-
'cflags!': [ '-fno-exceptions' ],
27-
'cflags_cc!': [ '-fno-exceptions' ],
28-
'cflags_cc': ['-std=c++17'],
2952
'msvs_settings': {
30-
'VCCLCompilerTool': { 'ExceptionHandling': 1 },
31-
},
32-
'link_settings': {
33-
'libraries': [
34-
'<(module_root_dir)/deps/zstd/build/cmake/lib/libzstd.a',
35-
]
53+
'VCCLCompilerTool': {
54+
'ExceptionHandling': 1,
55+
'AdditionalOptions': [
56+
'-std:c++17'
57+
]
58+
}
3659
},
3760
}]
3861
}

etc/install-zstd.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,10 @@ build_zstd() {
1717
export MACOSX_DEPLOYMENT_TARGET=11
1818
cd deps/zstd/build/cmake
1919

20-
cmake .
21-
make
20+
# CMAKE_RC_FLAGS is a workaround for a bug in 1.5.6 that breaks compilation on windows.
21+
# The fix is merged but not yet released. see https://github.com/facebook/zstd/issues/3999
22+
cmake -DCMAKE_RC_FLAGS="$(pwd)/lib" -DZSTD_MULTITHREAD_SUPPORT=OFF -DZSTD_BUILD_SHARED=OFF .
23+
cmake --build .
2224
}
2325

2426
clean_deps

0 commit comments

Comments
 (0)