Skip to content

Add uninstall target to Makefile#327

Merged
stevengj merged 5 commits into
JuliaStrings:masterfrom
0x09:uninstall-make-target
May 15, 2026
Merged

Add uninstall target to Makefile#327
stevengj merged 5 commits into
JuliaStrings:masterfrom
0x09:uninstall-make-target

Conversation

@0x09
Copy link
Copy Markdown
Contributor

@0x09 0x09 commented Jan 25, 2026

Hi, thanks for the awesome library.

This adds a make uninstall target that can be used to uninstall the libraries, utf8proc header, and pkg-config file.

An uninstall target would be useful for hfsfuse which bundles utf8proc as a subtree and offers the ability to uninstall bundled libraries in its own Makefile.

`make uninstall` can be used to uninstall the libraries, utf8proc
header, and pkg-config file.
@stevengj
Copy link
Copy Markdown
Member

stevengj commented Jan 26, 2026

Thanks! It would be good to add a test for this — i.e. do a make install into a temporary directory, then make uninstall, and check that it is empty (except for empty subdirs like lib and include).

@0x09
Copy link
Copy Markdown
Contributor Author

0x09 commented Jan 26, 2026

Sure, let me know if something like this is what you had in mind, if so I'll add it to the tests dir and to make check.

#!/usr/bin/env bash

install_dir=$(mktemp -d)

if ! make install DESTDIR="$install_dir" ||
   [ ! -f "$install_dir/usr/local/include/utf8proc.h" ] ||
   [ ! -f "$install_dir/usr/local/lib/libutf8proc.a" ] ||
   [ ! -f "$install_dir/usr/local/lib/pkgconfig/libutf8proc.pc" ]; then
	echo "FAILED: make install" >&2
	rm -rf "$install_dir"
	exit 1
fi

if ! make uninstall DESTDIR="$install_dir" ||
   [ -n "$(find "$install_dir/usr/local/include" -type f )" ]; then
	echo "FAILED: make uninstall" >&2
	rm -rf "$install_dir"
	exit 1
fi

@stevengj
Copy link
Copy Markdown
Member

Overall that looks good. For the make install test it would be good to check against the MANIFEST file.

I would also probably just rely on #!/usr/bin/sh rather than bash.

@0x09
Copy link
Copy Markdown
Contributor Author

0x09 commented Jan 27, 2026

A minor issue with using the manifest as-is is that it doesn't take into account platform differences in the shared library name, so make check fails on macOS.
What we could do is have the test/install_uninstall target depend on the manifest target, and then reference Manifest.new in the test. This requires FIND be set to gfind on macOS due to the find syntax used when building the new manifest.
Since the Makefile already does platform detection for the shared library name and requires GNU find, it seems reasonable to just set FIND to this conditionally in the Makefile as well.

This seems like a reasonable solution to me so I'll push a new commit with these changes, but let me know if you know of a better way to do this.

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.
@0x09
Copy link
Copy Markdown
Contributor Author

0x09 commented Jan 27, 2026

The branch has been updated with the above changes.

Comment thread Makefile Outdated
0x09 added 3 commits January 28, 2026 17:17
This was based on the contents of the generated MANIFEST, but this
is generated by running `make install` itself, so this test was
circuitous.
@0x09
Copy link
Copy Markdown
Contributor Author

0x09 commented Feb 6, 2026

@stevengj let me know if there's anything else to do here.

@stevengj stevengj merged commit 26dbf59 into JuliaStrings:master May 15, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants