Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Autotools rework #210

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
146 changes: 125 additions & 21 deletions bootstrap.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,39 @@ sources:
tag: 'binutils-2_32'
version: '2.32'
tools_required:
# TODO Dennis: autoconf-2.71 is too new, I'll grab this during the toolchain upgrade.
- host-autoconf-v2.69
- host-automake-v1.15
- host-automake-v1.16
- host-libtool
regenerate:
- args: ['autoreconf']
- args: ['autoreconf', '-fvi', '-I../config']
workdir: '@THIS_SOURCE_DIR@/opcodes'
- args: ['libtoolize', '-cfvi']
workdir: '@THIS_SOURCE_DIR@/opcodes'
- args: ['autoreconf', '-fvi', '-I../config']
workdir: '@THIS_SOURCE_DIR@/bfd'
- args: ['libtoolize', '-cfvi']
workdir: '@THIS_SOURCE_DIR@/bfd'
- args: ['autoreconf', '-fvi', '-I../config']
workdir: '@THIS_SOURCE_DIR@/ld'
- args: ['libtoolize', '-cfvi']
workdir: '@THIS_SOURCE_DIR@/ld'
- args: ['autoreconf', '-fvi', '-I../config']
workdir: '@THIS_SOURCE_DIR@/'
- args: ['libtoolize', '-cfvi']
workdir: '@THIS_SOURCE_DIR@/'
- args: ['autoreconf', '-fvi', '-I../config']
workdir: '@THIS_SOURCE_DIR@/gas'
- args: ['libtoolize', '-cfvi']
workdir: '@THIS_SOURCE_DIR@/gas'
- args: ['autoreconf', '-fvi', '-I../config']
workdir: '@THIS_SOURCE_DIR@/binutils'
- args: ['libtoolize', '-cfvi']
workdir: '@THIS_SOURCE_DIR@/binutils'
- args: ['autoreconf', '-fvi', '-I../config']
workdir: '@THIS_SOURCE_DIR@/gprof'
- args: ['libtoolize', '-cfvi']
workdir: '@THIS_SOURCE_DIR@/gprof'
Comment on lines -71 to +100
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this done?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

