From 709f728196d9f9bd35bf6fc15097a530f0700b5f Mon Sep 17 00:00:00 2001 From: tab Date: Sun, 25 Jan 2026 12:54:06 -0500 Subject: [PATCH 1/4] Add uninstall target to Makefile `make uninstall` can be used to uninstall the libraries, utf8proc header, and pkg-config file. --- Makefile | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Makefile b/Makefile index 6f51c16..5d94b48 100644 --- a/Makefile +++ b/Makefile @@ -118,6 +118,15 @@ ifneq ($(OS),Darwin) ln -f -s libutf8proc.$(SHLIB_VERS_EXT) $(DESTDIR)$(libdir)/libutf8proc.so.$(MAJOR) endif +uninstall: + $(RM) $(DESTDIR)$(includedir)/utf8proc.h + $(RM) $(DESTDIR)$(libdir)/libutf8proc.a + $(RM) $(DESTDIR)$(libdir)/libutf8proc.$(SHLIB_VERS_EXT) $(DESTDIR)$(libdir)/libutf8proc.$(SHLIB_EXT) + $(RM) $(DESTDIR)$(pkgconfigdir)/libutf8proc.pc +ifneq ($(OS),Darwin) + $(RM) $(DESTDIR)$(libdir)/libutf8proc.so.$(MAJOR) +endif + MANIFEST.new: rm -rf tmp $(MAKE) install prefix=/usr DESTDIR=$(PWD)/tmp From 03e79fe49f4e293bffbc16d064fd9ea833ac87fd Mon Sep 17 00:00:00 2001 From: tab Date: Tue, 27 Jan 2026 10:33:08 -0500 Subject: [PATCH 2/4] Add script to test install/uninstal make targets Adds a script which validates the install and ensures that uninstall removes all installed files based on the generated manifest file. This is called as part of `make check`. On macOS, generating the manifest requires use of GNU find, so this is now set conditionally in the Makefile. --- Makefile | 8 ++++++-- test/install_uninstall.sh | 40 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 46 insertions(+), 2 deletions(-) create mode 100755 test/install_uninstall.sh diff --git a/Makefile b/Makefile index 5d94b48..49059da 100644 --- a/Makefile +++ b/Makefile @@ -31,6 +31,7 @@ VERSION=2.11.3 OS := $(shell uname) ifeq ($(OS),Darwin) # MacOS X + FIND=gfind SHLIB_EXT = dylib SHLIB_VERS_EXT = $(MAJOR).dylib else # GNU/Linux, at least (Windows should probably use cmake) @@ -49,7 +50,7 @@ pkgincludedir=$(includedir:$(prefix)/%=%) # meta targets -.PHONY: all clean data update manifest install +.PHONY: all clean data update manifest install test_install_uninstall all: libutf8proc.a libutf8proc.$(SHLIB_EXT) @@ -183,6 +184,9 @@ test/misc: test/misc.c test/tests.o utf8proc.o utf8proc.h test/tests.h test/maxdecomposition: test/maxdecomposition.c test/tests.o utf8proc.o utf8proc.h test/tests.h $(CC) $(UCFLAGS) $(LDFLAGS) -DUNICODE_VERSION='"'`$(PERL) -ne "/^UNICODE_VERSION=/ and print $$';" data/Makefile`'"' test/maxdecomposition.c test/tests.o utf8proc.o -o $@ +test_install_uninstall: manifest + ./test/install_uninstall.sh + # make release tarball from master branch dist: git archive master --prefix=utf8proc-$(VERSION)/ -o utf8proc-$(VERSION).tar.gz @@ -198,7 +202,7 @@ distcheck: dist make -C utf8proc-$(VERSION) check rm -rf utf8proc-$(VERSION) -check: test/normtest data/NormalizationTest.txt data/Lowercase.txt data/Uppercase.txt test/graphemetest data/GraphemeBreakTest.txt test/printproperty test/case test/iscase test/custom test/charwidth test/misc test/maxdecomposition test/valid test/iterate bench/bench.c bench/util.c bench/util.h utf8proc.o +check: test/normtest data/NormalizationTest.txt data/Lowercase.txt data/Uppercase.txt test/graphemetest data/GraphemeBreakTest.txt test/printproperty test/case test/iscase test/custom test/charwidth test/misc test/maxdecomposition test/valid test/iterate bench/bench.c bench/util.c bench/util.h utf8proc.o test_install_uninstall $(MAKE) -C bench test/normtest data/NormalizationTest.txt test/graphemetest data/GraphemeBreakTest.txt diff --git a/test/install_uninstall.sh b/test/install_uninstall.sh new file mode 100755 index 0000000..b383f98 --- /dev/null +++ b/test/install_uninstall.sh @@ -0,0 +1,40 @@ +#!/bin/sh + +install_dir=`mktemp -d` +if [ -z "$install_dir" ]; then + echo "install_uninstall error: could not create temporary directory" >&2 + exit 1 +fi + +# test installation +if ! make install DESTDIR="$install_dir" prefix=""; then + echo "FAILED: make install" >&2 + rm -rf "$install_dir" + exit 1 +fi + +cut -d ' ' -f 1 MANIFEST.new | while read -r installed_file; do + if [ ! -e "$install_dir/$installed_file" ]; then + echo "FAILED: make install of "$installed_file"" >&2 + rm -rf "$install_dir" + exit 1 + fi +done + +# test uninstallation +if ! make uninstall DESTDIR="$install_dir" prefix=""; then + echo "FAILED: make uninstall" >&2 + rm -rf "$install_dir" + exit 1 +fi + +cut -d ' ' -f 1 MANIFEST.new | while read -r installed_file; do + [ -d "$install_dir/$installed_file" ] && continue + if [ -f "$install_dir/$installed_file" ]; then + echo "FAILED: make install of "$installed_file"" >&2 + rm -rf "$install_dir" + exit 1 + fi +done + +echo "install_uninstall tests SUCCEEDED" From 30ebb28572f9a34b7d7264f733fdb7ae0468bddb Mon Sep 17 00:00:00 2001 From: tab Date: Wed, 28 Jan 2026 17:17:34 -0500 Subject: [PATCH 3/4] Remove install test This was based on the contents of the generated MANIFEST, but this is generated by running `make install` itself, so this test was circuitous. --- test/install_uninstall.sh | 9 --------- 1 file changed, 9 deletions(-) diff --git a/test/install_uninstall.sh b/test/install_uninstall.sh index b383f98..dfbc84f 100755 --- a/test/install_uninstall.sh +++ b/test/install_uninstall.sh @@ -6,21 +6,12 @@ if [ -z "$install_dir" ]; then exit 1 fi -# test installation if ! make install DESTDIR="$install_dir" prefix=""; then echo "FAILED: make install" >&2 rm -rf "$install_dir" exit 1 fi -cut -d ' ' -f 1 MANIFEST.new | while read -r installed_file; do - if [ ! -e "$install_dir/$installed_file" ]; then - echo "FAILED: make install of "$installed_file"" >&2 - rm -rf "$install_dir" - exit 1 - fi -done - # test uninstallation if ! make uninstall DESTDIR="$install_dir" prefix=""; then echo "FAILED: make uninstall" >&2 From 5b1f98a3153af4a93c872b91d693e41d9684b588 Mon Sep 17 00:00:00 2001 From: tab Date: Wed, 28 Jan 2026 23:21:12 -0500 Subject: [PATCH 4/4] Fix error output for make uninstall test --- test/install_uninstall.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/install_uninstall.sh b/test/install_uninstall.sh index dfbc84f..80be64e 100755 --- a/test/install_uninstall.sh +++ b/test/install_uninstall.sh @@ -22,7 +22,7 @@ fi cut -d ' ' -f 1 MANIFEST.new | while read -r installed_file; do [ -d "$install_dir/$installed_file" ] && continue if [ -f "$install_dir/$installed_file" ]; then - echo "FAILED: make install of "$installed_file"" >&2 + echo "FAILED: make uninstall of "$installed_file"" >&2 rm -rf "$install_dir" exit 1 fi