Skip to contentSkip to conversation

pkg-cmake.mk: build shared library when !BR2_PREFER_STATIC_LIB

PATCH New Samuel Martin 2 participants 6 messages Jan 22, 2014 VFS

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/5 pkg-cmake.mk: build shared library when !BR2_PREFER_STATIC_LIB

CMake offers a couple of places where one can specify how to build a library:
- when you create the library target itself, by calling add_library(target [SHARED|STATIC] ...)
- or globally, when you configure the build, by setting the BUILD_SHARED_LIBS CMake flag.

* if the library target kind of library is specified:

    it overrides the global setting BUILD_SHARED_LIBS;
* else, if the global setting BUILD_SHARED_LIBS is set:
    it builds according to the BUILD_SHARED_LIBS flags;

* otherwise:
for linux, it will build static library (like BUILD_SHARED_LIBS default is OFF).

So, we can consider the setting BUILD_SHARED_LIBS acts a bit similarly to the autotools ones '--disable-static' and '--enable-shared'. Thus, it makes sense for Buildroot to globally drive to CMake flags in the cmake-package infrastructure.

It seems we never trigger this so far because:
- either we specified it in the *.mk file (e.g. opencv.mk);
- or it was already set per target by the projects' upstreams.

Followup patches will clean the remaining BUILD_SHARED_LIBS in the package *.mk files.

---
changes v1 -> v2:
- extend commit message.

---
 package/pkg-cmake.mk | 1 +
 1 file changed, 1 insertion(+)
package/pkg-cmake.mk +1 -0
index 463cd63..aedd1fc 100644
@@ -64,6 +64,7 @@ define $(2)_CONFIGURE_CMDS
 	$$($$(PKG)_CONF_ENV) $(HOST_DIR)/usr/bin/cmake $$($$(PKG)_SRCDIR) \
 		-DCMAKE_TOOLCHAIN_FILE="$$(HOST_DIR)/usr/share/buildroot/toolchainfile.cmake" \
 		-DCMAKE_INSTALL_PREFIX="/usr" \
+		-DBUILD_SHARED_LIBS=$(if $(BR2_PREFER_STATIC_LIB),OFF,ON) \
 		$$($$(PKG)_CONF_OPT) \
 	)
 endef
Signature · 1 line
1.8.5.3
#1 lore raw

PATCH v2 2/5 opencv: remove BUILD_SHARED_LIBS flags

This CMake flag is now handled by the cmake-package infrastructure.

---
 package/opencv/opencv.mk | 1 -
 1 file changed, 1 deletion(-)
package/opencv/opencv.mk +0 -1
index b9ed8cb..de38ae0 100644
@@ -11,7 +11,6 @@ OPENCV_INSTALL_STAGING = YES
 
 OPENCV_CONF_OPT += \
 	-DCMAKE_BUILD_TYPE=$(if $(BR2_ENABLE_DEBUG),Debug,Release)   \
-	-DBUILD_SHARED_LIBS=$(if $(BR2_PREFER_STATIC_LIB),OFF,ON)    \
 	-DBUILD_WITH_STATIC_CRT=OFF                                  \
 	-DBUILD_DOCS=$(if $(BR2_HAVE_DOCUMENTATION),ON,OFF)          \
 	-DBUILD_EXAMPLES=OFF                                         \
Signature · 1 line
1.8.5.3
#2 lore raw

PATCH v2 3/5 connman: use the *_INSTALL_INIT_SYSV infra instead of the custom hook

In reply to Samuel Martin

---
changes v1 -> v2:
- split patch: one for using _INIT_SYSV infra, the other for init systemd support (Yann)

---
 package/connman/connman.mk | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
package/connman/connman.mk +1 -2
index 64c1f0e..1979454 100644
@@ -24,11 +24,10 @@ CONNMAN_DEPENDENCIES += \
 	$(if $(BR2_PACKAGE_CONNMAN_NEARD),neard) \
 	$(if $(BR2_PACKAGE_CONNMAN_OFONO),ofono)
 
-define CONNMAN_INSTALL_INITSCRIPT
+define CONNMAN_INSTALL_INIT_SYSV
 	$(INSTALL) -m 0755 -D package/connman/S45connman $(TARGET_DIR)/etc/init.d/S45connman
 endef
 
