Skip to content
Merged
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
9 changes: 6 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ jobs:
patch \
diffutils \
xmlto \
libpcre2-dev
libpcre2-dev \
gnulib

- name: Bootstrap
run: ./bootstrap
Expand Down Expand Up @@ -66,7 +67,8 @@ jobs:
perl \
patch \
diffutils \
xmlto
xmlto \
gnulib

- name: Bootstrap
run: ./bootstrap
Expand Down Expand Up @@ -96,7 +98,8 @@ jobs:
patch \
diffutils \
xmlto \
libpcre2-dev
libpcre2-dev \
gnulib

- name: Bootstrap
run: ./bootstrap
Expand Down
36 changes: 25 additions & 11 deletions Makefile.am
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
ACLOCAL_AMFLAGS = -I m4
SUBDIRS = lib

DISTCLEANFILES = src/stamp-h[0-9]* src/config.h

bin_PROGRAMS = src/interdiff src/filterdiff src/rediff
Expand All @@ -16,17 +19,16 @@ dist_bin_SCRIPTS = \
patchview/svndiff \
patchview/svndiffview

AM_CFLAGS = -I$(srcdir)/src
AM_CFLAGS = -I$(srcdir)/src -I$(top_builddir)/lib -I$(top_srcdir)/lib
src_interdiff_SOURCES = src/interdiff.c src/util.c src/util.h src/diff.c \
src/diff.h src/myerror.c
src/diff.h
src_filterdiff_SOURCES = src/filterdiff.c src/util.c src/util.h src/diff.c \
src/diff.h src/myerror.c
src_rediff_SOURCES = src/rediff.c src/util.c src/util.h src/diff.c src/diff.h \
src/myerror.c
src/diff.h
src_rediff_SOURCES = src/rediff.c src/util.c src/util.h src/diff.c src/diff.h

src_interdiff_LDADD = @LIBOBJS@
src_filterdiff_LDADD = @LIBOBJS@
src_rediff_LDADD = @LIBOBJS@
src_interdiff_LDADD = lib/libgnu.a @LIBOBJS@
src_filterdiff_LDADD = lib/libgnu.a @LIBOBJS@
src_rediff_LDADD = lib/libgnu.a @LIBOBJS@

if HAVE_XMLTO
# The man pages are generated from DocBook XML.
Expand Down Expand Up @@ -256,10 +258,22 @@ test-perms: src/combinediff$(EXEEXT) src/flipdiff$(EXEEXT) \
chmod a+x $(top_srcdir)/$$test; \
done

$(TESTS): test-perms
# Only require test-perms when actually running tests, not for distribution
check-local: test-perms
$(TESTS): | test-perms

# Ensure subdirectories are built before distribution
BUILT_SOURCES = lib-built

lib-built: lib/libgnu.a
touch lib-built

lib/libgnu.a:
$(MAKE) $(AM_MAKEFLAGS) -C lib all

distclean-local:
-rm -rf $(top_builddir)/test-arena
-rm -f lib-built

EXTRA_DIST = $(man_MANS) \
tests/common.sh tests/soak-test \
Expand All @@ -269,8 +283,8 @@ EXTRA_DIST = $(man_MANS) \
patchutils.spec \
doc/patchutils.xml \
patchview/README.patchview \
src/getopt.h \
scripts/move-to-front
scripts/move-to-front \
m4/gnulib-cache.m4

tag:
cvs tag -c `echo V@VERSION@ | tr . _`
36 changes: 35 additions & 1 deletion bootstrap
Original file line number Diff line number Diff line change
@@ -1,6 +1,17 @@
#! /bin/sh

echo "Deleting all autogenerated stuff..."
set -e

echo "Bootstrap: Setting up patchutils build environment..."

# Check if we need to update gnulib files
update_gnulib=false
if [ "$1" = "--update-gnulib" ] || [ "$1" = "-u" ]; then
update_gnulib=true
echo "Updating gnulib modules..."
fi

echo "Cleaning autogenerated files..."

rm -f *.o *.so config.sub config.guess config.cache
rm -f config.log config.h config.status config.h.in
Expand All @@ -14,6 +25,29 @@ rm -rf autom4te.cache/
rm -f INSTALL
rm -f test-driver

# Update gnulib if requested or if gnulib files seem missing/outdated
if [ "$update_gnulib" = true ] || [ ! -f "lib/Makefile.am" ] || [ ! -f "m4/gnulib-comp.m4" ]; then
echo "Updating gnulib modules..."