According to mint, this is the better way of doing it. I tried not doing it in all directories but that will give libtool version mismatches. See also this comment thread.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is another reason to invoke the right version of the right tool, and that alone, for regenerating gcc files (remember, we aren't dealing with a normal autotools build system, but a broken one)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah not gonna carry libtool 2.2.7, gcc can suck it.

Copy link
Member

@ArsenArsen ArsenArsen Oct 9, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

didn't say that you should, neither autoconf and automake install libtool, this is only a problem if you don't use those (on top of the other problems that using wrong versions will cause)

EDIT: also, regardless, gcc (mostly, iirc libgo is the only exception, which doesn't matter here) uses a single libtool in the source of the repo, selected later by other build scripts explicitly, so getting version mismatches in other directories is definitely something going wrong


- name: cralgo
subdir: 'ports'
Expand Down Expand Up @@ -118,13 +146,39 @@ sources:
tag: 'releases/gcc-11.1.0'
version: '11.1.0'
tools_required:
# TODO Dennis: autoconf 2.71 is too new, I'll take it during the toolchain upgrade.
- host-autoconf-v2.69
- host-automake-v1.11
- host-automake-v1.16
- host-libtool
regenerate:
- args: ['autoconf']
- args: ['autoreconf', '-fvi', '-I../config']
workdir: '@THIS_SOURCE_DIR@/gcc'
- args: ['autoreconf', '-fvi', '-I../config']
workdir: '@THIS_SOURCE_DIR@/libstdc++-v3'
- args: ['libtoolize', '-cfvi']
workdir: '@THIS_SOURCE_DIR@/gcc'
- args: ['autoconf']
- args: ['libtoolize', '-cfvi']
workdir: '@THIS_SOURCE_DIR@/libstdc++-v3'
- args: ['autoreconf', '-fvi', '-I../config']
workdir: '@THIS_SOURCE_DIR@/'
- args: ['libtoolize', '-cfvi']
workdir: '@THIS_SOURCE_DIR@/'
- args: ['autoreconf', '-fvi', '-I../config']
workdir: '@THIS_SOURCE_DIR@/libbacktrace'
- args: ['libtoolize', '-cfvi']
workdir: '@THIS_SOURCE_DIR@/libbacktrace'
- args: ['autoreconf', '-fvi', '-I../config']
workdir: '@THIS_SOURCE_DIR@/lto-plugin'
- args: ['libtoolize', '-cfvi']
workdir: '@THIS_SOURCE_DIR@/lto-plugin'
- args: ['autoreconf', '-fvi', '-I../config']
workdir: '@THIS_SOURCE_DIR@/libcc1'
- args: ['libtoolize', '-cfvi']
workdir: '@THIS_SOURCE_DIR@/libcc1'
- args: ['autoreconf', '-fvi', '-I../config']
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why repeat this instead of just overriding the config.sub autoconf holds?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

According to mint, this is the better way of doing it. I tried not doing it in all directories but that will give libtool version mismatches.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what's -I../config for? my guess was to specify where config.{guess,sub} are, but we should just put them into whatever provides them instead

Copy link
Member

@ArsenArsen ArsenArsen Oct 4, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also autoreconf is broken on GCC, so it has a script that can update files in the right order, but since we know what we patch, it's probably better to just invoke the tools directly in the specific case of GCC

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not entirely sure if the ../config stuff is even needed, we might be able to just drop it. Autoreconf and libtoolize on gcc work fine tho, so I don't see what is broken about that.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, by coincidence, not design. we should definitely prefer to have no -I since that can only confuse whoever else is trying to use autoconf

workdir: '@THIS_SOURCE_DIR@/libcpp'
- args: ['libtoolize', '-cfvi']
workdir: '@THIS_SOURCE_DIR@/libcpp'
Comment on lines -124 to +181
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this done?


- name: protobuf
subdir: 'ports'
Expand Down Expand Up @@ -226,6 +280,24 @@ tools:
install:
- args: ['make', 'install']

- name: host-autoconf-v2.71
labels: [aarch64, riscv64]
architecture: noarch
source:
name: autoconf-v2.71
subdir: 'ports'
url: 'https://ftp.gnu.org/gnu/autoconf/autoconf-2.71.tar.xz'
format: 'tar.xz'
checksum: blake2b:7fd4b98b4cfff10720e8da6ee91045637991643b50fcb3e47a0ecfcc01600f7b7b36fd1c0a5f08b68a418f1bdbd8d5a98de1008157595dd37cc3a31facb61416
extract_path: 'autoconf-2.71'
version: '2.71'
configure:
- args: ['@THIS_SOURCE_DIR@/configure', '--prefix=@PREFIX@']
compile:
- args: ['make', '-j@PARALLELISM@']
install:
- args: ['make', 'install']

- name: host-automake-v1.11
labels: [aarch64, riscv64]
architecture: noarch
Expand Down Expand Up @@ -296,6 +368,33 @@ tools:
# Stop aclocal from complaining.
- args: ['ln', '-sf', '@PREFIX@/share/aclocal-1.15', '@PREFIX@/share/aclocal']

- name: host-automake-v1.16
labels: [aarch64, riscv64]
architecture: noarch
source:
name: automake-v1.16
subdir: 'ports'
git: 'https://git.savannah.gnu.org/git/automake.git'
tag: 'v1.16.5'
version: '1.16.5'
tools_required:
- host-autoconf-v2.71
regenerate:
- args: ['./bootstrap']
tools_required:
- host-autoconf-v2.71
configure:
- args:
- '@THIS_SOURCE_DIR@/configure'
- '--prefix=@PREFIX@'
- 'MAKEINFO=/bin/true'
compile:
- args: ['make', '-j@PARALLELISM@']
install:
- args: ['make', 'install']
# Stop aclocal from complaining.
- args: ['ln', '-sf', '@PREFIX@/share/aclocal-1.16', '@PREFIX@/share/aclocal']

- name: host-managarm-tools
labels: [aarch64, riscv64]
architecture: noarch
Expand Down Expand Up @@ -328,19 +427,24 @@ tools:
name: libtool
subdir: 'ports'
git: 'https://git.savannah.gnu.org/git/libtool.git'
tag: 'v2.4.6'
version: '2.4.6'
tag: 'v2.4.7'
version: '2.4.7'
tools_required:
- host-autoconf-v2.69
- host-automake-v1.15
- host-autoconf-v2.71
- host-automake-v1.16
regenerate:
# libtool's ./bootstrap does a shallow clone with insufficient depth.
- args: ['git', 'submodule', 'update', '--init']
- args: ['./bootstrap']
- args: ['cp',
'@BUILD_ROOT@/tools/host-automake-v1.16/share/automake-1.16/config.sub',
'@THIS_SOURCE_DIR@/build-aux/']
- args: ['cp',
'@BUILD_ROOT@/tools/host-automake-v1.16/share/automake-1.16/config.guess',
'@THIS_SOURCE_DIR@/build-aux/']
tools_required:
- host-autoconf-v2.69
- host-automake-v1.15
revision: 2
- host-autoconf-v2.71
- host-automake-v1.16
configure:
- args:
- '@THIS_SOURCE_DIR@/configure'
Expand Down Expand Up @@ -391,7 +495,7 @@ tools:
labels: [aarch64, riscv64]
architecture: '@OPTION:arch@'
from_source: binutils
revision: 2
revision: 3
configure:
- args:
- '@THIS_SOURCE_DIR@/configure'
Expand Down Expand Up @@ -437,7 +541,7 @@ tools:
tools_required:
- tool: cross-binutils
recursive: true
revision: 2
revision: 3
configure:
- args:
- '@THIS_SOURCE_DIR@/configure'
Expand Down Expand Up @@ -485,7 +589,7 @@ tools:
tools_required:
- tool: cross-binutils
recursive: true
revision: 2
revision: 3
configure:
- args:
- '@THIS_SOURCE_DIR@/configure'
Expand Down Expand Up @@ -542,7 +646,7 @@ tools:
tools_required:
- tool: cross-binutils
recursive: true
revision: 2
revision: 3
configure:
- args:
- '@THIS_SOURCE_DIR@/configure'
Expand Down Expand Up @@ -640,10 +744,10 @@ packages:
categories: ['sys-devel']
from_source: binutils
tools_required:
- tool: system-gcc
- system-gcc
pkgs_required:
- mlibc
revision: 4
revision: 5
configure:
- args:
- '@THIS_SOURCE_DIR@/configure'
Expand All @@ -657,8 +761,8 @@ packages:
# -g blows up the binary size.
- 'CFLAGS=-O2'
build:
#- args: ['make', '-j@PARALLELISM@', 'all-binutils', 'all-gas', 'all-ld']
- args: ['make', 'all-binutils', 'all-gas', 'all-ld']
- args: ['make', '-j@PARALLELISM@', 'all-binutils', 'all-gas', 'all-ld']
# - args: ['make', 'all-binutils', 'all-gas', 'all-ld']
Comment on lines -660 to +765
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can drop the comment.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will do.

- args: ['make', 'install-binutils', 'install-gas', 'install-ld']
environ:
DESTDIR: '@THIS_COLLECT_DIR@'
Expand Down Expand Up @@ -827,7 +931,7 @@ packages:
- mpfr
- mpc
- zlib
revision: 3
revision: 4
configure:
- args:
- '@THIS_SOURCE_DIR@/configure'
Expand Down
101 changes: 101 additions & 0 deletions patches/automake-v1.16/0001-Add-Managarm-support.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
From 3795bc9b268c3c3025074a3511f8454066fe2ca6 Mon Sep 17 00:00:00 2001
From: Dennis Bonke <[email protected]>
Date: Mon, 3 Oct 2022 22:30:43 +0200
Subject: [PATCH] Add Managarm support

Signed-off-by: Dennis Bonke <[email protected]>
---
lib/config.guess | 6 ++++++
lib/config.sub | 26 +++++++++++++++++++++++---
2 files changed, 29 insertions(+), 3 deletions(-)

diff --git a/lib/config.guess b/lib/config.guess
index e81d3ae..9cafc6a 100755
--- a/lib/config.guess
+++ b/lib/config.guess
@@ -963,6 +963,12 @@ EOF
GNU_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'`
GUESS=$UNAME_MACHINE-unknown-$GNU_SYS$GNU_REL-$LIBC
;;
+ x86_64:[Mm]anagarm:*:*|i?86:[Mm]anagarm:*:*)
+ GUESS="$UNAME_MACHINE-pc-managarm-mlibc"
+ ;;
+ *:[Mm]anagarm:*:*)
+ GUESS="$UNAME_MACHINE-unknown-managarm-mlibc"
+ ;;
*:Minix:*:*)
GUESS=$UNAME_MACHINE-unknown-minix
;;
diff --git a/lib/config.sub b/lib/config.sub
index d74fb6d..ef0004f 100755
--- a/lib/config.sub
+++ b/lib/config.sub
@@ -145,7 +145,7 @@ case $1 in
nto-qnx* | linux-* | uclinux-uclibc* \
| uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* \
| netbsd*-eabi* | kopensolaris*-gnu* | cloudabi*-eabi* \
- | storm-chaos* | os2-emx* | rtmk-nova*)
+ | storm-chaos* | os2-emx* | rtmk-nova* | managarm-*)
basic_machine=$field1
basic_os=$maybe_os
;;
@@ -1336,6 +1336,10 @@ EOF
kernel=linux
os=`echo "$basic_os" | sed -e 's|linux|gnu|'`
;;
+ managarm*)
+ kernel=managarm
+ os=$(echo $basic_os | sed -e 's|managarm|mlibc|')
+ ;;
*)
kernel=
os=$basic_os
@@ -1748,7 +1752,8 @@ case $os in
| skyos* | haiku* | rdos* | toppers* | drops* | es* \
| onefs* | tirtos* | phoenix* | fuchsia* | redox* | bme* \
| midnightbsd* | amdhsa* | unleashed* | emscripten* | wasi* \
- | nsk* | powerunix* | genode* | zvmoe* | qnx* | emx* | zephyr*)
+ | nsk* | powerunix* | genode* | zvmoe* | qnx* | emx* | zephyr* \
+ | mlibc* )
;;
# This one is extra strict with allowed versions
sco3.2v2 | sco3.2v[4-9]* | sco5v6*)
@@ -1756,6 +1761,9 @@ case $os in
;;
none)
;;
+ kernel* )
+ # Restricted further below
+ ;;
*)
echo Invalid configuration \`"$1"\': OS \`"$os"\' not recognized 1>&2
exit 1
@@ -1770,12 +1778,24 @@ case $kernel-$os in
;;
uclinux-uclibc* )
;;
- -dietlibc* | -newlib* | -musl* | -relibc* | -uclibc* )
+ managarm-mlibc* )
+ ;;
+ managarm-kernel* )
+ ;;
+ -dietlibc* | -newlib* | -musl* | -relibc* | -uclibc* | -mlibc* )
# These are just libc implementations, not actual OSes, and thus
# require a kernel.
echo "Invalid configuration \`$1': libc \`$os' needs explicit kernel." 1>&2
exit 1
;;
+ -kernel* )
+ echo "Invalid configuration \`$1': -kernel must not appear on its own." 1>&2
+ exit 1
+ ;;
+ *-kernel* )
+ echo "Invalid configuration \`$1': Kernel \`$kernel' does not support -kernel." 1>&2
+ exit 1
+ ;;
kfreebsd*-gnu* | kopensolaris*-gnu*)
;;
vxworks-simlinux | vxworks-simwindows | vxworks-spe)
--
2.37.2

Loading