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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
|
Compile-fix with --as-needed.
To ensure correct output when --as-needed are in the linker flags, the order of
flags to the linker (directly or via the compiler) must explictly only include
libraries and objects AFTER all compiler flags, linker flags and linker
directory arguments.
X-Gentoo-Bug: #217644
Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
Ported-from: lvm2-2.02.48-as-needed.patch
diff -Naru --exclude '*.rej' --exclude '*.orig' LVM2.2.02.51.orig/daemons/clogd/Makefile LVM2.2.02.51/daemons/clogd/Makefile
--- LVM2.2.02.51.orig/daemons/clogd/Makefile 2009-07-28 21:14:12.000000000 +0000
+++ LVM2.2.02.51/daemons/clogd/Makefile 2009-08-27 00:09:53.215521890 +0000
@@ -45,12 +45,12 @@
else \
echo '-L/usr/lib/openais -L/usr/lib -L/lib'; \
fi)
-LDFLAGS += -lcpg -lSaCkpt -lext2fs -ldevmapper
+LIBS += -lcpg -lSaCkpt -lext2fs -ldevmapper
all: ${TARGET}
clogd: ${SOURCES}
- ${CC} ${CFLAGS} -o $@ $^ ${LDFLAGS}
+ ${CC} ${CFLAGS} ${LDFLAGS} -o $@ $^ ${LIBS}
no_clogd_kernel_headers:
echo "Unable to find clogd kernel headers"
diff -Naru --exclude '*.rej' --exclude '*.orig' LVM2.2.02.51.orig/daemons/clvmd/Makefile.in LVM2.2.02.51/daemons/clvmd/Makefile.in
--- LVM2.2.02.51.orig/daemons/clvmd/Makefile.in 2009-03-10 12:10:12.000000000 +0000
+++ LVM2.2.02.51/daemons/clvmd/Makefile.in 2009-08-27 00:06:20.642231272 +0000
@@ -101,7 +101,7 @@
install_clvmd
clvmd: $(OBJECTS) $(top_srcdir)/lib/liblvm-internal.a
- $(CC) -o clvmd $(OBJECTS) $(CFLAGS) $(LDFLAGS) \
+ $(CC) $(CFLAGS) $(LDFLAGS) -o clvmd $(OBJECTS) \
$(LVMLIBS) $(LMLIBS) $(LIBS)
.PHONY: install_clvmd
diff -Naru --exclude '*.rej' --exclude '*.orig' LVM2.2.02.51.orig/daemons/dmeventd/Makefile.in LVM2.2.02.51/daemons/dmeventd/Makefile.in
--- LVM2.2.02.51.orig/daemons/dmeventd/Makefile.in 2009-08-27 00:04:46.805552570 +0000
+++ LVM2.2.02.51/daemons/dmeventd/Makefile.in 2009-08-27 00:06:20.642231272 +0000
@@ -41,12 +41,12 @@
all: dmeventd
device-mapper: dmeventd $(LIB_STATIC)
-LDFLAGS += -ldl -ldevmapper -lpthread
-CLDFLAGS += -ldl -ldevmapper -lpthread
+LIBS += -ldl -ldevmapper -lpthread
dmeventd: $(LIB_SHARED) $(LIB_STATIC) $(VERSIONED_SHLIB) dmeventd.o
- $(CC) -o $@ dmeventd.o $(CFLAGS) $(LDFLAGS) \
- -L. -ldevmapper-event $(LIBS) -rdynamic
+ $(CC) $(CFLAGS) $(LDFLAGS) -L. \
+ -o $@ dmeventd.o \
+ -ldevmapper-event $(LIBS) -rdynamic
.PHONY: install_dynamic install_static install_include \
install_pkgconfig install_dmeventd
diff -Naru --exclude '*.rej' --exclude '*.orig' LVM2.2.02.51.orig/daemons/dmeventd/plugins/mirror/Makefile.in LVM2.2.02.51/daemons/dmeventd/plugins/mirror/Makefile.in
--- LVM2.2.02.51.orig/daemons/dmeventd/plugins/mirror/Makefile.in 2009-05-11 10:28:46.000000000 +0000
+++ LVM2.2.02.51/daemons/dmeventd/plugins/mirror/Makefile.in 2009-08-27 00:06:20.642231272 +0000
@@ -17,7 +17,8 @@
VPATH = @srcdir@
INCLUDES += -I${top_srcdir}/tools
-CLDFLAGS += -L${top_srcdir}/tools -ldevmapper @LVM2CMD_LIB@
+CLDFLAGS += -L${top_srcdir}/tools
+LIBS += -ldevmapper -lpthread @LVM2CMD_LIB@
SOURCES = dmeventd_mirror.c
diff -Naru --exclude '*.rej' --exclude '*.orig' LVM2.2.02.51.orig/daemons/dmeventd/plugins/snapshot/Makefile.in LVM2.2.02.51/daemons/dmeventd/plugins/snapshot/Makefile.in
--- LVM2.2.02.51.orig/daemons/dmeventd/plugins/snapshot/Makefile.in 2009-05-11 10:28:46.000000000 +0000
+++ LVM2.2.02.51/daemons/dmeventd/plugins/snapshot/Makefile.in 2009-08-27 00:06:20.642231272 +0000
@@ -17,7 +17,8 @@
VPATH = @srcdir@
INCLUDES += -I${top_srcdir}/tools
-CLDFLAGS += -L${top_srcdir}/tools -ldevmapper @LVM2CMD_LIB@
+CLDFLAGS += -L${top_srcdir}/tools
+LIBS += -lpthread -ldevmapper @LVM2CMD_LIB@
SOURCES = dmeventd_snapshot.c
diff -Naru --exclude '*.rej' --exclude '*.orig' LVM2.2.02.51.orig/lib/Makefile.in LVM2.2.02.51/lib/Makefile.in
--- LVM2.2.02.51.orig/lib/Makefile.in 2009-06-03 11:31:06.000000000 +0000
+++ LVM2.2.02.51/lib/Makefile.in 2009-08-27 00:06:20.642231272 +0000
@@ -137,7 +137,8 @@
endif
ifeq ("@DMEVENTD@", "yes")
- CLDFLAGS += -ldevmapper-event
+ CLDFLAGS += -L../daemons/dmeventd
+ LIBS += -ldevmapper-event
endif
LIB_NAME = liblvm-internal
diff -Naru --exclude '*.rej' --exclude '*.orig' LVM2.2.02.51.orig/make.tmpl.in LVM2.2.02.51/make.tmpl.in
--- LVM2.2.02.51.orig/make.tmpl.in 2009-07-31 11:49:53.000000000 +0000
+++ LVM2.2.02.51/make.tmpl.in 2009-08-27 00:06:20.645583990 +0000
@@ -28,7 +28,7 @@
LN_S = @LN_S@
SED = @SED@
-LIBS = @LIBS@
+LIBS += @LIBS@ $(LVMLIBS) $(LMLIBS)
DEFS += @DEFS@
CFLAGS += @CFLAGS@
CLDFLAGS += @CLDFLAGS@
@@ -208,19 +208,19 @@
ifeq ("@LIB_SUFFIX@","so")
$(LIB_SHARED): $(OBJECTS) $(LDDEPS)
$(CC) -shared -Wl,-soname,$(notdir $@).$(LIB_VERSION) \
- $(CFLAGS) $(CLDFLAGS) $(OBJECTS) $(LIBS) -o $@
+ $(CFLAGS) $(CLDFLAGS) $(LDFLAGS) $(OBJECTS) $(LIBS) -o $@
endif
ifeq ("@LIB_SUFFIX@","dylib")
$(LIB_SHARED): $(OBJECTS) $(LDDEPS)
$(CC) -dynamiclib -dylib_current_version,$(LIB_VERSION) \
- $(CFLAGS) $(CLDFLAGS) $(OBJECTS) $(LIBS) -o $@
+ $(CFLAGS) $(CLDFLAGS) $(LDFLAGS) $(OBJECTS) $(LIBS) -o $@
endif
%.so: %.a
$(CC) -shared -Wl,-soname,$(notdir $@).$(LIB_VERSION) \
- $(CFLAGS) $(CLDFLAGS) $(LIBS) -o $@ \
- @CLDWHOLEARCHIVE@ $< @CLDNOWHOLEARCHIVE@
+ $(CFLAGS) $(CLDFLAGS) $(LDFLAGS) -o $@ \
+ @CLDWHOLEARCHIVE@ $< @CLDNOWHOLEARCHIVE@ $(LIBS)
$(LIB_STATIC): $(OBJECTS)
$(RM) $@
diff -Naru --exclude '*.rej' --exclude '*.orig' LVM2.2.02.51.orig/test/api/Makefile.in LVM2.2.02.51/test/api/Makefile.in
--- LVM2.2.02.51.orig/test/api/Makefile.in 2009-07-21 13:51:05.000000000 +0000
+++ LVM2.2.02.51/test/api/Makefile.in 2009-08-27 00:07:52.285533964 +0000
@@ -38,7 +38,7 @@
OBJECTS = $(test_OBJECTS) $(vgtest_OBJECTS)
test: $(test_OBJECTS) $(DEPLIBS)
- $(CC) -o test $(test_OBJECTS) $(CFLAGS) $(LDFLAGS) $(LVMLIBS) $(LIBS)
+ $(CC) $(CFLAGS) $(LDFLAGS) -o test $(test_OBJECTS) $(LVMLIBS) $(LIBS)
vgtest: $(vgtest_OBJECTS) $(DEPLIBS)
- $(CC) -o vgtest $(vgtest_OBJECTS) $(CFLAGS) $(LDFLAGS) $(LVMLIBS) $(LIBS)
+ $(CC) $(CFLAGS) $(LDFLAGS) -o vgtest $(vgtest_OBJECTS) $(LVMLIBS) $(LIBS)
diff -Naru --exclude '*.rej' --exclude '*.orig' LVM2.2.02.51.orig/tools/Makefile.in LVM2.2.02.51/tools/Makefile.in
--- LVM2.2.02.51.orig/tools/Makefile.in 2009-05-21 11:11:29.000000000 +0000
+++ LVM2.2.02.51/tools/Makefile.in 2009-08-27 00:06:20.645583990 +0000
@@ -106,24 +106,29 @@
device-mapper: $(TARGETS_DM)
dmsetup: dmsetup.o $(top_srcdir)/libdm/libdevmapper.$(LIB_SUFFIX)
- $(CC) -o $@ dmsetup.o $(CFLAGS) $(LDFLAGS) \
- -L$(top_srcdir)/libdm -ldevmapper $(LIBS)
+ $(CC) $(CFLAGS) $(LDFLAGS) \
+ -L$(top_srcdir)/libdm \
+ -o $@ dmsetup.o \
+ -ldevmapper $(LIB_PTHREAD)
dmsetup.static: dmsetup.o $(interfacedir)/libdevmapper.a
- $(CC) -o $@ dmsetup.o $(CFLAGS) $(LDFLAGS) -static \
- -L$(interfacedir) -ldevmapper $(LIBS) \
- $(LIB_PTHREAD)
+ $(CC) $(CFLAGS) $(LDFLAGS) -static \
+ -L$(interfacedir) \
+ -o $@ dmsetup.o \
+ -ldevmapper $(LIB_PTHREAD)
all: device-mapper
lvm: $(OBJECTS) lvm.o $(top_srcdir)/lib/liblvm-internal.a
- $(CC) -o $@ $(CFLAGS) $(OBJECTS) lvm.o \
- $(LDFLAGS) $(LVMLIBS) $(LIBS) -rdynamic
+ $(CC) $(CFLAGS) $(LDFLAGS) \
+ -o $@ $(OBJECTS) lvm.o \
+ $(LVMLIBS) $(LIBS) -rdynamic
LIB_PTHREAD = @LIB_PTHREAD@
lvm.static: $(OBJECTS) lvm-static.o $(top_srcdir)/lib/liblvm-internal.a $(interfacedir)/libdevmapper.a
- $(CC) -o $@ $(CFLAGS) $(OBJECTS) lvm-static.o -static \
- -L$(interfacedir) $(LDFLAGS) $(LVMLIBS) $(LIBS) $(LIB_PTHREAD) -rdynamic
+ $(CC) $(CFLAGS) $(LDFLAGS) -static -L$(interfacedir) \
+ -o $@ $(OBJECTS) lvm-static.o \
+ $(LVMLIBS) $(LIBS) $(LIB_PTHREAD) -rdynamic
liblvm2cmd.a: $(top_srcdir)/lib/liblvm-internal.a $(OBJECTS) lvmcmdlib.o lvm2cmd.o
cat $(top_srcdir)/lib/liblvm-internal.a > $@
|