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

avr-gdb: upgrade to GDB 15.2 #352

Closed
wants to merge 1 commit into from

Conversation

reillylm
Copy link
Contributor

@reillylm reillylm commented Nov 1, 2024

This makes our formula match these other cross-built GDBs in homebrew-core:

Changes from our previous formula:

  • GDB now requires GMP (as of 11.1, commit) and MPFR (as of 14, commit)

  • remove --prefix=#{prefix} + --disable-debug + --disable-dependency-tracking. These have been added to a reusable std_configure_args (as documented here in the Formula Cookbook).

  • remove --disable-install-libbfd. In the bfd configure script, this looks to be disabled if host != target (which is true for us).

  • remove --disable-install-libiberty. In the libiberty configure script, this looks to already be disabled by default.

I think we're also avoiding installing libiberty and libbfd by using make install-gdb instead of make install.

  • remove --disable-nls + --disable-libssp. I think these flags got copied over from our GCC formulae, but they don't actaully apply to GDB (docs for GCC configure options versus GDB configure options). Same goes for our avr-binutils formula dependency.

Addresses #343, since the newer GDB version has addressed the Clang errors outlined in the issue.

Side note about installation directories

I wanted to know if we actually needed to customize all those installation directories in the configure script flags, so I installed to a custom DESTDIR and checked out the files. Here's what I found (the GNU Makefile Conventions docs were helpful here):

GDB installs executables into bindir, headers into includedir (e.g. for GDB's JIT interface), data files into datadir (Python helper functions, the syscall name database), manpages in mandir, Info files in infodir, and locale files in localedir.

Some installed files have a disambiguating prefix of the target architecture (e.g. avr-gdb), but most files don't, so they would overwrite files from an existing installation of GDB. Therefore, we specify a disambiguating subdirectory for all the installation directories, except: bindir (the executables already have the appropriate prefix) and libdir (install-gdb doesn't install anything here).

mandir needs to be modified, not because the installed manpage files don't have the appropriate prefix (they do), or because they get installed to #{prefix}/man instead of #{prefix}/share/man (like the Formula Cookbook cautions against), but because we're customizing datarootdir, which causes make to install the files to #{prefix}/share/#{target}/man instead of #{prefix}/share/man like they should go. So we need to "undo" the change we made to datarootdir here (as an alternative, I think we could have left datarootdir and mandir alone, and instead customized datadir / includedir / localedir / infodir).

This makes our formula match these other cross-built GDBs in homebrew-core:

- [riscv64-elf-gdb](https://github.com/Homebrew/homebrew-core/blob/master/Formula/r/riscv64-elf-gdb.rb)
- [arm-none-eabi-gdb](https://github.com/Homebrew/homebrew-core/blob/master/Formula/a/arm-none-eabi-gdb.rb)
- [x86_64-elf-gdb](https://github.com/Homebrew/homebrew-core/blob/master/Formula/x/x86_64-elf-gdb.rb)
- [i386-elf-gdb](https://github.com/Homebrew/homebrew-core/blob/master/Formula/i/i386-elf-gdb.rb)

Changes from our previous formula:

- GDB now requires GMP (as of 11.1, [commit](https://sourceware.org/git/?p=binutils-gdb.git;a=commitdiff;h=1b4ac058f7daeb9bac9ab0e63a7e73535208dfef)) and MPFR (as of 14, [commit](https://sourceware.org/git/?p=binutils-gdb.git;a=commit;f=configure.ac;h=991180627851801f1999d1ebbc0e569a17e47c74))

- remove `--prefix=#{prefix}` + `--disable-debug` + `--disable-dependency-tracking`. These have been added to a reusable `std_configure_args` (as documented here in the [Formula Cookbook](https://github.com/Homebrew/brew/blob/c81b2e43855f0a9bc86339bda73c3e073b061641/docs/Formula-Cookbook.md#std_configure_args)).

- remove `--disable-install-libbfd`. In the [bfd configure script](https://sourceware.org/git/?p=binutils-gdb.git;a=blob;f=bfd/acinclude.m4;h=0ba7957760dfd13a9a97c2c4fbca30f231393c28;hb=HEAD#l62), this looks to be disabled if `host != target` (which is true for us).

- remove `--disable-install-libiberty`. In the [libiberty configure script](https://sourceware.org/git/?p=binutils-gdb.git;a=blob;f=libiberty/configure.ac;h=c27e08e14288ed489e45e23b0c83e009721b47ba;hb=HEAD#l148), this looks to already be disabled by default.

I think we're also avoiding installing libiberty and libbfd by using `make install-gdb` instead of `make install`.

- remove `--disable-nls` + `--disable-libssp`. I think these flags got copied over from our GCC formulae, but they don't actaully apply to GDB (docs for [GCC configure options](https://gcc.gnu.org/install/configure.html) versus [GDB configure options](https://sourceware.org/gdb/current/onlinedocs/gdb.html/Configure-Options.html)). Same goes for our `avr-binutils` formula dependency.

Addresses osx-cross#343, since the newer GDB version has addressed the Clang errors outlined in the issue.

**Side note about installation directories**

I wanted to know if we actually needed to customize all those installation directories in the configure script flags, so I installed to a custom `DESTDIR` and checked out the files. Here's what I found (the [GNU Makefile Conventions docs](https://www.gnu.org/prep/standards/html_node/Directory-Variables.html) were helpful here):

GDB installs executables into `bindir`, headers into `includedir` (e.g. for GDB's [JIT interface](https://sourceware.org/gdb/download/onlinedocs/gdb.html/Writing-JIT-Debug-Info-Readers.html#Writing-JIT-Debug-Info-Readers)), data files into `datadir` ([Python helper functions](https://sourceware.org/gdb/download/onlinedocs/gdb.html/Python.html#Python), the [syscall name database](https://sourceware.org/gdb/download/onlinedocs/gdb.html/Set-Catchpoints.html#Set-Catchpoints)), manpages in `mandir`, Info files in `infodir`, and locale files in `localedir`.

Some installed files have a disambiguating prefix of the target architecture (e.g. `avr-gdb`), but most files don't, so they would overwrite files from an existing installation of GDB. Therefore, we specify a disambiguating subdirectory for all the installation directories, _except_: `bindir` (the executables already have the appropriate prefix) and `libdir` (`install-gdb` doesn't install anything here).

`mandir` needs to be modified, not because the installed manpage files don't have the appropriate prefix (they do), or because they get installed to `#{prefix}/man` instead of `#{prefix}/share/man` (like the [Formula Cookbook cautions against](https://github.com/Homebrew/brew/blob/c81b2e43855f0a9bc86339bda73c3e073b061641/docs/Formula-Cookbook.md#manuals)), but because we're customizing `datarootdir`, which causes `make` to install the files to `#{prefix}/share/#{target}/man` instead of `#{prefix}/share/man` like they should go. So we need to "undo" the change we made to `datarootdir` here (as an alternative, I think we could have left `datarootdir` and `mandir` alone, and instead customized `datadir` / `includedir` / `localedir` / `infodir`).
@ladislas ladislas closed this in 30dace2 Nov 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants