+gnu.org/{gawk,mpc,mpfr,gcc,binutils,texinfo} (#97)

* add as much of gnu as we need to get gcc built

* address code review
This commit is contained in:
Jacob Heider 2023-01-17 18:39:25 -05:00 committed by GitHub
parent 6585833ddb
commit 7dcc53658f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 362 additions and 0 deletions

View file

@ -0,0 +1,54 @@
distributable:
url: https://ftp.gnu.org/gnu/binutils/binutils-{{ version.raw }}.tar.xz
strip-components: 1
versions:
#TODO HTML listing: https://ftp.gnu.org/gnu/binutils/
- v2.39
build:
dependencies:
tea.xyz/gx/make: '*'
gnu.org/bison: '*'
gnu.org/texinfo: '*'
darwin:
tea.xyz/gx/cc: c99
linux:
gnu.org/gcc: '*'
script: |
# FIXME: bootstrap - we need `as` from binutils to build with gcc
if test "{{hw.platform}}" = "linux"; then
if command -v sudo; then
sudo apt-get --yes install binutils
else # assume no sudo = we can just run apt-get
apt-get --yes install binutils
fi
fi
./configure --prefix={{ prefix }}
make --jobs {{ hw.concurrency }}
make install
test:
script: objdump -x $(which objdump) | grep -s $TEST_STRING
env:
# Representitive output to look for
darwin:
TEST_STRING: _opendir
linux:
TEST_STRING: GNU_HASH
provides:
- bin/addr2line
- bin/ar
- bin/c++filt
- bin/elfedit
- bin/nm
- bin/objcopy
- bin/objdump
- bin/ranlib
- bin/readelf
- bin/size
- bin/strings
- bin/strip

View file

@ -0,0 +1,27 @@
distributable:
url: https://ftp.gnu.org/gnu/gawk/gawk-{{ version.raw }}.tar.xz
strip-components: 1
versions:
#TODO HTML listing: https://ftp.gnu.org/gnu/gawk/
- 5.2.1
provides:
- bin/awk
- bin/gawk
- bin/gawk-{{version}}
- bin/gawkbug
build:
dependencies:
tea.xyz/gx/make: '*'
tea.xyz/gx/cc: c99
script: |
./configure --prefix={{ prefix }}
make --jobs {{ hw.concurrency }} install
test:
make test
test:
script:
test "$(echo "Goodbye, cruel World" | gawk '{ gsub("Goodbye, cruel", "Hello,"); print }')" = "Hello, World"

View file

@ -0,0 +1,119 @@
distributable:
url: https://ftp.gnu.org/gnu/gcc/gcc-{{version.raw}}/gcc-{{ version.raw }}.tar.xz
strip-components: 1
versions:
github: gcc-mirror/gcc/tags
strip: /^releases\/gcc-/
dependencies:
darwin:
apple.com/xcode/clt: '*' # needed for MacOS.sdk
gnu.org/gmp: '>=4.2'
gnu.org/mpfr: '>=2.4.0'
gnu.org/mpc: '>=0.8.0'
# Post bootstrap
# gnu.org/binutils: '*'
build:
dependencies:
darwin:
tea.xyz/gx/cc: c99 # need cc to strip `-nodefaultrpaths`
# linux:
# gnu.org/gcc: '*'
gnu.org/make: '*'
perl.org: '^5.6.1'
gnu.org/patch: '*'
curl.se: '*'
script: |
# Branch from the Darwin maintainer of GCC, with a few generic fixes and
# Apple Silicon support, located at https://github.com/iains/gcc-12-branch
curl https://raw.githubusercontent.com/Homebrew/formula-patches/1d184289/gcc/gcc-12.2.0-arm.diff | patch -p1
# skip multilib prefixes for best interop
sed -i.bak -e 's_m64=../lib64_m64=_' gcc/config/i386/t-linux64
rm gcc/config/i386/t-linux64.bak
### /*** BOOTSTRAP BLOCK - REMOVE AFTER BOOTSTRAP ***/
if test "{{hw.platform}}" = "linux"; then
command -v sudo && SUDO=sudo
$SUDO apt-get --yes install gcc g++
fi
### /*** END BOOTSTRAP BLOCK ***/
mkdir build
cd build
# Note that env vars with spaces don't behave well, due to shells and life
# in general. So we handle those in script. Unless and until we decide to
# change to bash arrays, as in https://github.com/teaxyz/cli/pull/283,
# but that will have untold and unforseen consequences.
# convert ARGS to an array since we need space-including values
export ARGS=($ARGS --with-pkgversion="tea GCC {{version}}")
if test {{hw.platform}} = "linux"; then
export ARGS=("${ARGS[@]}" --with-boot-ldflags="-static-libstdc++ -static-libgcc $LDFLAGS")
fi
../configure "${ARGS[@]}"
make --jobs {{ hw.concurrency }}
make install
cd {{prefix}}/bin
ln -s c++ gc++
env:
ARGS:
- --prefix={{ prefix }}
- --libdir={{ prefix }}/lib
- --enable-languages=c,c++,objc,obj-c++
- --with-bugurl="https://github.com/teaxyz/pantry.extra/issues"
- --disable-bootstrap
- --disable-nls
linux:
ARGS:
- --disable-multilib
- --enable-default-pie
darwin:
ARGS:
# Reliance on CLT hard path is yuck.
- --with-sysroot=/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk
darwin/aarch64:
ARGS:
# https://en.wikipedia.org/wiki/Darwin_(operating_system)#Darwin_16%E2%80%9319;_OS_X_rebranded_into_macOS
- --build=aarch64-apple-darwin20.0.0
darwin/x86-64:
ARGS:
- --build=x86_64-apple-darwin20.0.0
test:
# FIXME: remove after bootstrap of gcc/binutils
dependencies:
gnu.org/binutils: '*' # for `as`
script: |
gcc --version | grep -q "tea GCC {{version}}"
gcc -o test1 test.c -lgmp
./test1
g++ -o test2 test.cc
test "$(./test2)" = "Hello, world!"
provides:
# we keep `c++` in tea.xyz/gx/cc, but we expose it
# as `gc++` here in case someone wants it explicitly
- bin/gc++
- bin/cpp
- bin/g++
- bin/gcc
- bin/gcc-ar
- bin/gcc-nm
- bin/gcc-ranlib
- bin/gcov
- bin/gcov-dump
- bin/gcov-tool
- bin/lto-dump

View file

@ -0,0 +1,14 @@
#include <gmp.h>
#include <stdlib.h>
int main()
{
mpz_t i, j, k;
mpz_init_set_str(i, "1a", 16);
mpz_init(j);
mpz_init(k);
mpz_sqrtrem(j, k, i);
if (mpz_get_si(j) != 5 || mpz_get_si(k) != 1)
abort();
return 0;
}

View file

@ -0,0 +1,10 @@
#include <iostream>
struct exception { };
int main()
{
std::cout << "Hello, world!" << std::endl;
try { throw exception{}; }
catch (exception) { }
catch (...) { }
return 0;
}

View file

@ -0,0 +1,43 @@
distributable:
url: https://ftp.gnu.org/gnu/mpc/mpc-{{ version.raw }}.tar.gz
strip-components: 1
versions:
#TODO HTML listing: https://ftp.gnu.org/gnu/mpc/
- 1.3.1
build:
dependencies:
tea.xyz/gx/make: '*'
tea.xyz/gx/cc: c99
gnu.org/gmp: '>=4.2'
gnu.org/mpfr: ^4
script: |
./configure --prefix={{ prefix }}
make --jobs {{ hw.concurrency }} install
test:
make test
test:
dependencies:
tea.xyz/gx/cc: c99
gnu.org/gmp: '>=4.2'
gnu.org/mpfr: ^4.0
script: |
mv $FIXTURE test.c
cc -lgmp -lmpc -lmpfr test.c -o test
./test
fixture: |
#include <mpc.h>
#include <assert.h>
#include <math.h>
int main() {
mpc_t x;
mpc_init2 (x, 256);
mpc_set_d_d (x, 1., INFINITY, MPC_RNDNN);
mpc_tanh (x, x, MPC_RNDNN);
assert (mpfr_nan_p (mpc_realref (x)) && mpfr_nan_p (mpc_imagref (x)));
mpc_clear (x);
return 0;
}

View file

@ -0,0 +1,46 @@
distributable:
url: https://ftp.gnu.org/gnu/mpfr/mpfr-{{ version.raw }}.tar.xz
strip-components: 1
versions:
#TODO HTML listing: https://ftp.gnu.org/gnu/mpfr/
- 4.1.1
build:
dependencies:
tea.xyz/gx/make: '*'
tea.xyz/gx/cc: c99
gnu.org/gmp: '>=4.2'
script: |
./configure --prefix={{ prefix }}
make --jobs {{ hw.concurrency }} install
test:
make test
test:
dependencies:
gnu.org/gmp: '>=4.2'
tea.xyz/gx/cc: c99
script: |
mv $FIXTURE test.c
gcc -lgmp -lmpfr test.c -o test
test $(./test) = '{{version}}'
fixture: |
#include <mpfr.h>
#include <math.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
int main() {
mpfr_t x, y;
mpfr_inits2 (256, x, y, NULL);
mpfr_set_ui (x, 2, MPFR_RNDN);
mpfr_rootn_ui (y, x, 2, MPFR_RNDN);
mpfr_pow_si (x, y, 4, MPFR_RNDN);
mpfr_add_si (y, x, -4, MPFR_RNDN);
mpfr_abs (y, y, MPFR_RNDN);
if (fabs(mpfr_get_d (y, MPFR_RNDN)) > 1.e-30) abort();
printf("%s", mpfr_get_version());
return 0;
}

View file

@ -0,0 +1,49 @@
distributable:
url: https://ftp.gnu.org/gnu/texinfo/texinfo-{{ version }}.tar.xz
strip-components: 1
versions:
#TODO HTML listing: https://ftp.gnu.org/gnu/texinfo/
- 7.0.1
dependencies:
perl.org: '*'
build:
dependencies:
tea.xyz/gx/cc: c99
tea.xyz/gx/make: '*'
gnu.org/gettext: '*'
invisible-island.net/ncurses: '*'
script: |
./configure --prefix={{ prefix }}
make --jobs {{ hw.concurrency }} install
cd {{prefix}}/bin
for file in pod2texi texi2any; do
sed -i.bak "s_#! {{deps.perl.org.prefix}}/bin/perl_#!/usr/bin/env perl_" $file
rm $file.bak
done
test:
script: |
makeinfo $FIXTURE
grep -q 'Hello World!' $(basename $FIXTURE).info
fixture: |
@ifnottex
@node Top
@top Hello World!
@end ifnottex
@bye
provides:
- bin/info
- bin/install-info
- bin/makeinfo
- bin/pdftexi2dvi
- bin/pod2texi
- bin/texi2any
- bin/texi2dvi
- bin/texi2pdf
- bin/texindex