diff mbox

[OpenWrt-Devel] swconfig: Split libsw out of swconfig for reuse in other packages

Message ID 1436336764-17470-1-git-send-email-ardeleanalex@gmail.com
State Rejected
Headers show

Commit Message

Alexandru Ardelean July 8, 2015, 6:26 a.m. UTC
From: Helmut Schaa <hs@ocedo.com>

Also a bit of an RFC.
We use this patch internally. 

---
 package/network/config/swconfig/Makefile     | 9 +++++++++
 package/network/config/swconfig/src/Makefile | 9 ++++++---
 2 files changed, 15 insertions(+), 3 deletions(-)

Comments

Rafał Miłecki July 8, 2015, 6:31 a.m. UTC | #1
On 8 July 2015 at 08:26, Alexandru Ardelean <ardeleanalex@gmail.com> wrote:
> From: Helmut Schaa <hs@ocedo.com>
>
> Also a bit of an RFC.
> We use this patch internally.

I believe the preferred way of marking patch a RFC is:
git format-patch --subject-prefix="PATCH RFC"
(just for the future)

This patch is also missing Signed-off-by, but you may just wait for
comment as it's RFC anyway :)
Alexandru Ardelean July 8, 2015, 6:39 a.m. UTC | #2
On Wed, Jul 8, 2015 at 9:31 AM, Rafał Miłecki <zajec5@gmail.com> wrote:

> On 8 July 2015 at 08:26, Alexandru Ardelean <ardeleanalex@gmail.com>
> wrote:
> > From: Helmut Schaa <hs@ocedo.com>
> >
> > Also a bit of an RFC.
> > We use this patch internally.
>
> I believe the preferred way of marking patch a RFC is:
> git format-patch --subject-prefix="PATCH RFC"
> (just for the future)
>
> This patch is also missing Signed-off-by, but you may just wait for
> comment as it's RFC anyway :)
>

Will reply here for both patches.
I've resent them with Signed-off-by + RFC tag.
Seems that if I do not upstream patches often enough I forget the practices.

Thanks
Cristian Morales Vega July 8, 2015, 7:26 a.m. UTC | #3
On 8 July 2015 at 07:26, Alexandru Ardelean <ardeleanalex@gmail.com> wrote:
> From: Helmut Schaa <hs@ocedo.com>
>
> Also a bit of an RFC.
> We use this patch internally.

FWIW we also do it.
But we only build a static library since we use it only in one program
(it's not me, no idea of the details) and, since I guess nobody cares
about API/ABI stability, we couldn't decide on a proper soname. (i.e.
it should have been upstreamed).
diff mbox

Patch

diff --git a/package/network/config/swconfig/Makefile b/package/network/config/swconfig/Makefile
index 50d395c..5af31f7 100644
--- a/package/network/config/swconfig/Makefile
+++ b/package/network/config/swconfig/Makefile
@@ -41,9 +41,18 @@  define Build/Compile
 		LIBS="$(TARGET_LDFLAGS) -lnl-tiny -lm -luci"
 endef
 
+define Build/InstallDev
+	$(INSTALL_DIR) $(1)/usr/include
+	$(CP) $(PKG_BUILD_DIR)/swlib.h $(1)/usr/include/
+
+	$(INSTALL_DIR) $(1)/lib
+	$(CP) $(PKG_BUILD_DIR)/libsw.so $(1)/lib/
+endef
+
 define Package/swconfig/install
 	$(INSTALL_DIR) $(1)/sbin $(1)/lib/network
 	$(INSTALL_BIN) $(PKG_BUILD_DIR)/swconfig $(1)/sbin/swconfig
+	$(INSTALL_BIN) $(PKG_BUILD_DIR)/libsw.so $(1)/lib
 	$(INSTALL_DATA) ./files/switch.sh $(1)/lib/network/
 endef
 
diff --git a/package/network/config/swconfig/src/Makefile b/package/network/config/swconfig/src/Makefile
index 0d56f43..1176bf0 100644
--- a/package/network/config/swconfig/src/Makefile
+++ b/package/network/config/swconfig/src/Makefile
@@ -6,7 +6,10 @@  LIBS=-lnl -lnl-genl
 all: swconfig
 
 %.o: %.c
-	$(CC) $(CFLAGS) -c -o $@ $^
+	$(CC) $(CFLAGS) -fPIC -c -o $@ $^
 
-swconfig: cli.o swlib.o uci.o
-	$(CC) $(LDFLAGS) -o $@ $^ $(LIBS)
+libsw.so: swlib.o
+	$(CC) $(CFLAGS) -fPIC -shared -o $@ swlib.o
+
+swconfig: libsw.so cli.o uci.o
+	$(CC) $(LDFLAGS) -o $@ $^ $(LIBS) -L./ -lsw