Skip to content

Commit

Permalink
Publish ninja-build static binary for Linux (1/n)
Browse files Browse the repository at this point in the history
  • Loading branch information
Jonah Beckford committed Oct 2, 2024
1 parent 78e5b45 commit 72d89ef
Show file tree
Hide file tree
Showing 4 changed files with 79 additions and 2 deletions.
44 changes: 44 additions & 0 deletions .github/workflows/ninja-build-static.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
##########################################################################
# File: dkcoder\.github\workflows\ninja-build-static.yml #
# #
# Copyright 2024 Diskuv, Inc. #
# #
# Licensed under the Open Software License version 3.0 #
# (the "License"); you may not use this file except in compliance #
# with the License. You may obtain a copy of the License at #
# #
# https://opensource.org/license/osl-3-0-php/ #
# #
##########################################################################

name: Publish ninja-build as a static binary

on:
push:

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

# We aren't use cross-compilation. Instead we have multiple platforms
# with QEMU emulation providing a native environment. An alternative
# is to use CMake to build Ninja with a cross-compiler.
- name: Build and export to Docker
uses: docker/build-push-action@v6
id: image
with:
#platforms: linux/amd64,linux/arm64,linux/386
file: ci/ninja-build-static/Dockerfile
outputs: out

- name: Test inside container
run: docker run --rm ${{ steps.image.outputs.imageid }} ./ninja --version

- name: Test outside container
run: out/usr/local/src/ninja-build/ninja --version
10 changes: 9 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,19 @@
{
"language": "ocaml.interface",
"mapTo": "ocaml"
},
},
{
"language": "yaml",
"mapTo": "cmake"
},
{
"language": "github-actions-workflow",
"mapTo": "cmake"
},
{
"language": "dockerfile",
"mapTo": "cmake"
},
{
"language": "shellscript",
"mapTo": "cmake"
Expand Down
3 changes: 2 additions & 1 deletion CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
## Pending

- Upgrade to Ninja 1.12.1 from 1.11.1 specifically to fix <https://github.com/ninja-build/ninja/issues/829>
- Use Ninja download on Linux rather than system-installed Ninja so the version is consistent, especially for old dockcross-based containers.
- Provide and download ninja-build static binaries on Linx since system-installed Ninja versions are unpredictable and Ninja-provided binaries are linked to recent glibc versions.
- (To be removed) Use Ninja download on Linux rather than system-installed Ninja so the version is consistent, especially for old dockcross-based containers.

## 2.1.3.2

Expand Down
24 changes: 24 additions & 0 deletions ci/ninja-build-static/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
##########################################################################
# File: dkcoder\ci\ninja-build-static\Dockerfile #
# #
# Copyright 2024 Diskuv, Inc. #
# #
# Licensed under the Open Software License version 3.0 #
# (the "License"); you may not use this file except in compliance #
# with the License. You may obtain a copy of the License at #
# #
# https://opensource.org/license/osl-3-0-php/ #
# #
##########################################################################

FROM alpine:3.20

# Install compiler toolchain and Python
RUN apk update && apk upgrade && apk add coreutils gcc g++ python3

# Download v1.12.1
ADD https://github.com/ninja-build/ninja.git#2daa09ba270b0a43e1929d29b073348aa985dfaa /usr/local/src/ninja-build/

# Build Ninja
WORKDIR /usr/local/src/ninja-build
RUN CFLAGS=-static ./configure.py --bootstrap --verbose

0 comments on commit 72d89ef

Please sign in to comment.