Skip to content

Commit

Permalink
Trac #29549: bootstrap: Clean up use of gettextize
Browse files Browse the repository at this point in the history
See discussion at
Homebrew/homebrew-core#53192

Instead of using `gettextize` at bootstrap time, we just vendor the
files `m4/iconv.m4` and `config/config.rpath` in the source tree.

This is done by using gnulib: `gnulib-tool --import iconv` (and ignoring
all the other files that it is offering us).

URL: https://trac.sagemath.org/29549
Reported by: mkoeppe
Ticket author(s): Matthias Koeppe
Reviewer(s): Dima Pasechnik
  • Loading branch information
Release Manager committed Jul 8, 2022
2 parents 24b4eeb + d9bd946 commit d98aa73
Show file tree
Hide file tree
Showing 6 changed files with 978 additions and 50 deletions.
7 changes: 6 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,12 @@
# Autotools generated files
/aclocal.m4
/autom4te.cache/
/config/
/config/install-sh
/config/compile
/config/config.guess
/config/config.sub
/config/install-sh
/config/missing
/config.log
/config.status
/configure
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ distclean: build-clean
# Delete all auto-generated files which are distributed as part of the
# source tarball
bootstrap-clean:
rm -rf config configure build/make/Makefile-auto.in
rm -rf config/install-sh config/compile config/config.guess config/config.sub config/missing configure build/make/Makefile-auto.in
rm -f src/doc/en/installation/*.txt
rm -rf src/doc/en/reference/spkg/*.rst
rm -f environment.yml
Expand Down
51 changes: 3 additions & 48 deletions bootstrap
Original file line number Diff line number Diff line change
Expand Up @@ -33,50 +33,6 @@ PKG=build/pkgs/configure
MAKE="${MAKE:-make}"
CONFVERSION=$(cat $PKG/package-version.txt)

install_config_rpath() {
# The file config.rpath which comes from gettext is supposed to be
# installed by automake, but due to a bug in most distros it is not;
# see https://trac.sagemath.org/ticket/27823#comment:17
#
# Here we need to determine where gettext stores its data files and
# copy config.rpath from there to config/
gettextize="$(command -v gettextize)"
if [ -z "$gettextize" ]; then
echo >&2 "gettext and the gettextize program must be installed and be in"
echo >&2 "your PATH. E.g. Homebrew installs them in /usr/local/opt/gettext/bin."
return 179
fi
eval `sed -n '/^prefix=.*$/p' "$gettextize"`
eval `sed -n '/^datarootdir=.*$/p' "$gettextize"`
eval `sed -n '/^: \${gettext_datadir=.*$/p' "$gettextize"`

if [ -z "$gettext_datadir" ]; then
eval `sed -n '/^gettext_dir=.*$/p' "$gettextize"`
# In older versions (before 2014) this is spelled gettext_dir
# See https://github.com/autotools-mirror/gettext/commit/ff18897068486560e2bb421004cfbd42b7cdd0f8
gettext_datadir="$gettext_dir"
fi

if [ -z "$gettext_datadir" ]; then
echo >&2 "Failed to read the gettext_datadir directory from $gettextize"
echo >&2 "The config.rpath file must manually be copied into config/"
echo >&2 "This file is installed with gettext typically in /usr/share/gettext"
return 179
fi

config_rpath="$gettext_datadir/config.rpath"
if [ ! -f "$config_rpath" ]; then
echo >&2 "Missing $config_rpath file; this indicates a broken gettext install."
return 179
fi

if [ "${BOOTSTRAP_QUIET}" = "no" ]; then
echo "bootstrap:$LINENO: installing 'config/config.rpath'"
fi
cp "$config_rpath" config/
}



bootstrap () {
if [ "${BOOTSTRAP_QUIET}" = "no" ]; then
Expand Down Expand Up @@ -160,7 +116,6 @@ SAGE_SPKG_FINALIZE([$pkgname], [$pkgtype], [$SPKG_SOURCE], [$SPKG_TREE_VAR])"
# third, filter, and then swap them back.
./bootstrap-conda && \
src/doc/bootstrap && \
install_config_rpath && \
aclocal -I m4 && \
automake --add-missing --copy build/make/Makefile-auto 3>&1 1>&2 2>&3 \
| sed "${QUIET_SED_FILTER}" 3>&1 1>&2 2>&3 && \
Expand All @@ -170,7 +125,7 @@ SAGE_SPKG_FINALIZE([$pkgname], [$pkgtype], [$SPKG_SOURCE], [$SPKG_TREE_VAR])"
case $st in
0) true;; # Success

179|16|63|127) # install_config_rpath failed|no m4 for pkg-config|autotools not installed|or version too old
179|16|63|127) # no m4 for pkg-config|autotools not installed|or version too old
if [ $DOWNLOAD = yes ]; then
echo >&2 "Bootstrap failed, downloading required files instead."
bootstrap_download || exit $?
Expand All @@ -182,7 +137,7 @@ SAGE_SPKG_FINALIZE([$pkgname], [$pkgtype], [$SPKG_SOURCE], [$SPKG_TREE_VAR])"
else
verb="upgrade"
fi
echo >&2 "Bootstrap failed. Either $verb autotools and gettext; or run bootstrap with"
echo >&2 "Bootstrap failed. Either $verb autotools; or run bootstrap with"
echo >&2 "the -d option to download the auto-generated files instead."

SYSTEM=$(build/bin/sage-guess-package-system)
Expand Down Expand Up @@ -243,7 +198,7 @@ save () {
mkdir -p upstream
tar zcf "$NEWCONFBALL" \
configure \
config/* \
config/install-sh config/compile config/config.guess config/config.sub config/missing \
build/make/Makefile-auto.in \
src/doc/en/installation/*.txt \
src/doc/en/reference/spkg/*.rst \
Expand Down
1 change: 1 addition & 0 deletions build/bin/write-dockerfile.sh
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,7 @@ FROM with-system-packages as bootstrapped
RUN mkdir -p sage
WORKDIR sage
$ADD Makefile VERSION.txt COPYING.txt condarc.yml README.md bootstrap bootstrap-conda configure.ac sage .homebrew-build-env tox.ini Pipfile.m4 ./
$ADD config/config.rpath config/config.rpath
$ADD src/doc/bootstrap src/doc/bootstrap
$ADD src/bin src/bin
$ADD src/Pipfile.m4 src/pyproject.toml.m4 src/requirements.txt.m4 src/setup.cfg.m4 src/VERSION.txt src/
Expand Down
Loading

0 comments on commit d98aa73

Please sign in to comment.