From a6831ad151a5e78816ac83927fb7c8ac8d14327b Mon Sep 17 00:00:00 2001 From: Oded Arbel Date: Thu, 22 Feb 2024 11:04:08 +0200 Subject: [PATCH 1/2] Add docker build tooling to help build a local set of working libraries --- contrib/Makefile | 8 ++++++++ contrib/README.md | 28 ++++++++++++++++++++++++++++ contrib/build-ubuntu.Dockerfile | 23 +++++++++++++++++++++++ 3 files changed, 59 insertions(+) create mode 100644 contrib/Makefile create mode 100644 contrib/README.md create mode 100644 contrib/build-ubuntu.Dockerfile 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..f8864a9 --- /dev/null +++ b/contrib/build-ubuntu.Dockerfile @@ -0,0 +1,23 @@ +ARG RELEASE=20.04 +FROM ubuntu:$RELEASE +ENV DEBIAN_FRONTEND=noninteractive +WORKDIR /src +RUN apt-get update && apt-get install -qy devscripts \ + libcurl4-openssl-dev libssl-dev uuid-dev zlib1g-dev libpulse-dev \ + git cmake +RUN git clone --recurse-submodules https://github.com/aws/aws-sdk-cpp +RUN mkdir sdk_build && cd sdk_build && \ + cmake ../aws-sdk-cpp -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH=${PWD} \ + -DBUILD_ONLY="core;identity-management" -DAUTORUN_UNIT_TESTS=OFF && make && make install +ADD ./ /src/s3fs-fuse-awscred-lib +RUN cd s3fs-fuse-awscred-lib && \ + cmake -S . -B build && \ + 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 From 406e176026bc418c0d8c1b2b0de2097dfbd77d96 Mon Sep 17 00:00:00 2001 From: Oded Arbel Date: Sun, 25 Feb 2024 12:57:30 +0200 Subject: [PATCH 2/2] Changed build process to match what the CI does --- contrib/build-ubuntu.Dockerfile | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/contrib/build-ubuntu.Dockerfile b/contrib/build-ubuntu.Dockerfile index f8864a9..47be8e6 100644 --- a/contrib/build-ubuntu.Dockerfile +++ b/contrib/build-ubuntu.Dockerfile @@ -1,18 +1,20 @@ ARG RELEASE=20.04 FROM ubuntu:$RELEASE +ARG RELEASE=20.04 ENV DEBIAN_FRONTEND=noninteractive -WORKDIR /src -RUN apt-get update && apt-get install -qy devscripts \ - libcurl4-openssl-dev libssl-dev uuid-dev zlib1g-dev libpulse-dev \ - git cmake -RUN git clone --recurse-submodules https://github.com/aws/aws-sdk-cpp -RUN mkdir sdk_build && cd sdk_build && \ - cmake ../aws-sdk-cpp -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH=${PWD} \ - -DBUILD_ONLY="core;identity-management" -DAUTORUN_UNIT_TESTS=OFF && make && make install ADD ./ /src/s3fs-fuse-awscred-lib -RUN cd s3fs-fuse-awscred-lib && \ - cmake -S . -B build && \ - cmake --build build +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 \