pkg-cmake.mk: build shared library when !BR2_PREFER_STATIC_LIB
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
@@ -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
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
@@ -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
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
@@ -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
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
@@ -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
PATCH v2 5/5 fs/common.mk: add host-mkpasswd if PACKAGES_USERS is not empty
In reply to Samuel MartinWhen 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
@@ -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
PATCH v2 1/5 pkg-cmake.mk: build shared library when !BR2_PREFER_STATIC_LIB
In reply to Samuel MartinQuoted 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 callingadd_library(target [SHARED|STATIC] ...)
- or globally, when you configure the build, by setting theBUILD_SHARED_LIBSCMake 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 (likeBUILD_SHARED_LIBSdefault is OFF).So, we can consider the setting
BUILD_SHARED_LIBSacts 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_LIBSin the package *.mk files.Signed-off-by Samuel Martin <[email protected]>
Committed series, thanks.
Signature · 1 line
Bye, Peter Korsgaard