-CONNMAN_POST_INSTALL_TARGET_HOOKS = CONNMAN_INSTALL_INITSCRIPT
 
 ifeq ($(BR2_PACKAGE_CONNMAN_CLIENT),y)
 CONNMAN_CONF_OPT += --enable-client
Signature · 1 line
1.8.5.3
#3 lore raw

PATCH v2 4/5 connman: enable systemd unit-files installation

In reply to Samuel Martin

---
changes v1 -> v2:
- split patch: one for sysvinit, the other for systemd init (Yann)
- use connman configure option to install the unit-files (LucasDM)

---
 package/connman/connman.mk | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
package/connman/connman.mk +2 -1
index 1979454..e0ae7a6 100644
@@ -18,7 +18,8 @@ CONNMAN_CONF_OPT += --localstatedir=/var \
 	$(if $(BR2_PACKAGE_CONNMAN_BLUETOOTH),--enable-bluetooth,--disable-bluetooth)	\
 	$(if $(BR2_PACKAGE_CONNMAN_LOOPBACK),--enable-loopback,--disable-loopback)	\
 	$(if $(BR2_PACKAGE_CONNMAN_NEARD),--enable-neard,--disable-neard) \
-	$(if $(BR2_PACKAGE_CONNMAN_OFONO),--enable-ofono,--disable-ofono)
+	$(if $(BR2_PACKAGE_CONNMAN_OFONO),--enable-ofono,--disable-ofono) \
+	$(if $(BR2_INIT_SYSTEMD),--with-systemdunitdir=/usr/lib/systemd/system)
 
 CONNMAN_DEPENDENCIES += \
 	$(if $(BR2_PACKAGE_CONNMAN_NEARD),neard) \
Signature · 1 line
1.8.5.3
#4 lore raw

PATCH v2 5/5 fs/common.mk: add host-mkpasswd if PACKAGES_USERS is not empty

In reply to Samuel Martin

When using a custom rootfs skeleton, the host-mkpasswd target is not automatically built, even if some packages add usersi (i.e. when PACKAGES_USERS is not empty).

In this case, the rootfs generation may fail because the mkpasswd provided by some distribution does not support all options used in the mkusers script.

This patch avoids such a trouble by automatically adding the host-mkpasswd package to the dependency list of the rootfs targets.

---
 fs/common.mk | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
fs/common.mk +2 -1
index aa9d961..9f32620 100644
@@ -37,7 +37,8 @@ USERS_TABLE = $(BUILD_DIR)/_users_table.txt
 define ROOTFS_TARGET_INTERNAL
 
 # extra deps
-ROOTFS_$(2)_DEPENDENCIES += host-fakeroot host-makedevs
+ROOTFS_$(2)_DEPENDENCIES += host-fakeroot host-makedevs \
+	$(if $(PACKAGES_USERS),host-mkpasswd)
 
 ifeq ($$(BR2_TARGET_ROOTFS_$(2)_GZIP),y)
 ROOTFS_$(2)_COMPRESS_EXT = .gz
Signature · 1 line
1.8.5.3
#5 lore raw

PATCH v2 1/5 pkg-cmake.mk: build shared library when !BR2_PREFER_STATIC_LIB

In reply to Samuel Martin
Quoted 22 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Samuel" == Samuel Martin <[email protected]> writes:

CMake offers a couple of places where one can specify how to build a library:
- when you create the library target itself, by calling add_library(target [SHARED|STATIC] ...)
- or globally, when you configure the build, by setting the BUILD_SHARED_LIBS CMake flag.

* if the library target kind of library is specified:

    it overrides the global setting BUILD_SHARED_LIBS;
* else, if the global setting BUILD_SHARED_LIBS is set:
    it builds according to the BUILD_SHARED_LIBS flags;

* otherwise:
for linux, it will build static library (like BUILD_SHARED_LIBS default is OFF).

So, we can consider the setting BUILD_SHARED_LIBS acts a bit similarly to the autotools ones '--disable-static' and '--enable-shared'. Thus, it makes sense for Buildroot to globally drive to CMake flags in the cmake-package infrastructure.

Quoted 8 lines

It seems we never trigger this so far because:
- either we specified it in the *.mk file (e.g. opencv.mk);
- or it was already set per target by the projects' upstreams.

Followup patches will clean the remaining BUILD_SHARED_LIBS in the package *.mk files.

Committed series, thanks.

Signature · 1 line
Bye, Peter Korsgaard