[arch-commits] Commit in llpp/trunk (Makefile PKGBUILD)

Eli Schwartz eschwartz at archlinux.org
Mon May 14 14:05:26 UTC 2018


    Date: Monday, May 14, 2018 @ 14:05:25
  Author: eschwartz
Revision: 322137

More idiomatic Makefile

- Use LDLIBS instead of appending -lfoo to LDFLAGS
- Use pkg-config where available, to more reliably determine how to link these
  libs
- Pass LDFLAGS to ocamlopt via -ccopt instead of -cclib, since they are
  options, not libs
- Quote $(DESTDIR) as it may contain spaces; Makefiles are no different in this
  regard from shellscripts
- Drop -lcrypto, this was inherited from mupdf which does not provide a
  pkg-config file, and also does not directly link libcrypto since 1.13.0

Modified:
  llpp/trunk/Makefile
  llpp/trunk/PKGBUILD

----------+
 Makefile |   27 ++++++++++++---------------
 PKGBUILD |    2 +-
 2 files changed, 13 insertions(+), 16 deletions(-)

Modified: Makefile
===================================================================
--- Makefile	2018-05-14 12:39:12 UTC (rev 322136)
+++ Makefile	2018-05-14 14:05:25 UTC (rev 322137)
@@ -1,6 +1,6 @@
 VERSION = $(shell test -d .git && git describe --tags --dirty 2>/dev/null)
 ifeq "$(VERSION)" ""
-VERSION = 26b
+VERSION = 27
 endif
 
 # paths
@@ -7,13 +7,10 @@
 PREFIX ?= /usr/local
 
 # includes and libs
-INCS = -I/usr/include -I/usr/include/freetype2 -include ft2build.h
-LIBS = -L/usr/lib -lX11 -lpthread -lmupdf -lmupdfthird -ljbig2dec -lcrypto \
-       -lz -lopenjp2 -ljpeg -lfreetype -lharfbuzz
-
+PKGCONF_DEPS := freetype2 harfbuzz libopenjp2 libjpeg x11 zlib
 CPPFLAGS += -D_GNU_SOURCE -DFFP
-CFLAGS += -g -std=c99 -pedantic -Wall -Wextra -Wshadow $(INCS) $(CPPFLAGS)
-LDFLAGS += -g $(LIBS)
+CFLAGS += -g -std=c99 -pedantic -Wall -Wextra -Wshadow $(shell pkg-config --cflags $(PKGCONF_DEPS))
+LDLIBS = -lpthread -lmupdf -lmupdfthird -ljbig2dec $(shell pkg-config --libs $(PKGCONF_DEPS))
 
 # ocaml
 CAMLOPT = ocamlopt
@@ -34,7 +31,7 @@
 all: llpp $(MANS)
 
 llpp: $(OBJ) link.o
-	$(CAMLOPT) -o $@ $(CAMLFLAGS) link.o -cclib '$(LDFLAGS)' $(MOD) $(OBJ)
+	$(CAMLOPT) -o $@ $(CAMLFLAGS) link.o -ccopt '$(LDFLAGS)' -cclib '$(LDLIBS)' $(MOD) $(OBJ)
 
 main.cmx: main.ml utils.cmx config.cmx
 	$(CAMLOPT) -c -o $@ $(CAMLFLAGS) -thread $^
@@ -55,7 +52,7 @@
 .SUFFIXES: .ml .mli .cmo .cmi .cmx .mll .mly
 
 .c.o:
-	$(CAMLOPT) -c -o $@ $(CAMLFLAGS) -cc $(CC) -ccopt '$(CFLAGS)' $<
+	$(CAMLOPT) -c -o $@ $(CAMLFLAGS) -cc $(CC) -ccopt '$(CFLAGS) $(CPPFLAGS)' $<
 
 .ml.cmx:
 	$(CAMLOPT) -c -o $@ $(CAMLFLAGS) $<
@@ -78,9 +75,9 @@
 	rm -rf llpp-$(VERSION)
 
 install:
-	install -Dm755 llpp $(DESTDIR)$(PREFIX)/bin/llpp
-	install -Dm644 -t $(DESTDIR)$(PREFIX)/share/man/man1  man/*.1
-	install -Dm755 misc/llppac $(DESTDIR)$(PREFIX)/bin/llppac
-	install -Dm755 misc/llpphtml $(DESTDIR)$(PREFIX)/bin/llpphtml
-	install -Dm644 misc/llpp.desktop $(DESTDIR)$(PREFIX)/share/applications/llpp.desktop
-	install -Dm644 README $(DESTDIR)$(PREFIX)/share/licenses/llpp/README
+	install -Dm755 llpp "$(DESTDIR)"$(PREFIX)/bin/llpp
+	install -Dm644 -t "$(DESTDIR)"$(PREFIX)/share/man/man1  man/*.1
+	install -Dm755 misc/llppac "$(DESTDIR)"$(PREFIX)/bin/llppac
+	install -Dm755 misc/llpphtml "$(DESTDIR)"$(PREFIX)/bin/llpphtml
+	install -Dm644 misc/llpp.desktop "$(DESTDIR)"$(PREFIX)/share/applications/llpp.desktop
+	install -Dm644 README "$(DESTDIR)"$(PREFIX)/share/licenses/llpp/README

Modified: PKGBUILD
===================================================================
--- PKGBUILD	2018-05-14 12:39:12 UTC (rev 322136)
+++ PKGBUILD	2018-05-14 14:05:25 UTC (rev 322137)
@@ -37,7 +37,7 @@
         'Makefile')
 sha256sums=('SKIP'
             '29a9550c6502c9de7db14f2f61edc6b77c7ebee9f1de8b865d4e1b219b9ae377'
-            '5df7ac01f1de94d42f591a3146209c0263d610c852cfa95d7b3a8d8a7bcc5c7e')
+            '3fcff947ec89a8e0828a1f1ad3d1e18b41224683bb71f732cebc68cdf30ef1de')
 
 pkgver() {
     cd "${srcdir}"/${pkgname}



More information about the arch-commits mailing list