if command -v gnulib-tool >/dev/null 2>&1; then
echo "Using gnulib-tool..."
if gnulib-tool --update; then
echo "Gnulib modules updated."
else
echo "Error: gnulib-tool failed. Please check your gnulib installation."
exit 1
fi
else
echo "Error: gnulib-tool not found. Please install gnulib package."
exit 1
fi
fi

echo "Running autoreconf..."
autoreconf --install --verbose

echo ""
echo "Bootstrap completed successfully!"
echo "Now you may run ./configure"
echo ""
echo "Tip: Use './bootstrap --update-gnulib' to update gnulib modules"
13 changes: 6 additions & 7 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@ AC_CONFIG_SRCDIR(patchutils.spec.in)
AC_CONFIG_HEADERS(config.h)

AM_INIT_AUTOMAKE([dist-xz dist-bzip2 subdir-objects 1.6])
AC_CONFIG_MACRO_DIRS([m4])

dnl Checks for programs.
AC_PROG_CC
gl_EARLY
AM_PROG_CC_C_O
AC_PROG_CPP
AC_PROG_INSTALL
Expand Down Expand Up @@ -49,13 +51,7 @@ AC_FUNC_ALLOCA
AC_FUNC_FNMATCH
AC_CHECK_FUNCS(strcspn strspn strtoul getline error)

AC_CONFIG_LIBOBJ_DIR([src])

dnl Check for long getopt
AC_CHECK_FUNCS(getopt_long , , [
AC_LIBOBJ([getopt])
AC_LIBOBJ([getopt1])
])
dnl gnulib will handle getopt and error functions

dnl Check pcre2 availability
AC_MSG_CHECKING([whether PCRE2 support is requested])
Expand Down Expand Up @@ -106,8 +102,11 @@ AC_MSG_RESULT(yes)
AC_DEFINE_UNQUOTED(PATCH, "$PATCH", How patch(1) is called)
AC_DEFINE_UNQUOTED(DIFF, "$DIFF", How diff(1) is called)

gl_INIT

AC_CONFIG_FILES([
Makefile
lib/Makefile
scripts/splitdiff
scripts/editdiff
scripts/fixcvsdiff
Expand Down
9 changes: 9 additions & 0 deletions gnulib-update.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/bash
# Script to update gnulib modules
# Run this when you want to update to newer gnulib versions

echo "Updating gnulib modules..."
git clone --depth 1 https://git.savannah.gnu.org/git/gnulib.git /tmp/gnulib-update
/tmp/gnulib-update/gnulib-tool --update
rm -rf /tmp/gnulib-update
echo "Gnulib updated. Please test and commit."
73 changes: 73 additions & 0 deletions lib/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
/Makefile.am
/_Noreturn.h
/alloca.in.h
/arg-nonnull.h
/assert.in.h
/basename-lgpl.c
/basename-lgpl.h
/c++defs.h
/cloexec.c
/cloexec.h
/close.c
/dup2.c
/errno.in.h
/error.c
/error.in.h
/fcntl.c
/fcntl.in.h
/fd-hook.c
/fd-hook.h
/filename.h
/fstat.c
/getdtablesize.c
/getopt-cdefs.in.h
/getopt-core.h
/getopt-ext.h
/getopt-pfx-core.h
/getopt-pfx-ext.h
/getopt.c
/getopt.in.h
/getopt1.c
/getopt_int.h
/getprogname.c
/getprogname.h
/gettext.h
/idx.h
/intprops-internal.h
/intprops.h
/limits.in.h
/locale.in.h
/lstat.c
/malloca.c
/malloca.h
/msvc-inval.c
/msvc-inval.h
/msvc-nothrow.c
/msvc-nothrow.h
/open.c
/pathmax.h
/stat-time.c
/stat-time.h
/stat-w32.c
/stat-w32.h
/stat.c
/stdckdint.in.h
/stddef.in.h
/stdint.in.h
/stdio-read.c
/stdio-write.c
/stdio.in.h
/stdlib.c
/stdlib.in.h
/strerror-override.c
/strerror-override.h
/strerror.c
/string.in.h
/sys_stat.in.h
/sys_types.in.h
/time.in.h
/unistd.c
/unistd.in.h
/verify.h
/warn-on-use.h
/xalloc-oversized.h
Loading