Skip to content

Commit

Permalink
Automatically detect outdated generated files
Browse files Browse the repository at this point in the history
Update documentation to reflect that automatically generated files are
committed. Detect when they are outdated if we have the ability to
regenerate them.
  • Loading branch information
jberkenbilt committed Oct 11, 2018
1 parent d1368a3 commit aa864d2
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 21 deletions.
14 changes: 4 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -97,12 +97,7 @@ $(foreach B,$(BUILD_ITEMS),$(eval \
clean_$(B): ; \
$(RM) -r $(B)/$(OUTPUT_DIR)))

AUTOFILES = configure aclocal.m4 libqpdf/qpdf/qpdf-config.h.in
autofiles.zip: $(AUTOFILES)
$(RM) autofiles.zip
zip autofiles.zip $(AUTOFILES)

DISTFILES = $(AUTOFILES) doc/qpdf-manual.html doc/qpdf-manual.pdf
DISTFILES = doc/qpdf-manual.html doc/qpdf-manual.pdf
distfiles.zip: $(DISTFILES)
$(RM) distfiles.zip
zip distfiles.zip $(DISTFILES)
Expand All @@ -116,10 +111,9 @@ distclean: clean
$(RM) libqpdf.pc libqpdf.map

maintainer-clean: distclean
$(RM) configure doc/qpdf-manual.* libqpdf/qpdf/qpdf-config.h.in
$(RM) aclocal.m4
$(RM) -r install-mingw install-msvc external-libs
$(RM) autofiles.zip distfiles.zip
$(RM) doc/qpdf-manual.*
$(RM) -r install-mingw* install-msvc* external-libs
$(RM) distfiles.zip

.PHONY: $(TEST_TARGETS)

Expand Down
14 changes: 6 additions & 8 deletions README-maintainer
Original file line number Diff line number Diff line change
Expand Up @@ -269,10 +269,10 @@ If building or editing documentation, configure with
`--enable-doc-maintenance`. This will ensure that all tools or files
required to validate and build documentation are available.

If you want to run `make maintainer-clean`, `make distclean`, or `make
autofiles.zip` and you haven't run `./configure`, you can pass
`CLEAN=1` to make on the command line to prevent it from complaining
about configure not having been run.
If you want to run `make maintainer-clean` or `make distclean` and you
haven't run `./configure`, you can pass `CLEAN=1` to make on the
command line to prevent it from complaining about configure not having
been run.

If you want to run checks without rerunning the build, pass
`NO_REBUILD=1` to make. This can be useful for special testing
Expand All @@ -283,10 +283,8 @@ LOCAL WINDOWS TESTING PROCEDURE

This is what I do for routine testing on Windows.

From Linux, run `./autogen.sh` and `make autofiles.zip CLEAN=1`.

From Windows, git clone from my Linux clone, unzip `external-libs`,
and unzip `autofiles.zip`.
From Windows, git clone from my Linux clone, and unzip
`external-libs`.

Look at `make_windows_releases`. Set up path the same way and run
whichever `./config-*` is appropriate for whichever compiler I need to
Expand Down
2 changes: 1 addition & 1 deletion README-windows.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ You can also download `qpdf-external-libs-src.zip` and follow the instructions i

# Building from version control

If you check out qpdf from version control, you will not have the files that are generated by autoconf. If you are not changing these files, you can grab them from a source distribution or create them from a system that has autoconf. To create them from scratch, run `./autogen.sh` on a system that has autoconf installed. Once you have them, you can run `make CLEAN=1 autofiles.zip`. This will create an autofiles.zip that you can extract on top of a fresh checkout.
If you check out qpdf from version control, documentation files will not be generated or installed. Documentation files are included in the source distribution, but they can only be built from Linux.

# Building with MinGW

Expand Down
2 changes: 2 additions & 0 deletions autogen.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
#!/bin/sh
set -e
aclocal -I m4
autoheader
autoconf
md5sum configure.ac m4/* >| autofiles.sums
1 change: 0 additions & 1 deletion azure-pipelines/build-linux
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ sudo apt-get update
sudo apt-get -y install \
autoconf build-essential zlib1g-dev libjpeg-dev \
docbook-xsl fop xsltproc libxml2-utils inkscape imagemagick
./autogen.sh
./configure --enable-werror --enable-doc-maintenance \
--enable-show-failed-test-output
make -j$(nproc)
Expand Down
16 changes: 16 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,22 @@ AC_CONFIG_FILES([libqpdf.pc])
AC_CONFIG_FILES([libqpdf.map])
AC_CONFIG_HEADERS([libqpdf/qpdf/qpdf-config.h])

# Check to see if automatically generated files are outdated and if we
# can update them.
AC_CHECK_PROG(AUTOCONF,autoconf,1,0)
AC_CHECK_PROG(AUTOHEADER,autoheader,1,0)
AC_CHECK_PROG(ACLOCAL,aclocal,1,0)
AC_CHECK_PROG(MD5SUM,md5sum,1,0)
if test "$AUTOCONF$AUTOHEADER$ACLOCAL$MD5SUM" = "1111"; then
if ! md5sum configure.ac m4/* | diff - autofiles.sums; then
AC_MSG_ERROR(autofiles are autodated; rerun autogen.sh)
fi
fi

if md5sum configure.ac m4/* | diff -q - autofiles.sums; then
echo "Automatically generated files are stale; rerun autogen.sh"
fi

AC_PROG_CC
AC_PROG_CC_C99
AC_PROG_CXX
Expand Down
1 change: 0 additions & 1 deletion ispell-words
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,6 @@ auth
AuthEvent
autobuilder
autoconf
autofiles
autogen
autoheader
autolabel
Expand Down

0 comments on commit aa864d2

Please sign in to comment.