diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index d387d6b..1ea9936 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -1,2 +1,4 @@ -FROM ${ESMINI_IMAGE_NAME}:${ESMINI_VERSION}-builder AS esmini-devel +ARG ESMINI_IMAGE_NAME=ghcr.io/bounverif/esmini +ARG ESMINI_VERSION=latest +FROM ${ESMINI_IMAGE_NAME}:${ESMINI_VERSION}-devel AS devcontainer ARG TARGETARCH TARGETOS TARGETPLATFORM TARGETVARIANT \ No newline at end of file diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 1da9531..80b9962 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -7,7 +7,7 @@ "ESMINI_IMAGE_NAME": "ghcr.io/bounverif/esmini", "ESMINI_VERSION": "latest" }, - "target": "esmini-devel" + "target": "devcontainer" }, "remoteUser": "ubuntu" } \ No newline at end of file diff --git a/.github/workflows/buildah-build-builder.yml b/.github/workflows/buildah-build-builder.yml index 1e9e017..ba8c2b3 100644 --- a/.github/workflows/buildah-build-builder.yml +++ b/.github/workflows/buildah-build-builder.yml @@ -1,50 +1,73 @@ name: buildah-build-builder on: - workflow_dispatch: schedule: - cron: "19 19 * * 0" # 19:19 UTC every Sunday push: paths: - .github/workflows/buildah-build-builder.yml # Self-trigger - containers/esmini-builder/Dockerfile - + workflow_dispatch: + inputs: + esmini_version: + description: ESMINI_VERSION + type: string + required: true + default: latest + env: REGISTRY: ghcr.io/bounverif IMAGE_NAME: esmini + PODMAN_ARCH: amd64 + PLATFORM: linux-amd64 ESMINI_VERSION: latest - CONTAINERS_ROOT: /home/runner/.local/share/containers - TMPDIR: /home/runner/.local/share/containers/tmp + ESMINI_LATEST_VERSION: latest + # CONTAINERS_ROOT: /home/runner/.local/share/containers + # TMPDIR: /home/runner/.local/share/containers/tmp permissions: contents: read packages: write jobs: - buildah-build-builder: - runs-on: ubuntu-24.04 + buildah-build: + name: Build container images + strategy: + fail-fast: false + matrix: + os: [ubuntu-24.04, ubuntu-24.04-arm] + runs-on: ${{ matrix.os }} concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true + group: ${{ github.workflow }}-${{ github.ref }}-${{ matrix.os }} + cancel-in-progress: true + steps: - - name: Maximize build space - uses: easimon/maximize-build-space@v10 - with: - root-reserve-mb: 2048 # Reserve disk space for repository - remove-dotnet: "true" - remove-android: "true" - remove-haskell: "true" - remove-codeql: "true" - remove-docker-images: "true" - build-mount-path: ${{ env.CONTAINERS_ROOT }} # The remaining space only for container build + - name: Install container tools + run: sudo apt-get install podman buildah jq - - run: mkdir -p $TMPDIR + # - name: Maximize build space + # uses: easimon/maximize-build-space@v10 + # with: + # root-reserve-mb: 2048 # Reserve disk space for repository + # remove-dotnet: "true" + # remove-android: "true" + # remove-haskell: "true" + # remove-codeql: "true" + # remove-docker-images: "true" + # build-mount-path: ${{ env.CONTAINERS_ROOT }} # The remaining space only for container build + # - run: mkdir -p $TMPDIR + + - name: Prepare environment variables + run: | + echo "PODMAN_ARCH=$(podman info --format='{{.Host.Arch}}')" >> $GITHUB_ENV + echo "PLATFORM=$(podman info --format='{{.Version.OsArch}}' | sed 's/\//-/g')" >> $GITHUB_ENV + if [ "${{ env.ESMINI_VERSION }}" == "latest" ]; then + echo "ESMINI_VERSION=$(curl -sL "https://api.github.com/repos/esmini/esmini/releases/latest" | jq -r '.tag_name')" >> $GITHUB_ENV + fi + echo "ESMINI_LATEST_VERSION=$(curl -sL "https://api.github.com/repos/esmini/esmini/releases/latest" | jq -r '.tag_name')" >> $GITHUB_ENV - name: Checkout repository uses: actions/checkout@v4 - - name: Set current date as the version - run: echo "ESMINI_VERSION=$(curl -sL "https://api.github.com/repos/esmini/esmini/releases/latest" | jq -r '.tag_name')" >> $GITHUB_ENV - - name: Log in to the GitHub Container registry uses: redhat-actions/podman-login@v1 with: @@ -56,20 +79,36 @@ jobs: id: build-builder uses: redhat-actions/buildah-build@v2 with: - platforms: linux/amd64 context: ./containers - image: ${{ env.IMAGE_NAME }} - tags: ${{ env.ESMINI_VERSION }}-builder latest-builder + image: esmini + tags: | + ${{ env.ESMINI_VERSION }}-builder + ${{ env.ESMINI_VERSION }}-builder-${{ env.PODMAN_ARCH }} layers: true oci: true build-args: | - ESMINI_IMAGE_NAME=${{env.REGISTRY}}}/${{ env.IMAGE_NAME }} ESMINI_VERSION=${{ env.ESMINI_VERSION }} extra-args: | --target esmini-builder containerfiles: | ./containers/esmini-builder/Dockerfile + - name: Build devel container image + id: build-devel + uses: redhat-actions/buildah-build@v2 + with: + context: ./containers + image: esmini + tags: ${{ env.ESMINI_VERSION }}-devel ${{ env.ESMINI_VERSION }}-devel-${{ env.PODMAN_ARCH }} + layers: true + oci: true + build-args: | + ESMINI_VERSION=${{ env.ESMINI_VERSION }} + extra-args: | + --target esmini-devel + containerfiles: | + ./containers/esmini-builder/Dockerfile + - name: Push to GitHub Container Repository if: github.ref == 'refs/heads/main' id: push-builder-ghcr @@ -77,4 +116,81 @@ jobs: with: registry: ${{ env.REGISTRY }} image: ${{ steps.build-builder.outputs.image }} - tags: ${{ steps.build-builder.outputs.tags }} + tags: ${{ env.ESMINI_VERSION }}-builder-${{ env.PODMAN_ARCH }} + digestfile: ${{ runner.temp }}/digest-esmini-builder-${{ env.ESMINI_VERSION }}-${{ env.PLATFORM }} + + - name: Push to GitHub Container Repository + if: github.ref == 'refs/heads/main' + id: push-devel-ghcr + uses: redhat-actions/push-to-registry@v2 + with: + registry: ${{ env.REGISTRY }} + image: ${{ steps.build-devel.outputs.image }} + tags: ${{ env.ESMINI_VERSION }}-devel-${{ env.PODMAN_ARCH }} + digestfile: ${{ runner.temp }}/digest-esmini-devel-${{ env.ESMINI_VERSION }}-${{ env.PLATFORM }} + + - name: Upload digests + if: github.ref == 'refs/heads/main' + uses: actions/upload-artifact@v4 + with: + name: digest-esmini-${{ env.ESMINI_VERSION }}-${{ env.PLATFORM }} + path: ${{ runner.temp }}/digest-* + if-no-files-found: error + retention-days: 1 + compression-level: 0 # no compression + + buildah-merge: + name: Merge container images + runs-on: ubuntu-24.04 + needs: buildah-build + if: github.ref == 'refs/heads/main' && always() + steps: + # - run: mkdir -p $TMPDIR + - name: Download digests + uses: actions/download-artifact@v4 + with: + path: ${{ runner.temp }}/digests + pattern: digest-* + merge-multiple: true + + - name: Log in to the GitHub Container registry + uses: redhat-actions/podman-login@v1 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Prepare environment variables + run: | + if [ "${{ env.ESMINI_VERSION }}" == "latest" ]; then + echo "ESMINI_VERSION=$(curl -sL "https://api.github.com/repos/esmini/esmini/releases/latest" | jq -r '.tag_name')" >> $GITHUB_ENV + fi + echo "ESMINI_LATEST_VERSION=$(curl -sL "https://api.github.com/repos/esmini/esmini/releases/latest" | jq -r '.tag_name')" >> $GITHUB_ENV + + - name: Create and push manifest list for esmini-builder + run: | + MANIFEST=esmini-builder + FULL_IMAGE_NAME=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + buildah manifest create $MANIFEST + for digest in ${{ runner.temp }}/digests/digest-esmini-builder-*; do + echo "Adding $(cat $digest)" + buildah manifest add $MANIFEST $FULL_IMAGE_NAME@$(cat $digest) + done + buildah manifest push --all $MANIFEST docker://$FULL_IMAGE_NAME:${{ env.ESMINI_VERSION }}-builder + if [ "${{ env.ESMINI_VERSION }}" == "${{ env.ESMINI_LATEST_VERSION }}" ]; then + buildah manifest push --all $MANIFEST docker://$FULL_IMAGE_NAME:latest-builder + fi + + - name: Create and push manifest list for esmini-devel + run: | + MANIFEST=esmini-devel + FULL_IMAGE_NAME=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + buildah manifest create $MANIFEST + for digest in ${{ runner.temp }}/digests/digest-esmini-devel-*; do + echo "Adding $(cat $digest)" + buildah manifest add $MANIFEST $FULL_IMAGE_NAME@$(cat $digest) + done + buildah manifest push --all $MANIFEST docker://$FULL_IMAGE_NAME:${{ env.ESMINI_VERSION }}-devel + if [ "${{ env.ESMINI_VERSION }}" == "${{ env.ESMINI_LATEST_VERSION }}" ]; then + buildah manifest push --all $MANIFEST docker://$FULL_IMAGE_NAME:latest-devel + fi diff --git a/.github/workflows/buildah-build-runtime.yml b/.github/workflows/buildah-build-runtime.yml index 121759c..4e628ac 100644 --- a/.github/workflows/buildah-build-runtime.yml +++ b/.github/workflows/buildah-build-runtime.yml @@ -11,40 +11,57 @@ on: env: REGISTRY: ghcr.io/bounverif IMAGE_NAME: esmini + PODMAN_ARCH: amd64 + PLATFORM: linux-amd64 ESMINI_VERSION: latest - CONTAINERS_ROOT: /home/runner/.local/share/containers - TMPDIR: /home/runner/.local/share/containers/tmp + ESMINI_LATEST_VERSION: latest + # CONTAINERS_ROOT: /home/runner/.local/share/containers + # TMPDIR: /home/runner/.local/share/containers/tmp permissions: contents: read packages: write jobs: - buildah-build-runtime: - runs-on: ubuntu-24.04 + buildah-build: + name: Build container images + strategy: + fail-fast: false + matrix: + os: [ubuntu-24.04, ubuntu-24.04-arm] + runs-on: ${{ matrix.os }} concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true + group: ${{ github.workflow }}-${{ github.ref }}-${{ matrix.os }} + cancel-in-progress: true + steps: - - name: Maximize build space - uses: easimon/maximize-build-space@v10 - with: - root-reserve-mb: 2048 # Reserve disk space for repository - remove-dotnet: "true" - remove-android: "true" - remove-haskell: "true" - remove-codeql: "true" - remove-docker-images: "true" - build-mount-path: ${{ env.CONTAINERS_ROOT }} # The remaining space only for container build + - name: Install container tools + run: sudo apt-get install podman buildah jq - - run: mkdir -p $TMPDIR + # - name: Maximize build space + # uses: easimon/maximize-build-space@v10 + # with: + # root-reserve-mb: 2048 # Reserve disk space for repository + # remove-dotnet: "true" + # remove-android: "true" + # remove-haskell: "true" + # remove-codeql: "true" + # remove-docker-images: "true" + # build-mount-path: ${{ env.CONTAINERS_ROOT }} # The remaining space only for container build + # - run: mkdir -p $TMPDIR + + - name: Prepare environment variables + run: | + echo "PODMAN_ARCH=$(podman info --format='{{.Host.Arch}}')" >> $GITHUB_ENV + echo "PLATFORM=$(podman info --format='{{.Version.OsArch}}' | sed 's/\//-/g')" >> $GITHUB_ENV + if [ "${{ env.ESMINI_VERSION }}" == "latest" ]; then + echo "ESMINI_VERSION=$(curl -sL "https://api.github.com/repos/esmini/esmini/releases/latest" | jq -r '.tag_name')" >> $GITHUB_ENV + fi + echo "ESMINI_LATEST_VERSION=$(curl -sL "https://api.github.com/repos/esmini/esmini/releases/latest" | jq -r '.tag_name')" >> $GITHUB_ENV - name: Checkout repository uses: actions/checkout@v4 - - name: Set current date as the version - run: echo "ESMINI_VERSION=$(curl -sL "https://api.github.com/repos/esmini/esmini/releases/latest" | jq -r '.tag_name')" >> $GITHUB_ENV - - name: Log in to the GitHub Container registry uses: redhat-actions/podman-login@v1 with: @@ -56,10 +73,9 @@ jobs: id: build-runtime uses: redhat-actions/buildah-build@v2 with: - platforms: linux/amd64 context: ./containers image: ${{ env.IMAGE_NAME }} - tags: ${{ env.ESMINI_VERSION }}-runtime latest-runtime latest + tags: ${{ env.ESMINI_VERSION }}-runtime ${{ env.ESMINI_VERSION }}-runtime-${{ env.PODMAN_ARCH }} ${{ env.ESMINI_VERSION }}-${{ env.PODMAN_ARCH }} layers: true oci: true build-args: | @@ -71,10 +87,64 @@ jobs: ./containers/esmini-runtime/Dockerfile - name: Push to GitHub Container Repository - if: github.ref == 'refs/heads/main' + if: github.ref == 'refs/heads/multiarch-image' id: push-runtime-ghcr uses: redhat-actions/push-to-registry@v2 with: registry: ${{ env.REGISTRY }} image: ${{ steps.build-runtime.outputs.image }} - tags: ${{ steps.build-runtime.outputs.tags }} + tags: ${{ env.ESMINI_VERSION }}-runtime-${{ env.PODMAN_ARCH }} ${{ env.ESMINI_VERSION }}-${{ env.PODMAN_ARCH }} + digestfile: ${{ runner.temp }}/digest-esmini-runtime-${{ env.PLATFORM }} + + - name: Upload digests + if: github.ref == 'refs/heads/multiarch-image' + uses: actions/upload-artifact@v4 + with: + name: digest-esmini-${{ env.ESMINI_VERSION }}-${{ env.PLATFORM }} + path: ${{ runner.temp }}/digest-* + if-no-files-found: error + retention-days: 1 + compression-level: 0 # no compression + + buildah-merge: + name: Merge container images + runs-on: ubuntu-24.04 + needs: buildah-build + if: github.ref == 'refs/heads/multiarch-image' && always() + steps: + # - run: mkdir -p $TMPDIR + - name: Download digests + uses: actions/download-artifact@v4 + with: + path: ${{ runner.temp }}/digests + pattern: digest-* + merge-multiple: true + + - name: Log in to the GitHub Container registry + uses: redhat-actions/podman-login@v1 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Prepare environment variables + run: | + if [ "${{ env.ESMINI_VERSION }}" == "latest" ]; then + echo "ESMINI_VERSION=$(curl -sL "https://api.github.com/repos/esmini/esmini/releases/latest" | jq -r '.tag_name')" >> $GITHUB_ENV + fi + echo "ESMINI_LATEST_VERSION=$(curl -sL "https://api.github.com/repos/esmini/esmini/releases/latest" | jq -r '.tag_name')" >> $GITHUB_ENV + + - name: Create and push manifest list for esmini-builder + run: | + MANIFEST=esmini-runtime + FULL_IMAGE_NAME=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + buildah manifest create $MANIFEST + for digest in ${{ runner.temp }}/digests/digest-esmini-runtime-*; do + echo "Adding $(cat $digest)" + buildah manifest add $MANIFEST $FULL_IMAGE_NAME@$(cat $digest) + done + buildah manifest push --all $MANIFEST docker://$FULL_IMAGE_NAME:${{ env.ESMINI_VERSION }}-runtime + if [ "${{ env.ESMINI_VERSION }}" == "${{ env.ESMINI_LATEST_VERSION }}" ]; then + buildah manifest push --all $MANIFEST docker://$FULL_IMAGE_NAME:latest-runtime + buildah manifest push --all $MANIFEST docker://$FULL_IMAGE_NAME:latest + fi diff --git a/.github/workflows/reuse-compliance-check.yml b/.github/workflows/reuse-compliance-check.yml index 1a5318d..d10c391 100644 --- a/.github/workflows/reuse-compliance-check.yml +++ b/.github/workflows/reuse-compliance-check.yml @@ -1,6 +1,12 @@ name: REUSE Compliance Check -on: [push, pull_request] +on: + push: + branches: + - main + pull_request: + branches: + - main jobs: reuse-compliance-check: @@ -8,6 +14,5 @@ jobs: steps: - name: Checkout uses: actions/checkout@v4 - - name: REUSE Compliance Check uses: fsfe/reuse-action@v5 diff --git a/containers/Makefile b/containers/Makefile index 590b8b3..2a52d1e 100644 --- a/containers/Makefile +++ b/containers/Makefile @@ -8,6 +8,17 @@ info: @echo "esmini version: ${ESMINI_VERSION}" @echo "esmini current version: ${ESMINI_CURRENT_VERSION}" +openscenegraph: + buildah build \ + -f esmini-builder/Dockerfile \ + --build-arg ESMINI_BUILD_OSG_VERSION=3.6.5 \ + --format oci \ + --layers=true \ + --target osg-builder \ + --tag ${ESMINI_IMAGE_NAME}:3.6.5-openscenegraph \ + --tag ${ESMINI_IMAGE_NAME}:latest-openscenegraph \ + ${CONTAINER_BUILD_CONTEXT} + builder: buildah build \ -f esmini-builder/Dockerfile \ diff --git a/containers/dependencies.txt b/containers/dependencies.txt index 9f2f03f..2a0cf96 100644 --- a/containers/dependencies.txt +++ b/containers/dependencies.txt @@ -1,6 +1,9 @@ +# Buildtool dependencies build-essential [builder platform:dpkg] cmake [builder platform:dpkg] +ninja-build [builder platform:dpkg] +# Build dependencies libz-dev [builder platform:dpkg] libfontconfig-dev [builder platform:dpkg] libxml2-utils [builder platform:dpkg] @@ -12,7 +15,3 @@ libxrandr-dev [builder platform:dpkg] libxinerama-dev [builder platform:dpkg] libgl1-mesa-dev [builder platform:dpkg] libegl1-mesa-dev [builder platform:dpkg] -libopenscenegraph-dev [builder platform:dpkg] - -python3 [devel platform:dpkg] -python3-pip [devel platform:dpkg] diff --git a/containers/esmini-builder/Dockerfile b/containers/esmini-builder/Dockerfile index 13a3779..0a840e5 100644 --- a/containers/esmini-builder/Dockerfile +++ b/containers/esmini-builder/Dockerfile @@ -3,6 +3,51 @@ ARG ESMINI_BASE_IMAGE_VERSION=24.04 ARG ESMINI_IMAGE_NAME=localhost/esmini ARG ESMINI_VERSION=latest +ARG ESMINI_BUILD_PROTOBUF_VERSION=3.15.2 +ARG ESMINI_BUILD_OSI_VERSION=3.5.0 +ARG ESMINI_BUILD_OSG_VERSION=3.6.5 +ARG ESMINI_BUILD_OSG_WITH_FBX=OFF + +FROM ${ESMINI_BASE_IMAGE}:${ESMINI_BASE_IMAGE_VERSION} AS osg-builder +ARG TARGETARCH TARGETOS TARGETPLATFORM TARGETVARIANT + +RUN --mount=type=cache,target=/var/cache/apt,sharing=locked,id=${TARGETPLATFORM}/var/cache/apt \ + export DEBIAN_FRONTEND=noninteractive && \ + apt-get update -qq && \ + apt-get install -qy --no-install-recommends \ + sudo \ + curl \ + git \ + jq \ + gnupg2 \ + ca-certificates \ + build-essential \ + cmake \ + && \ + apt-get autoremove -y && rm -rf /var/lib/apt/lists/* && \ + printf "ubuntu ALL= NOPASSWD: ALL\\n" > /etc/sudoers.d/ubuntu + +RUN --mount=type=cache,target=/var/cache/apt,sharing=locked,id=${TARGETPLATFORM}/var/cache/apt \ + export DEBIAN_FRONTEND=noninteractive && \ + apt-get update -qq && \ + apt-get install -qy --no-install-recommends \ + libgl1-mesa-dev \ + libxml2-dev \ + libjpeg-dev \ + libpng-dev \ + libtiff-dev \ + libfontconfig-dev \ + && \ + apt-get autoremove -y && rm -rf /var/lib/apt/lists/* + +ARG ESMINI_BUILD_OSG_VERSION +ENV ESMINI_BUILD_OSG_VERSION=${ESMINI_BUILD_OSG_VERSION} +ENV ESMINI_BUILD_OSG_WITH_FBX=OFF +ENV ESMINI_BUILD_OSG_BUILD_SHARED_LIBS=OFF +ENV ESMINI_BUILD_OSG_BUILD_APPLICATIONS=OFF +COPY --chmod=755 scripts/osg-install.sh /usr/local/bin/osg-install.sh +RUN /usr/local/bin/osg-install.sh + FROM ${ESMINI_BASE_IMAGE}:${ESMINI_BASE_IMAGE_VERSION} AS esmini-builder ARG TARGETARCH TARGETOS TARGETPLATFORM TARGETVARIANT @@ -15,17 +60,23 @@ RUN --mount=type=cache,target=/var/cache/apt,sharing=locked,id=${TARGETPLATFORM} curl \ wget \ git \ + jq \ gnupg2 \ ca-certificates \ python3-minimal \ python3-pip \ + pipx \ python-is-python3 \ && \ apt-get autoremove -y && rm -rf /var/lib/apt/lists/* && \ printf "ubuntu ALL= NOPASSWD: ALL\\n" > /etc/sudoers.d/ubuntu +# Install some python utilities RUN python3 -m pip config set global.break-system-packages true && \ - python3 -m pip install --no-cache-dir bindep + python3 -m pip install --no-cache-dir \ + bindep \ + && \ + PIPX_HOME=/opt/pipx PIPX_BIN_DIR=/usr/local/bin pipx install semver # Install esmini devel packages RUN --mount=type=bind,source=dependencies.txt,target=/tmp/esmini/dependencies.txt \ @@ -35,7 +86,20 @@ RUN --mount=type=bind,source=dependencies.txt,target=/tmp/esmini/dependencies.tx && \ apt-get autoremove -y && rm -rf /var/lib/apt/lists/* -COPY --chmod=755 scripts/build-osgdb-fbx.sh /usr/bin/build-osgdb-fbx.sh +ARG ESMINI_BUILD_OSG_VERSION +ENV ESMINI_BUILD_OSG_VERSION=${ESMINI_BUILD_OSG_VERSION} +COPY --chmod=755 scripts/osg-install.sh /usr/local/bin/osg-install.sh +COPY --from=osg-builder /usr/local /usr/local + +ARG ESMINI_BUILD_PROTOBUF_VERSION +ENV ESMINI_BUILD_PROTOBUF_VERSION=${ESMINI_BUILD_PROTOBUF_VERSION} +COPY --chmod=755 scripts/protobuf-install.sh /usr/local/bin/protobuf-install.sh +RUN /usr/local/bin/protobuf-install.sh + +ARG ESMINI_BUILD_OSI_VERSION +ENV ESMINI_BUILD_OSI_VERSION=${ESMINI_BUILD_OSI_VERSION} +COPY --chmod=755 scripts/osi-install.sh /usr/local/bin/osi-install.sh +RUN /usr/local/bin/osi-install.sh ARG ESMINI_VERSION ENV ESMINI_VERSION=${ESMINI_VERSION} diff --git a/containers/scripts/build-osgdb-fbx.sh b/containers/scripts/build-osgdb-fbx.sh deleted file mode 100644 index 6d4c81b..0000000 --- a/containers/scripts/build-osgdb-fbx.sh +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/bash -e -OSG_VERSION="3.6.5" -FBXSDK_VERSION_MAJOR="${FBXSDK_VERSION_MAJOR:-2020}" -FBXSDK_VERSION_MINOR="${FBXSDK_VERSION_MINOR:-3}" -FBXSDK_VERSION_PATCH="${FBXSDK_VERSION_PATCH:-2}" -FBXSDK_VERSION="${FBXSDK_VERSION_MAJOR}${FBXSDK_VERSION_MINOR}${FBXSDK_VERSION_PATCH}" -FBXSDK_VERSION_DASHED="${FBXSDK_VERSION_MAJOR}-${FBXSDK_VERSION_MINOR}-${FBXSDK_VERSION_PATCH}" -FBXSDK_DOWNLOAD_URL="https://www.autodesk.com/content/dam/autodesk/www/adn/fbx/${FBXSDK_VERSION_DASHED}/fbx${FBXSDK_VERSION}_fbxsdk_linux.tar.gz" -mkdir -p /tmp/fbxsdk -mkdir -p /tmp/fbxsdk/install -curl -kL --user-agent "Mozilla/5.0" ${FBXSDK_DOWNLOAD_URL} | tar xzv -C /tmp/fbxsdk -yes yes | /tmp/fbxsdk/fbx${FBXSDK_VERSION}_fbxsdk_linux /tmp/fbxsdk/install -git clone --single-branch --depth 1 --branch OpenSceneGraph-${OSG_VERSION} https://github.com/OpenSceneGraph/OpenSceneGraph /tmp/osg -cd /tmp/osg -cmake . \ - -DFBX_INCLUDE_DIR="/tmp/fbxsdk/install/include" \ - -DFBX_LIBRARY="/tmp/fbxsdk/install/lib/gcc/x64/release/libfbxsdk.a" \ - -DFBX_LIBRARY_DEBUG="/tmp/fbxsdk/install/lib/gcc/x64/debug/libfbxsdk.a" \ - -DCMAKE_INSTALL_PREFIX="/usr/lib64" -cmake --build . --target install -j4 -rm -rf /tmp/fbxsdk /tmp/osg \ No newline at end of file diff --git a/containers/scripts/osg-install.sh b/containers/scripts/osg-install.sh new file mode 100644 index 0000000..ca2f8cc --- /dev/null +++ b/containers/scripts/osg-install.sh @@ -0,0 +1,62 @@ +#!/bin/bash -ex + +CMAKE_BUILD_PARALLEL_LEVEL=${CMAKE_BUILD_PARALLEL_LEVEL:-4} + +ESMINI_INSTALL_PREFIX=${ESMINI_INSTALL_PREFIX:-/usr/local} +ESMINI_BUILD_INSTALL_PREFIX=${ESMINI_BUILD_INSTALL_PREFIX:-${ESMINI_INSTALL_PREFIX}} +ESMINI_BUILD_OSG_SOURCE_DIR="/tmp/osg" +ESMINI_BUILD_OSG_BUILD_DIR=${ESMINI_BUILD_OSG_SOURCE_DIR}/build +ESMINI_BUILD_OSG_SOURCE_REPOSITORY_URL="https://github.com/OpenSceneGraph/OpenSceneGraph" +ESMINI_BUILD_OSG_VERSION=${ESMINI_BUILD_OSG_VERSION:-3.6.5} +ESMINI_BUILD_OSG_BUILD_SHARED_LIBS=${ESMINI_BUILD_OSG_BUILD_SHARED_LIBS:-ON} +ESMINI_BUILD_OSG_BUILD_APPLICATIONS=${ESMINI_BUILD_OSG_BUILD_APPLICATIONS:-ON} + +ESMINI_BUILD_OSG_WITH_FBX=${ESMINI_BUILD_OSG_WITH_FBX:-"ON"} +ESMINI_BUILD_FBXSDK_SOURCE_DIR="/tmp/fbxsdk" +ESMINI_BUILD_FBXSDK_INSTALL_DIR="${ESMINI_BUILD_FBXSDK_INSTALL_DIR:-${ESMINI_BUILD_FBXSDK_SOURCE_DIR}/fbxsdk}" + +if [[ "${ESMINI_BUILD_OSG_WITH_FBX}" == "ON" || \ + "${ESMINI_BUILD_OSG_WITH_FBX}" == "1" || \ + "${ESMINI_BUILD_OSG_WITH_FBX}" == "YES" || \ + "${ESMINI_BUILD_OSG_WITH_FBX}" == "TRUE" ]];\ +then + FBXSDK_VERSION_MAJOR="${FBXSDK_VERSION_MAJOR:-2020}" + FBXSDK_VERSION_MINOR="${FBXSDK_VERSION_MINOR:-3}" + FBXSDK_VERSION_PATCH="${FBXSDK_VERSION_PATCH:-2}" + FBXSDK_VERSION="${FBXSDK_VERSION_MAJOR}${FBXSDK_VERSION_MINOR}${FBXSDK_VERSION_PATCH}" + FBXSDK_VERSION_DASHED="${FBXSDK_VERSION_MAJOR}-${FBXSDK_VERSION_MINOR}-${FBXSDK_VERSION_PATCH}" + FBXSDK_DOWNLOAD_URL="https://www.autodesk.com/content/dam/autodesk/www/adn/fbx/${FBXSDK_VERSION_DASHED}/fbx${FBXSDK_VERSION}_fbxsdk_linux.tar.gz" + mkdir -p "${ESMINI_BUILD_FBXSDK_SOURCE_DIR}" + mkdir -p "${ESMINI_BUILD_FBXSDK_INSTALL_DIR}" + curl -kL --user-agent "Mozilla/5.0" "${FBXSDK_DOWNLOAD_URL}" | tar xzv -C "${ESMINI_BUILD_FBXSDK_SOURCE_DIR}" + yes yes | ${ESMINI_BUILD_FBXSDK_SOURCE_DIR}/fbx"${FBXSDK_VERSION}"_fbxsdk_linux "${ESMINI_BUILD_FBXSDK_INSTALL_DIR}" +fi + +git clone "${ESMINI_BUILD_OSG_SOURCE_REPOSITORY_URL}" ${ESMINI_BUILD_OSG_SOURCE_DIR} \ + --depth 1 \ + --branch "OpenSceneGraph-${ESMINI_BUILD_OSG_VERSION}" \ + --recurse-submodules + +cmake \ + -S ${ESMINI_BUILD_OSG_SOURCE_DIR} \ + -B ${ESMINI_BUILD_OSG_BUILD_DIR} \ + -DOPENGL_PROFILE=GL2 \ + -DOSG_AGGRESSIVE_WARNINGS=OFF \ + -DDYNAMIC_OPENSCENEGRAPH="${ESMINI_BUILD_OSG_BUILD_SHARED_LIBS}" \ + -DDYNAMIC_OPENTHREADS="${ESMINI_BUILD_OSG_BUILD_SHARED_LIBS}" \ + -DBUILD_OSG_APPLICATIONS="${ESMINI_BUILD_OSG_BUILD_APPLICATIONS}" \ + -DBUILD_OSG_EXAMPLES=OFF \ + -DBUILD_OSG_DEPRECATED_SERIALIZERS=OFF \ + -DBUILD_DOCUMENTATION=OFF \ + -DBUILD_OSG_PLUGINS=ON \ + -DBUILD_OSG_PLUGIN_FBX="${ESMINI_BUILD_OSG_WITH_FBX}" \ + -DFBX_INCLUDE_DIR="${ESMINI_BUILD_FBXSDK_INSTALL_DIR}/include" \ + -DFBX_LIBRARY="${ESMINI_BUILD_FBXSDK_INSTALL_DIR}/lib/gcc/x64/release/libfbxsdk.a" \ + -DFBX_LIBRARY_DEBUG="${ESMINI_BUILD_FBXSDK_INSTALL_DIR}/lib/gcc/x64/debug/libfbxsdk.a" \ + -DCMAKE_INSTALL_PREFIX="${ESMINI_BUILD_INSTALL_PREFIX}" \ + -DCMAKE_POSITION_INDEPENDENT_CODE=ON +mkdir -p "${ESMINI_BUILD_INSTALL_PREFIX}" +cmake --build ${ESMINI_BUILD_OSG_BUILD_DIR} --target install + +# Cleanup +rm -rf ${ESMINI_BUILD_OSG_SOURCE_DIR} ${ESMINI_BUILD_OSG_BUILD_DIR} \ No newline at end of file diff --git a/containers/scripts/osi-install.sh b/containers/scripts/osi-install.sh new file mode 100644 index 0000000..28c0114 --- /dev/null +++ b/containers/scripts/osi-install.sh @@ -0,0 +1,34 @@ +#!/bin/sh -e +# +# Example Usage: +# ESMINI_BUILD_INSTALL_PREFIX=~/pb ESMINI_BUILD_OSI_VERSION=3.15.2 protobuf-install.sh + +CMAKE_BUILD_PARALLEL_LEVEL=${CMAKE_BUILD_PARALLEL_LEVEL:-4} + +ESMINI_INSTALL_PREFIX=${ESMINI_INSTALL_PREFIX:-/usr/local} +ESMINI_BUILD_INSTALL_PREFIX=${ESMINI_BUILD_INSTALL_PREFIX:-${ESMINI_INSTALL_PREFIX}} +ESMINI_BUILD_OSI_SOURCE_DIR="/tmp/osi3" +ESMINI_BUILD_OSI_BUILD_DIR=${ESMINI_BUILD_OSI_SOURCE_DIR}/build + +ESMINI_BUILD_OSI_SOURCE_REPOSITORY_URL="https://github.com/OpenSimulationInterface/open-simulation-interface" +ESMINI_BUILD_OSI_VERSION=${ESMINI_BUILD_OSI_VERSION:-3.7.0} + +git clone "${ESMINI_BUILD_OSI_SOURCE_REPOSITORY_URL}" ${ESMINI_BUILD_OSI_SOURCE_DIR} \ + --depth 1 \ + --branch "v${ESMINI_BUILD_OSI_VERSION}" \ + --recurse-submodules +cmake \ + -S ${ESMINI_BUILD_OSI_SOURCE_DIR} \ + -B ${ESMINI_BUILD_OSI_BUILD_DIR} \ + -DBUILD_SHARED_LIBS="${ESMINI_BUILD_OSI_BUILD_SHARED_LIBS}" \ + -DOSI_BUILD_FLATBUFFER=OFF \ + -DOSI_BUILD_DOCUMENTATION=OFF \ + -DOSI_INSTALL_LIB_DIR="${ESMINI_BUILD_INSTALL_PREFIX}\lib" \ + -DOSI_INSTALL_INCLUDE_DIR="${ESMINI_BUILD_INSTALL_PREFIX}\include" \ + -DCMAKE_INSTALL_PREFIX="${ESMINI_BUILD_INSTALL_PREFIX}" + +mkdir -p "${ESMINI_BUILD_INSTALL_PREFIX}" +cmake --build ${ESMINI_BUILD_OSI_BUILD_DIR} --target install + +# Cleanup +rm -rf ${ESMINI_BUILD_OSI_SOURCE_DIR} ${ESMINI_BUILD_OSI_BUILD_DIR} \ No newline at end of file diff --git a/containers/scripts/protobuf-install.sh b/containers/scripts/protobuf-install.sh new file mode 100644 index 0000000..fd9eb3d --- /dev/null +++ b/containers/scripts/protobuf-install.sh @@ -0,0 +1,43 @@ +#!/bin/sh -e +# +# Example Usage: +# ESMINI_BUILD_INSTALL_PREFIX=~/pb ESMINI_BUILD_PROTOBUF_VERSION=3.15.2 protobuf-install.sh + +CMAKE_BUILD_PARALLEL_LEVEL=${CMAKE_BUILD_PARALLEL_LEVEL:-4} + +ESMINI_INSTALL_PREFIX=${ESMINI_INSTALL_PREFIX:-/usr/local} +ESMINI_BUILD_INSTALL_PREFIX=${ESMINI_BUILD_INSTALL_PREFIX:-${ESMINI_INSTALL_PREFIX}} +ESMINI_BUILD_PROTOBUF_VERSION=${ESMINI_BUILD_PROTOBUF_VERSION:-3.21.12} +ESMINI_BUILD_PROTOBUF_SOURCE_DIR="/tmp/protobuf" +ESMINI_BUILD_PROTOBUF_BUILD_DIR="/tmp/build/protobuf" +ESMINI_BUILD_PROTOBUF_BUILD_SHARED_LIBS="OFF" +ESMINI_BUILD_PROTOBUF_WITH_ZLIB="ON" +ESMINI_BUILD_PROTOBUF_INSTALL="ON" + +ESMINI_BUILD_PROTOBUF_SOURCE_REPOSITORY_URL="https://github.com/protocolbuffers/protobuf" + +# CMakeLists.txt moved from the cmake directory to the top-level in v3.21 +_PROTOBUF_SOURCE_CMAKELISTS_DIR="" +if [ "$(pysemver compare "${ESMINI_BUILD_PROTOBUF_VERSION}" "3.21.0")" -lt 0 ]; then + _PROTOBUF_SOURCE_CMAKELISTS_DIR="cmake" +fi + +git clone "${ESMINI_BUILD_PROTOBUF_SOURCE_REPOSITORY_URL}" ${ESMINI_BUILD_PROTOBUF_SOURCE_DIR} \ + --depth 1 \ + --branch "v${ESMINI_BUILD_PROTOBUF_VERSION}" \ + --recurse-submodules +cmake \ + -S ${ESMINI_BUILD_PROTOBUF_SOURCE_DIR}/${_PROTOBUF_SOURCE_CMAKELISTS_DIR} \ + -B ${ESMINI_BUILD_PROTOBUF_BUILD_DIR} \ + -DBUILD_SHARED_LIBS="${ESMINI_BUILD_PROTOBUF_BUILD_SHARED_LIBS}" \ + -Dprotobuf_WITH_ZLIB="${ESMINI_BUILD_PROTOBUF_WITH_ZLIB}" \ + -Dprotobuf_BUILD_TESTS=OFF \ + -Dprotobuf_BUILD_EXAMPLES=OFF \ + -Dprotobuf_INSTALL="${ESMINI_BUILD_PROTOBUF_INSTALL}" \ + -DCMAKE_INSTALL_PREFIX="${ESMINI_BUILD_INSTALL_PREFIX}" \ + -DCMAKE_POSITION_INDEPENDENT_CODE=ON +mkdir -p "${ESMINI_BUILD_INSTALL_PREFIX}" +cmake --build ${ESMINI_BUILD_PROTOBUF_BUILD_DIR} --target install + +# Cleanup +rm -rf ${ESMINI_BUILD_PROTOBUF_SOURCE_DIR} ${ESMINI_BUILD_PROTOBUF_BUILD_DIR} \ No newline at end of file