Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add support to x64 systems using musl #632

Open
wants to merge 15 commits into
base: master
Choose a base branch
from
Prev Previous commit
Next Next commit
fix: update alpine image
  • Loading branch information
samyuh committed Jan 17, 2025
commit 70e710c9b8f6783bf58a7faa64ae6ff80e4912db
34 changes: 1 addition & 33 deletions docker/Dockerfile.alpine
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ FROM alpine:3.18

# Install build dependencies
RUN apk add --no-cache \
openjdk11 \
cmake \
make \
gcc \
Expand All @@ -11,38 +10,7 @@ RUN apk add --no-cache \
linux-headers

# Set workspace directory
WORKDIR /workspace

# Copy the source code
COPY . .
WORKDIR /work

# Build the project
ENV CC=gcc CXX=g++ TARGET_OS=Linux-musl

# Install Maven
RUN apk add --no-cache maven

# Build with Maven
RUN mvn package -Dlibrary.name=libsnappyjava.so -DskipTests -DskipJavadoc=true

# Install snappy dependencies
RUN apk add --no-cache snappy-dev

# Compile and link statically
RUN cd target/native/Linux-musl/x86_64 && \
${CXX} -std=c++11 -O2 -fPIC -DPIC -D_GNU_SOURCE \
-I../../../../src/main/java/org/xerial/snappy/ \
-I/usr/include \
-shared -static-libstdc++ -static-libgcc \
../../../../src/main/java/org/xerial/snappy/SnappyNative.cpp \
-L/usr/lib -lsnappy \
-o libsnappyjava.so

# Create necessary directories
RUN mkdir -p src/main/resources/org/xerial/snappy/native/Linux-musl/x86_64/

# Copy the built library
RUN cp target/native/Linux-musl/x86_64/libsnappyjava.so src/main/resources/org/xerial/snappy/native/Linux-musl/x86_64/

# Set the entry point
ENTRYPOINT ["java"]
Loading