summaryrefslogtreecommitdiff
path: root/media-sound/sox/files/sox-14.6.0.2-fix-symlinks.patch
blob: 8c39e488caa9ea5504232de3914b55ef1740edef (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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
https://codeberg.org/sox_ng/sox_ng/pulls/528
https://codeberg.org/sox_ng/sox_ng/commit/9418f8acd129880d0787b4a4e1ff6f4f884c145d
https://codeberg.org/sox_ng/sox_ng/commit/02d5fb9c7e98e0d729938882e1a16066c2ff5f21

From 3d9731e5aa7ca492c626e4e3740bb9f8216042b4 Mon Sep 17 00:00:00 2001
From: Alfred Wingate <parona@protonmail.com>
Date: Thu, 24 Jul 2025 03:37:04 +0300
Subject: [PATCH 1/2] Fix symlink creation with unlucky ordering in destdir
 installs

Headers and pkgconfig files are both data files so they would be
appropriate for install-data-hook. In addition the pkgconfig file is
handled in the root Makefile.am, so it belongs there.

Potentially the install hooks could be executed first in src/Makefile.am
before the normal install is handled from the root Makefile.am.

Noticed due to:

/bin/sh: line 20: cd: /var/tmp/portage/media-sound/sox-14.6.0.2/image/usr/lib64/pkgconfig: No such file or directo

Leading to the installation of: /usr/lib64/sox.pc -> sox_ng.pc
--- a/Makefile.am
+++ b/Makefile.am
@@ -153,6 +153,10 @@ install-data-hook:
 			cd $(DESTDIR)$(mandir)/man1 && $(RM) soxi.1 && \
 			    $(LN_S) soxi_ng.1 soxi.1; \
 		fi; \
+		if test "$(pkgconfigdir)"; then \
+			cd $(DESTDIR)$(pkgconfigdir); \
+			$(RM) "sox.pc"; $(LN_S) sox_ng.pc sox.pc; \
+		fi; \
 	fi
 
 uninstall-hook:
@@ -173,6 +177,10 @@ uninstall-hook:
 		if test "$(SYMLINKS)" = "yes"; then \
 			$(RM) $(DESTDIR)$(mandir)/man1/soxi.1; \
 		fi; \
+		if test "$(pkgconfigdir)"; then \
+			cd $(DESTDIR)$(pkgconfigdir); \
+			$(RM) "sox.pc"; \
+		fi; \
 	fi
 
 # Automatically update libtool script if it gets out-of-date
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -200,16 +200,16 @@ install-exec-hook:
 			$(RM) soxi$(EXEEXT); \
 			$(LN_S) soxi_ng$(EXEEXT) soxi$(EXEEXT); \
 		fi; \
-		cd $(DESTDIR)$(includedir); \
-		$(RM) sox.h; $(LN_S) sox_ng.h sox.h; \
 		cd $(DESTDIR)$(libdir); \
 		$(RM) libsox.a; $(LN_S) libsox_ng.a libsox.a; \
 		$(RM) libsox.la; $(LN_S) libsox_ng.la libsox.la; \
 		$(RM) libsox.so; $(LN_S) libsox_ng.so libsox.so; \
-		if test "$(pkgconfigdir)"; then \
-			cd $(DESTDIR)$(pkgconfigdir); \
-			$(RM) "sox.pc"; $(LN_S) sox_ng.pc sox.pc; \
-		fi; \
+	fi
+
+install-data-hook:
+	@if test "$(REPLACE)" = "yes"; then \
+		cd $(DESTDIR)$(includedir); \
+		$(RM) sox.h; $(LN_S) sox_ng.h sox.h; \
 	fi
 
 uninstall-hook:
@@ -231,10 +231,6 @@ uninstall-hook:
 		cd $(DESTDIR)$(includedir); $(RM) sox.h;\
 		cd $(DESTDIR)$(libdir); \
 		$(RM) libsox.a libsox.la libsox.so; \
-		if test "$pkgconfigdir"; then \
-			cd $(DESTDIR)$(pkfconfigdir); \
-			$(RM) "sox.pc";\
-		fi; \
 	fi
 
 clean-local:
-- 
2.50.1

From 41c1a4818808d9936d1ec704d176f94c601f9ebc Mon Sep 17 00:00:00 2001
From: Alfred Wingate <parona@protonmail.com>
Date: Thu, 24 Jul 2025 03:59:13 +0300
Subject: [PATCH 2/2] Create symlinks for libraries only if the library exists

Otherwise the symlinks will be created unconditionally even static
libraries were disabled with --disable-static.
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -201,9 +201,15 @@ install-exec-hook:
 			$(LN_S) soxi_ng$(EXEEXT) soxi$(EXEEXT); \
 		fi; \
 		cd $(DESTDIR)$(libdir); \
-		$(RM) libsox.a; $(LN_S) libsox_ng.a libsox.a; \
-		$(RM) libsox.la; $(LN_S) libsox_ng.la libsox.la; \
-		$(RM) libsox.so; $(LN_S) libsox_ng.so libsox.so; \
+		if test -f libsox_ng.a; then \
+			$(RM) libsox.a; $(LN_S) libsox_ng.a libsox.a; \
+		fi; \
+		if test -f libsox_ng.la; then \
+			$(RM) libsox.la; $(LN_S) libsox_ng.la libsox.la; \
+		fi; \
+		if test -f libsox_ng.so; then \
+			$(RM) libsox.so; $(LN_S) libsox_ng.so libsox.so; \
+		fi; \
 	fi
 
 install-data-hook:
-- 
2.50.1