summarylogtreecommitdiffstats
path: root/libxnvctrl_so.patch
blob: 724064e7ef65778c935b3556609b961b7f4c39a0 (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
--- a/src/Makefile
+++ b/src/Makefile
@@ -106,6 +106,8 @@
 XNVCTRL_DIR             ?= libXNVCtrl
 XNVCTRL_MAKEFILE        ?= Makefile
 XNVCTRL_ARCHIVE         ?= $(XNVCTRL_DIR)/libXNVCtrl.a
+XNVCTRL_SHARED          ?= $(XNVCTRL_DIR)/libXNVCtrl.so.0
+XNVCTRL_LIB             ?= $(XNVCTRL_SHARED)
 XCONFIG_PARSER_DIR      ?= XF86Config-parser
 COMMON_UTILS_DIR        ?= common-utils
 COMMON_UNIX_DIR         ?= common-unix
@@ -280,15 +282,18 @@
 	$(MKDIR) $(BINDIR)
 	$(INSTALL) $(INSTALL_BIN_ARGS) $< $(BINDIR)/$(notdir $<)
 
+$(XNVCTRL_ARCHIVE) $(XNVCTRL_SHARED):
+	$(MAKE) -C $(XNVCTRL_DIR)
+
 $(eval $(call DEBUG_INFO_RULES, $(NVIDIA_SETTINGS)))
-$(NVIDIA_SETTINGS).unstripped: $(OBJS) $(XNVCTRL_ARCHIVE)
+$(NVIDIA_SETTINGS).unstripped: $(OBJS) $(XNVCTRL_LIB)
 	$(call quiet_cmd,LINK) $(CFLAGS) $(LDFLAGS) $(BIN_LDFLAGS) \
-	    -rdynamic -o $@ $(OBJS) $(XNVCTRL_ARCHIVE) $(LIBS)
+	    -rdynamic -o $@ $(OBJS) $(XNVCTRL_LIB) $(LIBS)
 
 $(eval $(call DEBUG_INFO_RULES, $(GTK2LIB)))
 $(GTK2LIB).unstripped: $(GTK2_OBJS) $(XCP_OBJS) $(IMAGE_OBJS) $(VERSION_MK)
 	$(call quiet_cmd,LINK) -shared $(CFLAGS) $(LDFLAGS) $(BIN_LDFLAGS) \
-	    $(XNVCTRL_ARCHIVE) $(LIBS) $(GTK2_LIBS) \
+	    $(XNVCTRL_LIB) $(LIBS) $(GTK2_LIBS) \
 	    -Wl,--unresolved-symbols=ignore-all -o $@ \
 	    -Wl,-soname -Wl,$(GTK2LIB_SONAME) \
 	    $(GTK2_OBJS) $(XCP_OBJS)
@@ -297,7 +302,7 @@
 $(eval $(call DEBUG_INFO_RULES, $(GTK3LIB)))
 $(GTK3LIB).unstripped: $(GTK3_OBJS) $(XCP_OBJS) $(VERSION_MK)
 	$(call quiet_cmd,LINK) -shared $(CFLAGS) $(LDFLAGS)  $(BIN_LDFLAGS) \
-	    $(XNVCTRL_ARCHIVE) $(LIBS) $(GTK3_LIBS) \
+	    $(XNVCTRL_LIB) $(LIBS) $(GTK3_LIBS) \
 	    -Wl,--unresolved-symbols=ignore-all -o $@ \
 	    -Wl,-soname -Wl,$(GTK3LIB_SONAME) \
 	    $(GTK3_OBJS) $(XCP_OBJS)
--- a/src/libXNVCtrl/Makefile
+++ b/src/libXNVCtrl/Makefile
@@ -55,10 +55,17 @@
 .PHONY: clean
 
 all: $(LIBXNVCTRL)
+all: libXNVCtrl.so
 
 $(LIBXNVCTRL) : $(OBJS)
 	$(AR) ru $@ $(OBJS)
 
+libXNVCtrl.so: $(OBJS)
+	$(RM) $@ $@.*
+	$(CC) -shared -Wl,-soname=$@.0 -o $@.0.0.0 $(LDFLAGS) $^ -lXext -lX11
+	ln -s $@.0.0.0 $@.0
+	ln -s $@.0 $@
+
 # define the rule to build each object file
 $(foreach src,$(SRC),$(eval $(call DEFINE_OBJECT_RULE,TARGET,$(src))))
 
@@ -68,3 +75,4 @@
 clean:
 	rm -rf $(LIBXNVCTRL) *~ $(STAMP_C) \
 		$(OUTPUTDIR)/*.o $(OUTPUTDIR)/*.d
+	rm -f libXNVCtrl.so libXNVCtrl.so.*