summaryrefslogtreecommitdiff
path: root/net-libs/pacparser/files/pacparser-1.4.0-build.patch
blob: 2a8898579327c6f862df195bd20dd28dc1128d26 (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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
Upstream-PR: https://github.com/manugarg/pacparser/pull/136
From 5d689be2e250242ef4022054f11bf00af339c149 Mon Sep 17 00:00:00 2001
From: orbea <orbea@riseup.net>
Date: Fri, 13 May 2022 22:34:37 -0700
Subject: [PATCH 1/2] build: Don't conflict with the user's CFLAGS

This uses the variable MAINT_CFLAGS to set the project's flags so that
the user can set CFLAGS as an environment variable or as an make
argument without any conflicts.

This can be problemtic with the build environment in some distros.
---
 src/Makefile | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/Makefile b/src/Makefile
index 87f5c1b..3642241 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -60,14 +60,14 @@ ifeq ($(OS_ARCH),Darwin)
 endif
 
 PREFIX ?= /usr
-CFLAGS = -g -DXP_UNIX -Wall -DVERSION=$(VERSION)
+MAINT_CFLAGS := -g -DXP_UNIX -Wall -DVERSION=$(VERSION)
 
 ifndef PYTHON
   PYTHON = python
 endif
 
 # Spidermonkey library.
-CFLAGS += -Ispidermonkey/js/src
+MAINT_CFLAGS += -Ispidermonkey/js/src
 
 LIBRARY_LINK = $(LIBRARY_NAME).$(SO_SUFFIX)
 PREFIX := $(DESTDIR)$(PREFIX)
@@ -87,17 +87,17 @@ spidermonkey/libjs.a: spidermonkey/js/src
 	cd spidermonkey && SMCFLAGS="$(SHFLAGS) $(SMCFLAGS)" $(MAKE) jslib
 
 pacparser.o: pacparser.c pac_utils.h pacparser.h jsapi_buildstamp
-	$(CC) $(CFLAGS) $(SHFLAGS) -c pacparser.c -o pacparser.o
+	$(CC) $(MAINT_CFLAGS) $(CFLAGS) $(SHFLAGS) -c pacparser.c -o pacparser.o
 	touch pymod/pacparser_o_buildstamp
 
 $(LIBRARY): pacparser.o spidermonkey/libjs.a
-	$(MKSHLIB) $(CFLAGS) $(LDFLAGS) $(LIB_OPTS) -o $(LIBRARY) pacparser.o spidermonkey/libjs.a -lm
+	$(MKSHLIB) $(MAINT_CFLAGS) $(CFLAGS) $(LDFLAGS) $(LIB_OPTS) -o $(LIBRARY) pacparser.o spidermonkey/libjs.a -lm
 
 $(LIBRARY_LINK): $(LIBRARY)
 	ln -sf $(LIBRARY) $(LIBRARY_LINK)
 
 pactester: pactester.c pacparser.h pacparser.o spidermonkey/libjs.a
-	$(CC) $(CFLAGS) $(LDFLAGS) pactester.c pacparser.o spidermonkey/libjs.a -o pactester -lm -L. -I.
+	$(CC) $(MAINT_CFLAGS) $(CFLAGS) $(LDFLAGS) pactester.c pacparser.o spidermonkey/libjs.a -o pactester -lm -L. -I.
 
 testpactester: pactester $(LIBRARY_LINK)
 	echo "Running tests for pactester."

From ff86f230de5dd60935e1793077eb038fcbe1e515 Mon Sep 17 00:00:00 2001
From: orbea <orbea@riseup.net>
Date: Fri, 13 May 2022 22:45:19 -0700
Subject: [PATCH 2/2] build: Add DOC_PREFIX

This can be useful for distro integration.
---
 src/Makefile | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/src/Makefile b/src/Makefile
index 3642241..af10890 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -74,6 +74,7 @@ PREFIX := $(DESTDIR)$(PREFIX)
 LIB_PREFIX = $(PREFIX)/lib
 INC_PREFIX = $(PREFIX)/include
 BIN_PREFIX = $(PREFIX)/bin
+DOC_PREFIX = $(PREFIX)/share/doc/pacparser
 MAN_PREFIX = $(PREFIX)/share/man
 
 .PHONY: clean pymod install-pymod
@@ -119,11 +120,11 @@ install: all
 	install -d $(MAN_PREFIX)/man3/
 	(test -d ../docs && install -m 644 ../docs/man/man3/*.3 $(MAN_PREFIX)/man3/) || true
 	# install html docs
-	install -d $(PREFIX)/share/doc/pacparser/html/
-	(test -d ../docs/html && install -m 644 ../docs/html/* $(PREFIX)/share/doc/pacparser/html/) || true
+	install -d $(DOC_PREFIX)/html/
+	(test -d ../docs/html && install -m 644 ../docs/html/* $(DOC_PREFIX)/html/) || true
 	# install examples
-	install -d $(PREFIX)/share/doc/pacparser/examples/
-	(test -d ../examples && install -m 644 ../examples/* $(PREFIX)/share/doc//pacparser/examples/) || true
+	install -d $(DOC_PREFIX)/examples/
+	(test -d ../examples && install -m 644 ../examples/* $(DOC_PREFIX)/examples/) || true
 
 # Targets to build python module
 pymod: pacparser.o pacparser.h spidermonkey/libjs.a