Skip to contentSkip to conversation

mdadm: convert to generic-package

PATCH New Thomas Petazzoni 2 participants 6 messages Oct 14, 2018 – Oct 15, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/3 mdadm: convert to generic-package

There is absolutely no reason for mdadm.mk to use autotools-package:
this package does not have any configure script at all, and its Makefile is not generated using automake.

Therefore, convert it to use the generic-package infrastructure. Compared to the previous code, we are now using $(TARGET_CONFIGURE_OPTS), which passes our CPPFLAGS. This overrides the CPPFLAGS from mdadm's Makefile, so we repeat the only CPPFLAGS flag passed in the Makefile, -DBINDIR.

---
 package/mdadm/mdadm.mk | 21 +++++++++++++--------
 1 file changed, 13 insertions(+), 8 deletions(-)
package/mdadm/mdadm.mk +13 -8
index 207b0be60d..6efade981d 100644
@@ -10,14 +10,19 @@ MDADM_SITE = $(BR2_KERNEL_MIRROR)/linux/utils/raid/mdadm
 MDADM_LICENSE = GPL-2.0+
 MDADM_LICENSE_FILES = COPYING
 
-MDADM_MAKE_OPTS = \
-	CFLAGS="$(TARGET_CFLAGS) -DNO_COROSYNC -DNO_DLM" CC="$(TARGET_CC)" CHECK_RUN_DIR=0 -C $(MDADM_DIR) mdadm
-
-MDADM_INSTALL_TARGET_OPTS = \
-	DESTDIR=$(TARGET_DIR)/usr -C $(MDADM_DIR) install-mdadm
+define MDADM_BUILD_CMDS
+	$(TARGET_MAKE_ENV) $(MAKE) -C $(@D) \
+		$(TARGET_CONFIGURE_OPTS) \
+		CFLAGS="$(TARGET_CFLAGS) -DNO_COROSYNC -DNO_DLM" \
+		CPPFLAGS="$(TARGET_CPPFLAGS) -DBINDIR=\\\"/usr/sbin\\\"" \
+		CHECK_RUN_DIR=0 \
+		mdadm
+endef
 
-define MDADM_CONFIGURE_CMDS
-	# Do nothing
+define MDADM_INSTALL_TARGET_CMDS
+	$(TARGET_MAKE_ENV) $(MAKE) -C $(@D) \
+		DESTDIR=$(TARGET_DIR)/usr \
+		install-mdadm
 endef
 
-$(eval $(autotools-package))
+$(eval $(generic-package))
Signature · 1 line
2.14.4
#1 lore raw

PATCH 2/3 mdadm: move from /usr/sbin to /sbin

The upstream Makefile by default installs to /sbin but we override that to install it in /usr/sbin. Since mdadm is a pretty core utility for the boot process, it makes sense to comply with upstream's default behavior, so we change mdadm.mk to install mdadm in /sbin. This also removes the somewhat non-standard DESTDIR value.

---
 package/mdadm/mdadm.mk | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
package/mdadm/mdadm.mk +2 -2
index 6efade981d..bdf77fcd56 100644
@@ -14,14 +14,14 @@ define MDADM_BUILD_CMDS
 	$(TARGET_MAKE_ENV) $(MAKE) -C $(@D) \
 		$(TARGET_CONFIGURE_OPTS) \
 		CFLAGS="$(TARGET_CFLAGS) -DNO_COROSYNC -DNO_DLM" \
-		CPPFLAGS="$(TARGET_CPPFLAGS) -DBINDIR=\\\"/usr/sbin\\\"" \
+		CPPFLAGS="$(TARGET_CPPFLAGS) -DBINDIR=\\\"/sbin\\\"" \
 		CHECK_RUN_DIR=0 \
 		mdadm
 endef
 
 define MDADM_INSTALL_TARGET_CMDS
 	$(TARGET_MAKE_ENV) $(MAKE) -C $(@D) \
-		DESTDIR=$(TARGET_DIR)/usr \
+		DESTDIR=$(TARGET_DIR) \
 		install-mdadm
 endef
 
Signature · 1 line
2.14.4
#2 lore raw

PATCH 2/3 mdadm: move from /usr/sbin to /sbin

Quoted 9 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Thomas" == Thomas Petazzoni <[email protected]> writes:

The upstream Makefile by default installs to /sbin but we override that to install it in /usr/sbin. Since mdadm is a pretty core utility for the boot process, it makes sense to comply with upstream's default behavior, so we change mdadm.mk to install mdadm in /sbin. This also removes the somewhat non-standard DESTDIR value.

Committed, thanks.

Signature · 1 line
Bye, Peter Korsgaard
#3 lore raw

PATCH 3/3 mdadm: also install mdmon

In reply to Thomas Petazzoni

This commit adjusts the mdadm package to also install the mdmon utility, which is used to "monitor MD external metadata arrays". It adds ~250 KB to the installed size:

-rwxr-xr-x 1 thomas thomas 446064 Oct 14 21:55 mdadm -rwxr-xr-x 1 thomas thomas 244672 Oct 14 21:55 mdmon

Fixes bug #11376.

---
 package/mdadm/mdadm.mk | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
package/mdadm/mdadm.mk +2 -2
index bdf77fcd56..3ee4ddd059 100644
@@ -16,13 +16,13 @@ define MDADM_BUILD_CMDS
 		CFLAGS="$(TARGET_CFLAGS) -DNO_COROSYNC -DNO_DLM" \
 		CPPFLAGS="$(TARGET_CPPFLAGS) -DBINDIR=\\\"/sbin\\\"" \
 		CHECK_RUN_DIR=0 \
-		mdadm
+		mdadm mdmon
 endef
 
 define MDADM_INSTALL_TARGET_CMDS
 	$(TARGET_MAKE_ENV) $(MAKE) -C $(@D) \
 		DESTDIR=$(TARGET_DIR) \
-		install-mdadm
+		install-mdadm install-mdmon
 endef
 
 $(eval $(generic-package))
Signature · 1 line
2.14.4
#4 lore raw

PATCH 3/3 mdadm: also install mdmon

Quoted 9 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Thomas" == Thomas Petazzoni <[email protected]> writes:

This commit adjusts the mdadm package to also install the mdmon utility, which is used to "monitor MD external metadata arrays". It adds ~250 KB to the installed size:

(quoted diff) +0 -2
-rwxr-xr-x 1 thomas thomas 446064 Oct 14 21:55 mdadm
-rwxr-xr-x 1 thomas thomas 244672 Oct 14 21:55 mdmon
Quoted 3 lines

Fixes bug #11376.

Committed, thanks.

Signature · 1 line
Bye, Peter Korsgaard
#5 lore raw

PATCH 1/3 mdadm: convert to generic-package

In reply to Thomas Petazzoni
Quoted 6 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Thomas" == Thomas Petazzoni <[email protected]> writes:

There is absolutely no reason for mdadm.mk to use autotools-package:
this package does not have any configure script at all, and its Makefile is not generated using automake.

Quoted 7 lines

Therefore, convert it to use the generic-package infrastructure. Compared to the previous code, we are now using $(TARGET_CONFIGURE_OPTS), which passes our CPPFLAGS. This overrides the CPPFLAGS from mdadm's Makefile, so we repeat the only CPPFLAGS flag passed in the Makefile, -DBINDIR.

Committed, thanks.

Signature · 1 line
Bye, Peter Korsgaard