summaryrefslogtreecommitdiff
path: root/archivers/lz4/patches/patch-Makefile
blob: cc3b2b71e948629b0955e8af3c3d208b334df67d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
$NetBSD: patch-Makefile,v 1.1 2014/08/06 10:41:34 fhajny Exp $

Make portable, use pkgsrc install scripts.
--- Makefile.orig	2014-07-24 11:54:05.000000000 +0000
+++ Makefile
@@ -33,13 +33,13 @@
 # Version numbers
 VERSION=120
 export RELEASE=r$(VERSION)
-LIBVER_MAJOR=`sed -n '/LZ4_VERSION_MAJOR/s/.*\s\+\([0-9]\+\).*/\1/p' < lz4.h`
-LIBVER_MINOR=`sed -n '/LZ4_VERSION_MINOR/s/.*\s\+\([0-9]\+\).*/\1/p' < lz4.h`
-LIBVER_PATCH=`sed -n '/LZ4_VERSION_RELEASE/s/.*\s\+\([0-9]\+\).*/\1/p' < lz4.h`
+LIBVER_MAJOR=`awk '$$2=="LZ4_VERSION_MAJOR" {print $$3}' < lz4.h`
+LIBVER_MINOR=`awk '$$2=="LZ4_VERSION_MINOR" {print $$3}' < lz4.h`
+LIBVER_PATCH=`awk '$$2=="LZ4_VERSION_RELEASE" {print $$3}' < lz4.h`
 LIBVER=$(LIBVER_MAJOR).$(LIBVER_MINOR).$(LIBVER_PATCH)
 
 DESTDIR=
-PREFIX = /usr
+PREFIX?= /usr
 CC    := $(CC)
 CFLAGS?= -O3
 CFLAGS+= -I. -std=c99 -Wall -Wextra -Wundef -Wshadow -Wstrict-prototypes -DLZ4_VERSION=\"$(RELEASE)\"
@@ -111,24 +111,22 @@ clean:
 #------------------------------------------------------------------------
 #make install option is designed for Linux & OSX targets only
 
-ifneq (,$(filter $(shell uname),Linux Darwin))
-
 liblz4.pc: liblz4.pc.in Makefile
-	sed -e 's|@PREFIX@|$(PREFIX)|' \
-            -e 's|@LIBDIR@|$(LIBDIR)|' \
-            -e 's|@INCLUDEDIR@|$(INCLUDEDIR)|' \
-            -e 's|@VERSION@|$(VERSION)|' \
+	sed -e 's|@PREFIX@|$(PREFIX)|g' \
+            -e 's|@LIBDIR@|$(LIBDIR)|g' \
+            -e 's|@INCLUDEDIR@|$(INCLUDEDIR)|g' \
+            -e 's|@VERSION@|$(VERSION)|g' \
              $< >$@
 
 install: liblz4 liblz4.pc
-	@install -d -m 755 $(DESTDIR)$(LIBDIR)/pkgconfig/ $(DESTDIR)$(INCLUDEDIR)/
-	@install -m 755 liblz4.$(SHARED_EXT_VER) $(DESTDIR)$(LIBDIR)/liblz4.$(SHARED_EXT_VER)
-	@cp -a liblz4.$(SHARED_EXT_MAJOR) $(DESTDIR)$(LIBDIR)
-	@cp -a liblz4.$(SHARED_EXT) $(DESTDIR)$(LIBDIR)
-	@cp -a liblz4.pc $(DESTDIR)$(LIBDIR)/pkgconfig/
-	@install -m 644 liblz4.a $(DESTDIR)$(LIBDIR)/liblz4.a
-	@install -m 644 lz4.h $(DESTDIR)$(INCLUDEDIR)/lz4.h
-	@install -m 644 lz4hc.h $(DESTDIR)$(INCLUDEDIR)/lz4hc.h
+	$(BSD_INSTALL_DATA_DIR) -d -m 755 $(DESTDIR)$(LIBDIR)/pkgconfig/ $(DESTDIR)$(INCLUDEDIR)/
+	$(BSD_INSTALL_LIB) -m 755 liblz4.$(SHARED_EXT_VER) $(DESTDIR)$(LIBDIR)/liblz4.$(SHARED_EXT_VER)
+	@ln -sf liblz4.$(SHARED_EXT_VER) $(DESTDIR)$(LIBDIR)/liblz4.$(SHARED_EXT_MAJOR)
+	@ln -sf liblz4.$(SHARED_EXT_VER) $(DESTDIR)$(LIBDIR)/liblz4.$(SHARED_EXT)
+	$(BSD_INSTALL_DATA) liblz4.pc $(DESTDIR)$(LIBDIR)/pkgconfig/
+	$(BSD_INSTALL_LIB) -m 644 liblz4.a $(DESTDIR)$(LIBDIR)/liblz4.a
+	$(BSD_INSTALL_DATA) -m 644 lz4.h $(DESTDIR)$(INCLUDEDIR)/lz4.h
+	$(BSD_INSTALL_DATA) -m 644 lz4hc.h $(DESTDIR)$(INCLUDEDIR)/lz4hc.h
 	@echo lz4 static and shared library installed
 	@cd $(PRGDIR); $(MAKE) -e install
 
@@ -165,4 +163,3 @@ test:
 test-travis: lz4programs
 	@cd $(PRGDIR); $(MAKE) -e $@
 
-endif