diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c1a71f1..7f79076 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,12 +1,11 @@ name: Build bootstrap binaries for glibc on Linux -# FILL in - on: pull_request: paths: - .github/workflows/build.yml - - Library/Homebrew/glibc-bootstrap/** + - "build-*.sh" + - debian7/Dockerfile jobs: build: @@ -14,24 +13,25 @@ jobs: strategy: fail-fast: false matrix: - binary: [ - "bison", - "gawk", - "gcc", - "make", - "python3", - "sed",] + binary: + - binutils + - bison + - gawk + - gcc + - make + - python3 + - sed include: - container: debian7 steps: - uses: actions/checkout@v2 - name: Build Docker image - run: docker build -t ${{matrix.container}} . - working-directory: Library/Homebrew/glibc-bootstrap/debian7 + run: docker build --tag ${{matrix.container}} . + working-directory: debian7 - name: Run Docker container - run: docker run --rm --detach --user linuxbrew --name ${{github.sha}} -w /home/linuxbrew -v $(pwd)/Library/Homebrew/glibc-bootstrap:/home/linuxbrew/glibc-bootstrap ${{matrix.container}} sleep inf + run: docker run --rm --detach --user linuxbrew --name ${{github.sha}} --workdir /home/linuxbrew --volume $(pwd):/home/linuxbrew/glibc-bootstrap ${{matrix.container}} sleep inf - name: Build ${{matrix.binary}} run: docker exec ${{github.sha}} /bin/bash -c "/home/linuxbrew/glibc-bootstrap/build-${{matrix.binary}}.sh" @@ -40,7 +40,7 @@ jobs: run: docker cp ${{github.sha}}:/home/linuxbrew/bootstrap-binaries . - name: Upload binaries to GitHub Actions - uses: actions/upload-artifact@v2 - with: + uses: actions/upload-artifact@v3 + with: name: Bootstrap binaries path: bootstrap-binaries diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..5316f3c --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,35 @@ +name: Upload new release + +on: + workflow_dispatch: + inputs: + tag: + description: Version to use for release tag + required: true + +jobs: + build: + uses: ./.github/workflows/build.yml + + release: + needs: build + runs-on: ubuntu-latest + permissions: + contents: write + env: + GH_TOKEN: ${{github.token}} + TAG: ${{github.event.inputs.tag}} + steps: + - uses: actions/checkout@v2 + + - name: Download binaries from GitHub Actions + uses: actions/download-artifact@v3 + with: + name: Bootstrap binaries + path: bootstrap-binaries + + - name: Push tag + run: gh release create "$TAG" --generate-notes + + - name: Upload to GitHub Releases + run: gh release upload "$TAG" bootstrap-binaries/*.tar.gz diff --git a/LICENSE.txt b/LICENSE.txt new file mode 100644 index 0000000..12500f7 --- /dev/null +++ b/LICENSE.txt @@ -0,0 +1,25 @@ +BSD 2-Clause License + +Copyright (c) 2009-present, Homebrew contributors +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +* Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +* Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/Library/Homebrew/glibc-bootstrap/build-bison.sh b/Library/Homebrew/glibc-bootstrap/build-bison.sh deleted file mode 100755 index a4243c9..0000000 --- a/Library/Homebrew/glibc-bootstrap/build-bison.sh +++ /dev/null @@ -1,18 +0,0 @@ -#/bin/bash - -M4_VERSION=1.4.19 -BISON_VERSION=3.8.2 - -# Build m4 -curl -LO --insecure https://ftp.gnu.org/gnu/m4/m4-$M4_VERSION.tar.xz -tar xf m4-$M4_VERSION.tar.xz && cd m4-$M4_VERSION -./configure --prefix="${PREFIX}" && make && make install -cd .. && rm -rf m4-$M4_VERSION - -# Build bison -curl -LO --insecure https://ftp.gnu.org/gnu/bison/bison-$BISON_VERSION.tar.xz -tar xf bison-$BISON_VERSION.tar.xz && cd bison-$BISON_VERSION -./configure --prefix="${PREFIX}" M4="${PREFIX}/bin/m4" && make install -cd .. && rm -rf bison-$BISON_VERSION - -cd $PREFIX && tar --remove-files -czf $PKGDIR/bootstrap-bison-$BISON_VERSION.tar.gz . diff --git a/Library/Homebrew/glibc-bootstrap/build-gawk.sh b/Library/Homebrew/glibc-bootstrap/build-gawk.sh deleted file mode 100755 index 44f34ea..0000000 --- a/Library/Homebrew/glibc-bootstrap/build-gawk.sh +++ /dev/null @@ -1,11 +0,0 @@ -#/bin/bash - -VERSION=5.1.1 - -# Build gawk -curl -LO --insecure https://ftp.gnu.org/gnu/gawk/gawk-$VERSION.tar.xz -tar xf gawk-$VERSION.tar.xz && cd gawk-$VERSION -./configure --prefix="${PREFIX}" --disable-mpfr --without-libsigsegv && make && make install -cd .. && rm -rf gawk-$VERSION - -cd $PREFIX && tar --remove-files -czf $PKGDIR/bootstrap-gawk-$VERSION.tar.gz . diff --git a/Library/Homebrew/glibc-bootstrap/build-make.sh b/Library/Homebrew/glibc-bootstrap/build-make.sh deleted file mode 100755 index 3678c71..0000000 --- a/Library/Homebrew/glibc-bootstrap/build-make.sh +++ /dev/null @@ -1,11 +0,0 @@ -#/bin/bash - -VERSION=4.3 - -# Build make -curl -LO --insecure https://ftp.gnu.org/gnu/make/make-${VERSION}.tar.gz -tar xzf make-${VERSION}.tar.gz && cd make-${VERSION} -./configure --prefix="${PREFIX}" && make install -cd .. && rm -rf make-${VERSION} - -cd ${PREFIX} && tar --remove-files -czf ${PKGDIR}/bootstrap-make-${VERSION}.tar.gz . diff --git a/Library/Homebrew/glibc-bootstrap/build-python3.sh b/Library/Homebrew/glibc-bootstrap/build-python3.sh deleted file mode 100755 index a8762fe..0000000 --- a/Library/Homebrew/glibc-bootstrap/build-python3.sh +++ /dev/null @@ -1,14 +0,0 @@ -#/bin/bash - -VERSION=3.9.13 - -# Build Python 3 -curl -LO https://www.python.org/ftp/python/$VERSION/Python-$VERSION.tar.xz -tar xf Python-$VERSION.tar.xz && cd Python-$VERSION - -./configure --prefix="${PREFIX}" ac_cv_search_crypt=no ac_cv_search_crypt_r=no -make && make install - -cd .. && rm -rf Python-$VERSION - -cd $PREFIX && tar --remove-files -czf $PKGDIR/bootstrap-python3-${VERSION}.tar.gz . diff --git a/Library/Homebrew/glibc-bootstrap/build-sed.sh b/Library/Homebrew/glibc-bootstrap/build-sed.sh deleted file mode 100755 index 86938da..0000000 --- a/Library/Homebrew/glibc-bootstrap/build-sed.sh +++ /dev/null @@ -1,11 +0,0 @@ -#/bin/bash - -VERSION=4.8 - -# Build sed -curl -LO --insecure https://ftp.gnu.org/gnu/sed/sed-$VERSION.tar.xz -tar xf sed-$VERSION.tar.xz && cd sed-$VERSION -./configure --prefix="${PREFIX}" --without-selinux && make install -cd .. && rm -rf sed-$VERSION - -cd $PREFIX && tar --remove-files -czf $PKGDIR/bootstrap-sed-$VERSION.tar.gz . diff --git a/Library/Homebrew/glibc-bootstrap/debian7/Dockerfile b/Library/Homebrew/glibc-bootstrap/debian7/Dockerfile deleted file mode 100644 index e575c54..0000000 --- a/Library/Homebrew/glibc-bootstrap/debian7/Dockerfile +++ /dev/null @@ -1,12 +0,0 @@ -FROM debian/eol:wheezy -ARG DEBIAN_FRONTEND=noninteractive - -RUN apt-get update \ - && apt-get install -y build-essential curl bzip2 libz-dev - -RUN useradd -m -s /bin/bash linuxbrew - -ENV PREFIX=/tmp/homebrew -RUN su - linuxbrew -c 'mkdir -p /tmp/homebrew' -ENV PKGDIR=/home/linuxbrew/bootstrap-binaries -RUN su - linuxbrew -c 'mkdir -p /home/linuxbrew/bootstrap-binaries' diff --git a/build-binutils.sh b/build-binutils.sh new file mode 100755 index 0000000..3164bcb --- /dev/null +++ b/build-binutils.sh @@ -0,0 +1,30 @@ +#!/bin/bash + +set -e +source "$(dirname "${BASH_SOURCE[0]}")/utils.sh" + +VERSION=2.38 +SHA256SUM=e316477a914f567eccc34d5d29785b8b0f5a10208d36bbacedcc39048ecfe024 + +# Build binutils +wget --no-check-certificate https://ftp.gnu.org/gnu/binutils/binutils-$VERSION.tar.xz +verify_checksum binutils-$VERSION.tar.xz $SHA256SUM + +tar --extract --file binutils-$VERSION.tar.xz +cd binutils-$VERSION +./configure --prefix="${PREFIX}" \ + --enable-deterministic-archives \ + --prefix="${PREFIX}" \ + --disable-werror \ + --enable-interwork \ + --enable-multilib \ + --enable-64-bit-bfd \ + --enable-targets=all \ + --disable-nls + +make +make install +cd .. +rm -rf binutils-$VERSION + +package binutils $VERSION diff --git a/build-bison.sh b/build-bison.sh new file mode 100755 index 0000000..abe51e4 --- /dev/null +++ b/build-bison.sh @@ -0,0 +1,34 @@ +#!/bin/bash + +set -e +source "$(dirname "${BASH_SOURCE[0]}")/utils.sh" + +M4_VERSION=1.4.19 +M4_SHA256SUM=63aede5c6d33b6d9b13511cd0be2cac046f2e70fd0a07aa9573a04a82783af96 +BISON_VERSION=3.8.2 +BISON_SHA256SUM=9bba0214ccf7f1079c5d59210045227bcf619519840ebfa80cd3849cff5a5bf2 + +# Build m4 +wget --no-check-certificate https://ftp.gnu.org/gnu/m4/m4-$M4_VERSION.tar.xz +verify_checksum m4-$M4_VERSION.tar.xz $M4_SHA256SUM + +tar --extract --file m4-$M4_VERSION.tar.xz +cd m4-$M4_VERSION +./configure --prefix="${PREFIX}" +make +make install +cd .. +rm --recursive --force m4-$M4_VERSION + +# Build bison +wget --no-check-certificate https://ftp.gnu.org/gnu/bison/bison-$BISON_VERSION.tar.xz +verify_checksum bison-$BISON_VERSION.tar.xz $BISON_SHA256SUM + +tar --extract --file bison-$BISON_VERSION.tar.xz +cd bison-$BISON_VERSION +./configure --prefix="${PREFIX}" M4="${PREFIX}/bin/m4" +make install +cd .. +rm --recursive --force bison-$BISON_VERSION + +package bison $BISON_VERSION diff --git a/build-gawk.sh b/build-gawk.sh new file mode 100755 index 0000000..cb6d2a2 --- /dev/null +++ b/build-gawk.sh @@ -0,0 +1,21 @@ +#!/bin/bash + +set -e +source "$(dirname "${BASH_SOURCE[0]}")/utils.sh" + +VERSION=5.1.1 +SHA256SUM=d87629386e894bbea11a5e00515fc909dc9b7249529dad9e6a3a2c77085f7ea2 + +# Build gawk +wget --no-check-certificate https://ftp.gnu.org/gnu/gawk/gawk-$VERSION.tar.xz +verify_checksum gawk-$VERSION.tar.xz $SHA256SUM + +tar --extract --file gawk-$VERSION.tar.xz +cd gawk-$VERSION +./configure --prefix="${PREFIX}" --disable-mpfr --without-libsigsegv +make +make install +cd .. +rm --recursive --force gawk-$VERSION + +package gawk ${VERSION} diff --git a/Library/Homebrew/glibc-bootstrap/build-gcc.sh b/build-gcc.sh similarity index 57% rename from Library/Homebrew/glibc-bootstrap/build-gcc.sh rename to build-gcc.sh index af37e48..347fb06 100755 --- a/Library/Homebrew/glibc-bootstrap/build-gcc.sh +++ b/build-gcc.sh @@ -1,10 +1,17 @@ -#/bin/bash +#!/bin/bash + +set -e +source "$(dirname "${BASH_SOURCE[0]}")/utils.sh" VERSION=9.5.0 +SHA256SUM=27769f64ef1d4cd5e2be8682c0c93f9887983e6cfd1a927ce5a0a2915a95cf8f # Build GCC -curl -LO --insecure https://ftp.gnu.org/gnu/gcc/gcc-$VERSION/gcc-$VERSION.tar.xz -tar xf gcc-$VERSION.tar.xz && cd gcc-$VERSION +wget --no-check-certificate https://ftp.gnu.org/gnu/gcc/gcc-$VERSION/gcc-$VERSION.tar.xz +verify_checksum gcc-$VERSION.tar.xz $SHA256SUM + +tar --extract --file gcc-$VERSION.tar.xz +cd gcc-$VERSION # Download GCC support libraries ./contrib/download_prerequisites @@ -12,7 +19,8 @@ tar xf gcc-$VERSION.tar.xz && cd gcc-$VERSION # Disable building documentation gcc_cv_prog_makeinfo_modern=no -mkdir build && cd build +mkdir build +cd build # Disable everything that isn't needed to build glibc. ../configure \ @@ -32,8 +40,10 @@ mkdir build && cd build --disable-multilib \ --with-newlib \ --without-headers -make && make install +make +make install -cd ../.. && rm -rf gcc-$VERSION +cd ../.. +rm --recursive --force gcc-$VERSION -cd $PREFIX && tar --remove-files -czf $PKGDIR/bootstrap-gcc-$VERSION.tar.gz . +package gcc $VERSION diff --git a/build-make.sh b/build-make.sh new file mode 100755 index 0000000..34ac5b4 --- /dev/null +++ b/build-make.sh @@ -0,0 +1,20 @@ +#!/bin/bash + +set -e +source "$(dirname "${BASH_SOURCE[0]}")/utils.sh" + +VERSION=4.3 +SHA256SUM=e05fdde47c5f7ca45cb697e973894ff4f5d79e13b750ed57d7b66d8defc78e19 + +# Build make +wget --no-check-certificate https://ftp.gnu.org/gnu/make/make-${VERSION}.tar.gz +verify_checksum make-${VERSION}.tar.gz $SHA256SUM + +tar --extract --gunzip --file make-${VERSION}.tar.gz +cd make-${VERSION} +./configure --prefix="${PREFIX}" +make install +cd .. +rm --recursive --force make-${VERSION} + +package make ${VERSION} diff --git a/build-python3.sh b/build-python3.sh new file mode 100755 index 0000000..8110525 --- /dev/null +++ b/build-python3.sh @@ -0,0 +1,23 @@ +#!/bin/bash + +set -e +source "$(dirname "${BASH_SOURCE[0]}")/utils.sh" + +VERSION=3.9.13 +SHA256SUM=125b0c598f1e15d2aa65406e83f792df7d171cdf38c16803b149994316a3080f + +# Build Python 3 +wget --no-check-certificate https://www.python.org/ftp/python/$VERSION/Python-$VERSION.tar.xz +verify_checksum Python-$VERSION.tar.xz $SHA256SUM + +tar --extract --file Python-$VERSION.tar.xz +cd Python-$VERSION + +./configure --prefix="${PREFIX}" ac_cv_search_crypt=no ac_cv_search_crypt_r=no +make +make install + +cd .. +rm --recursive --force Python-$VERSION + +package python3 ${VERSION} diff --git a/build-sed.sh b/build-sed.sh new file mode 100755 index 0000000..c8f5560 --- /dev/null +++ b/build-sed.sh @@ -0,0 +1,20 @@ +#!/bin/bash + +set -e +source "$(dirname "${BASH_SOURCE[0]}")/utils.sh" + +VERSION=4.8 +SHA256SUM=f79b0cfea71b37a8eeec8490db6c5f7ae7719c35587f21edb0617f370eeff633 + +# Build sed +wget --no-check-certificate https://ftp.gnu.org/gnu/sed/sed-$VERSION.tar.xz +verify_checksum sed-$VERSION.tar.xz $SHA256SUM + +tar --extract --file sed-$VERSION.tar.xz +cd sed-$VERSION +./configure --prefix="${PREFIX}" --without-selinux +make install +cd .. +rm --recursive --force sed-$VERSION + +package sed $VERSION diff --git a/debian7/Dockerfile b/debian7/Dockerfile new file mode 100644 index 0000000..d947fe5 --- /dev/null +++ b/debian7/Dockerfile @@ -0,0 +1,14 @@ +FROM debian/eol:wheezy +ARG DEBIAN_FRONTEND=noninteractive + +RUN apt-get update \ + && apt-get install -y build-essential bzip2 libz-dev texinfo wget + +RUN useradd --create-home --shell /bin/bash linuxbrew + +ENV CFLAGS="-march=core2 -O2" +ENV CXXFLAGS="-march=core2 -O2" +ENV PREFIX=/tmp/homebrew +RUN su - linuxbrew --command 'mkdir --parents /tmp/homebrew' +ENV PKGDIR=/home/linuxbrew/bootstrap-binaries +RUN su - linuxbrew --command 'mkdir --parents /home/linuxbrew/bootstrap-binaries' diff --git a/utils.sh b/utils.sh new file mode 100755 index 0000000..94313dd --- /dev/null +++ b/utils.sh @@ -0,0 +1,22 @@ +#!/bin/bash + +set -e + +verify_checksum() { + FILE=$1 + EXPECTED_CHECKSUM=$2 + FILE_CHECKSUM=$(sha256sum ${FILE} | cut -d ' ' -f 1) + + if [[ $FILE_CHECKSUM != $EXPECTED_CHECKSUM ]]; then + echo "Checksum mismatch!" + return 1 + fi +} + +package() { + PKGNAME=$1 + VERSION=$2 + + cd $PREFIX + tar --remove-files --create --gzip --file $PKGDIR/bootstrap-$PKGNAME-$VERSION.tar.gz . +}