Skip to content

Commit

Permalink
Use world-bin and install docs separately on 17
Browse files Browse the repository at this point in the history
PostgreSQL 17 removed pre-compiled docs from the source tarball,
including docs. The docs will now be built from source, but will fail if
the required [DocBook tools] are not installed. To compensate, releases
from 17.0 on are complemented by a docs tarball.

We don't want to add the overhead of requiring the [DocBook tools]. So,
when building Postgres 17 and higher, teach pgenv to use the new
`world-bin` and `install-world-bin` targets to build everything except
non-binary files, which includes docs. Then download and install the
docs tarball and install its contents separately.

Resolves #79.

  [DocBook tools]: https://www.postgresql.org/docs/current/docguide-toolsets.html
  • Loading branch information
briansalehi authored and theory committed Oct 16, 2024
1 parent f2a7486 commit d97b050
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions bin/pgenv
Original file line number Diff line number Diff line change
Expand Up @@ -1359,6 +1359,20 @@ case $1 in
if [ ! -f $PG_TARBALL ]; then
$PGENV_CURL -fLO ${PGENV_DOWNLOAD_ROOT}/v$v/${PG_TARBALL}
fi

# Starting from 17.x docs target might fail
# due to a missing dependency (docbooks-xsl).
# Download the docs tarball separately and
# install it after build.
if [[ ${v%.*} -ge 17 ]]; then
PG_DOCS_TARBALL="postgresql-$v-docs.tar.gz"

pgenv_debug "Downloading docs tarball"

if [ ! -f $PG_DOCS_TARBALL ]; then
$PGENV_CURL -fLO ${PGENV_DOWNLOAD_ROOT}/v$v/${PG_DOCS_TARBALL}
fi
fi
fi

# warn if no configuration was loaded
Expand Down Expand Up @@ -1403,8 +1417,20 @@ EOF
(cd $PGENV_LOCAL_POSTGRESQL_REPO &&
git archive --format=tar $tag) | tar xp -C postgresql-$v
else
pgenv_debug "Unpacking tarball"

# Unpack the source.
$PGENV_TAR $TAR_OPTS $PG_TARBALL

# In order to prevent build failures due to missing
# dependency for docs since 17.x and above, extracted
# docs will be placed into the source directory,
# as if they were built.
if [[ ${v%.*} -ge 17 ]]; then
pgenv_debug "Unpacking docs tarball"

$PGENV_TAR zxf $PG_DOCS_TARBALL
fi
fi

cd postgresql-$v
Expand All @@ -1424,6 +1450,14 @@ EOF
cd contrib
$PGENV_MAKE "${PGENV_MAKE_OPTIONS[@]}"
$PGENV_MAKE install
elif [[ ${v%.*} -ge 17 ]]; then
# Starting from 17.x docs target might fail
# due to a missing dependency (docbooks-xsl).
# Build world without docs, then copy prebuilt
# docs from tarball separately.
$PGENV_MAKE world-bin "${PGENV_MAKE_OPTIONS[@]}"
$PGENV_MAKE install-world-bin
cp -R doc/src/sgml/html $PGENV_ROOT/pgsql-$v/share/doc
else
# Yay, make world!
$PGENV_MAKE world "${PGENV_MAKE_OPTIONS[@]}"
Expand Down

0 comments on commit d97b050

Please sign in to comment.