diff --git a/contrib/Makefile b/contrib/Makefile new file mode 100644 index 0000000..244bf89 --- /dev/null +++ b/contrib/Makefile @@ -0,0 +1,8 @@ +BUILD_DIR := $(dir $(abspath $(firstword $(MAKEFILE_LIST)))) +DOCKER := $(shell test -x /usr/bin/podman && echo podman || echo docker) + +build-ubuntu: 22.04 + +18.04 20.04 22.04 24.04: + $(DOCKER) build -f $(BUILD_DIR)/build-ubuntu.Dockerfile --build-arg RELEASE=$@ -t build-awscred-lib . + $(DOCKER) run -ti --rm -v ./:/build build-awscred-lib diff --git a/contrib/README.md b/contrib/README.md new file mode 100644 index 0000000..9190ab3 --- /dev/null +++ b/contrib/README.md @@ -0,0 +1,28 @@ +# Helpers for building s3fs-fuse-awscred-lib + +The tools in this directory can be used to build the library locally, so it can either +be installed manually or just used from the current directory. + +## Requirements: + + - Linux + - Docker, Podman or an alternative container runtime + - GNU Make (optional, read `Makefile` for alternative instructions) + +## Usage + +The provided `Makefile` currently supports building for the currently supported +Ubuntu LTS versions. + +To build all the required binaries, including the test tool, and copy them into the +current directory, run: + +`make -f contrib/Makefile [UBUNTU_VERSION]` + +where `UBUNTU_VERSION` is optional and can be an LTS version number such as `20.04`. +If not specified, `22.04` is used (which is the current latest LTS release). + +After the build is complete, the resulting `.so` files can be manually copied to +someplace in the dynamic linker path (for example `/usr/local/lib`) or can be +loaded directly by setting the environment variable `LD_LIBRARY_PATH` for the +`s3fs` command, e.g. `LD_LIBRARY_PATH=. s3fs …` diff --git a/contrib/build-ubuntu.Dockerfile b/contrib/build-ubuntu.Dockerfile new file mode 100644 index 0000000..47be8e6 --- /dev/null +++ b/contrib/build-ubuntu.Dockerfile @@ -0,0 +1,25 @@ +ARG RELEASE=20.04 +FROM ubuntu:$RELEASE +ARG RELEASE=20.04 +ENV DEBIAN_FRONTEND=noninteractive +ADD ./ /src/s3fs-fuse-awscred-lib +WORKDIR /src/s3fs-fuse-awscred-lib +RUN .github/workflows/linux-ci-helper.sh ubuntu:${RELEASE} +RUN mkdir -p /src/aws-sdk/sdk_build +WORKDIR /src/aws-sdk +RUN git clone --recurse-submodules https://github.com/aws/aws-sdk-cpp +WORKDIR /src/aws-sdk/sdk_build +RUN cmake ../aws-sdk-cpp -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH=${PWD} -DBUILD_ONLY="core;identity-management" -DAUTORUN_UNIT_TESTS=OFF +RUN make +RUN make install +WORKDIR /src/s3fs-fuse-awscred-lib +RUN cmake -S . -B build +RUN cmake --build build +VOLUME /build +CMD mkdir -p /build && cp /src/s3fs-fuse-awscred-lib/build/libs3fsawscred.so \ + /src/s3fs-fuse-awscred-lib/build/s3fsawscred_test \ + /usr/local/lib/libaws-cpp-sdk-identity-management.so \ + /usr/local/lib/libaws-cpp-sdk-core.so \ + /usr/local/lib/libaws-cpp-sdk-cognito-identity.so \ + /usr/local/lib/libaws-cpp-sdk-sts.so \ + /build