summary refs log tree commit diff
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2020-12-21 16:33:08 -0500
committerJune McEnroe <june@causal.agency>2020-12-21 16:33:08 -0500
commitaf4ca61222bdc9a426f491ffd7c9ef010263abae (patch)
treec2bd3d1d66dbbbefa2e1247aea3afc8000357cfe
parentUpdate PDF URLs (diff)
downloadsrc-af4ca61222bdc9a426f491ffd7c9ef010263abae.tar.gz
src-af4ca61222bdc9a426f491ffd7c9ef010263abae.zip
Move wcfix to port/wcwidth
Diffstat (limited to '')
-rw-r--r--port/wcwidth/.gitignore3
-rw-r--r--port/wcwidth/Makefile24
-rw-r--r--[-rwxr-xr-x]port/wcwidth/wcfix.in (renamed from home/.local/bin/wcfix)2
3 files changed, 19 insertions, 10 deletions
diff --git a/port/wcwidth/.gitignore b/port/wcwidth/.gitignore
index aa25f78d..132e8098 100644
--- a/port/wcwidth/.gitignore
+++ b/port/wcwidth/.gitignore
@@ -1,2 +1,3 @@
 *.o
-*.dylib
+libwcwidth.dylib
+wcfix
diff --git a/port/wcwidth/Makefile b/port/wcwidth/Makefile
index f6932d6d..50faa653 100644
--- a/port/wcwidth/Makefile
+++ b/port/wcwidth/Makefile
@@ -1,19 +1,27 @@
-PREFIX = ~/.local
+PREFIX ?= ~/.local
 
 OBJS = wcwidth.o wcswidth.o
-DYLIB = libwcwidth.dylib
 
-${DYLIB}: ${OBJS}
+all: libwcwidth.dylib wcfix
+
+libwcwidth.dylib: ${OBJS}
 	${CC} -dynamiclib ${LDFLAGS} ${OBJS} -o $@
 
 wcwidth.o: nonspacing.h wide.h
 
+.SUFFIXES: .in
+
+.in:
+	sed 's|%%PREFIX%%|${PREFIX}|g' $< > $@
+	chmod a+x $@
+
 clean:
-	rm -f ${DYLIB} ${OBJS}
+	rm -f libwcwidth.dylib wcfix ${OBJS}
 
-install: ${DYLIB}
-	install -d ${PREFIX}/lib
-	install -m 644 ${DYLIB} ${PREFIX}/lib
+install: libwcwidth.dylib wcfix
+	install -d ${PREFIX}/lib ${PREFIX}/bin
+	install -m 644 libwcwidth.dylib ${PREFIX}/lib
+	install wcfix ${PREFIX}/bin
 
 uninstall:
-	rm -f ${PREFIX}/lib/${DYLIB}
+	rm -f ${PREFIX}/lib/libwcwidth.dylib ${PREFIX}/bin/wcfix
diff --git a/home/.local/bin/wcfix b/port/wcwidth/wcfix.in
index b31bd19b..832c83d6 100755..100644
--- a/home/.local/bin/wcfix
+++ b/port/wcwidth/wcfix.in
@@ -2,6 +2,6 @@
 set -eu
 
 export DYLD_FORCE_FLAT_NAMESPACE=1
-export DYLD_INSERT_LIBRARIES=~/.local/lib/libwcwidth.dylib
+export DYLD_INSERT_LIBRARIES=%%PREFIX%%/lib/libwcwidth.dylib
 
 exec "$@"