ncftp: bump version to 3.2.6
[buildroot-gz.git] / package / lm-sensors / 0001-static-build.patch
blob63edd44f844cdf577e625744bb989b08948633f9
1 Add support for static only build
3 This patch adds support for a BUILD_SHARED_LIB variable that allows to
4 enable/disable the build of the shared library, in order to support
5 static-only builds.
7 Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
9 Index: b/Makefile
10 ===================================================================
11 --- a/Makefile
12 +++ b/Makefile
13 @@ -85,6 +85,9 @@
14 # Build and install static library
15 BUILD_STATIC_LIB := 1
17 +# Build and install shared library
18 +BUILD_SHARED_LIB := 1
20 # Set these to add preprocessor or compiler flags, or use
21 # environment variables
22 # CFLAGS :=
23 Index: b/lib/Module.mk
24 ===================================================================
25 --- a/lib/Module.mk
26 +++ b/lib/Module.mk
27 @@ -43,8 +43,14 @@
28 LIBSTLIBNAME := libsensors.a
29 LIBSHSONAME := libsensors.so.$(LIBMAINVER)
31 +ifeq ($(BUILD_SHARED_LIB),1)
32 LIBTARGETS := $(MODULE_DIR)/$(LIBSHLIBNAME) \
33 $(MODULE_DIR)/$(LIBSHSONAME) $(MODULE_DIR)/$(LIBSHBASENAME)
34 +LIBDEP_FOR_PROGS := $(LIBSHBASENAME)
35 +else
36 +LIBDEP_FOR_PROGS := $(LIBSTLIBNAME)
37 +endif
39 ifeq ($(BUILD_STATIC_LIB),1)
40 LIBTARGETS += $(MODULE_DIR)/$(LIBSTLIBNAME)
41 endif
42 @@ -131,9 +137,11 @@
43 ifeq ($(BUILD_STATIC_LIB),1)
44 $(INSTALL) -m 644 $(LIB_DIR)/$(LIBSTLIBNAME) $(DESTDIR)$(LIBDIR)
45 endif
46 +ifeq ($(BUILD_SHARED_LIB),1)
47 $(INSTALL) -m 755 $(LIB_DIR)/$(LIBSHLIBNAME) $(DESTDIR)$(LIBDIR)
48 $(LN) $(LIBSHLIBNAME) $(DESTDIR)$(LIBDIR)/$(LIBSHSONAME)
49 $(LN) $(LIBSHSONAME) $(DESTDIR)$(LIBDIR)/$(LIBSHBASENAME)
50 +endif
51 @if [ -z "$(DESTDIR)" -a "$(LIBDIR)" != "/usr/lib" -a "$(LIBDIR)" != "/lib" ] ; then \
52 if [ -e "/usr/lib/$(LIBSHSONAME)" -o -e "/usr/lib/$(LIBSHBASENAME)" ] ; then \
53 echo '******************************************************************************' ; \
54 Index: b/prog/sensord/Module.mk
55 ===================================================================
56 --- a/prog/sensord/Module.mk
57 +++ b/prog/sensord/Module.mk
58 @@ -41,7 +41,7 @@
59 REMOVESENSORDBIN := $(patsubst $(MODULE_DIR)/%,$(DESTDIR)$(SBINDIR)/%,$(PROGSENSORDTARGETS))
60 REMOVESENSORDMAN := $(patsubst $(MODULE_DIR)/%,$(DESTDIR)$(PROGSENSORDMAN8DIR)/%,$(PROGSENSORDMAN8FILES))
62 -$(PROGSENSORDTARGETS): $(PROGSENSORDSOURCES:.c=.ro) lib/$(LIBSHBASENAME)
63 +$(PROGSENSORDTARGETS): $(PROGSENSORDSOURCES:.c=.ro) lib/$(LIBDEP_FOR_PROGS)
64 $(CC) $(EXLDFLAGS) -o $@ $(PROGSENSORDSOURCES:.c=.ro) -Llib -lsensors -lrrd
66 all-prog-sensord: $(PROGSENSORDTARGETS)
67 Index: b/prog/sensors/Module.mk
68 ===================================================================
69 --- a/prog/sensors/Module.mk
70 +++ b/prog/sensors/Module.mk
71 @@ -39,8 +39,8 @@
73 LIBICONV := $(shell if /sbin/ldconfig -p | grep -q '/libiconv\.so$$' ; then echo \-liconv; else echo; fi)
75 -$(PROGSENSORSTARGETS): $(PROGSENSORSSOURCES:.c=.ro) lib/$(LIBSHBASENAME)
76 - $(CC) $(EXLDFLAGS) -o $@ $(PROGSENSORSSOURCES:.c=.ro) $(LIBICONV) -Llib -lsensors
77 +$(PROGSENSORSTARGETS): $(PROGSENSORSSOURCES:.c=.ro) lib/$(LIBDEP_FOR_PROGS)
78 + $(CC) $(EXLDFLAGS) -o $@ $(PROGSENSORSSOURCES:.c=.ro) $(LIBICONV) -Llib -lsensors -lm
80 all-prog-sensors: $(PROGSENSORSTARGETS)
81 user :: all-prog-sensors