Skip to contentSkip to conversation

package/freescale-imx/imx-gpu-viv: move pkg-config files fixup to the build step

PATCH In review Thomas Petazzoni 2 participants 9 messages Aug 5, 2021 – Aug 20, 2021 Arm i.MX and Layerscape

lore
Share & tools
lore
#0 lore raw

PATCH 1/4 package/freescale-imx/imx-gpu-viv: move pkg-config files fixup to the build step

The fixup of the pkg-config files modifies files in the build directory (@D) but is done in the staging installation step, which doesn't make much sense, especially since the build step already has some fixup logic. So we move the fixup logic of the pkg-config files into the build step.

---
 .../freescale-imx/imx-gpu-viv/imx-gpu-viv.mk  | 22 +++++++++----------
 1 file changed, 11 insertions(+), 11 deletions(-)
package/freescale-imx/imx-gpu-viv/imx-gpu-viv.mk +11 -11
index 103c0341e3..51b04f82d4 100644
@@ -42,16 +42,6 @@ define IMX_GPU_VIV_EXTRACT_CMDS
 	$(call FREESCALE_IMX_EXTRACT_HELPER,$(IMX_GPU_VIV_DL_DIR)/$(IMX_GPU_VIV_SOURCE))
 endef
 
-# Instead of building, we fix up the inconsistencies that exist
-# in the upstream archive here. We also remove unused backend files.
-# Make sure these commands are idempotent.
-define IMX_GPU_VIV_BUILD_CMDS
-	cp -dpfr $(@D)/gpu-core/usr/lib/$(IMX_GPU_VIV_LIB_TARGET)/* $(@D)/gpu-core/usr/lib/
-	for backend in fb x11 wayland; do \
-		$(RM) -r $(@D)/gpu-core/usr/lib/$$backend ; \
-	done
-endef
-
 ifeq ($(IMX_GPU_VIV_LIB_TARGET),fb)
 define IMX_GPU_VIV_FIXUP_PKGCONFIG
 	ln -sf egl_linuxfb.pc $(@D)/gpu-core/usr/lib/pkgconfig/egl.pc
@@ -72,9 +62,19 @@ define IMX_GPU_VIV_FIXUP_PKGCONFIG
 endef
 endif
 
+# Instead of building, we fix up the inconsistencies that exist
+# in the upstream archive here. We also remove unused backend files.
+# Make sure these commands are idempotent.
+define IMX_GPU_VIV_BUILD_CMDS
+	cp -dpfr $(@D)/gpu-core/usr/lib/$(IMX_GPU_VIV_LIB_TARGET)/* $(@D)/gpu-core/usr/lib/
+	for backend in fb x11 wayland; do \
+		$(RM) -r $(@D)/gpu-core/usr/lib/$$backend ; \
+	done
+	$(IMX_GPU_VIV_FIXUP_PKGCONFIG)
+endef
+
 define IMX_GPU_VIV_INSTALL_STAGING_CMDS
 	cp -r $(@D)/gpu-core/usr/* $(STAGING_DIR)/usr
-	$(IMX_GPU_VIV_FIXUP_PKGCONFIG)
 	for lib in egl gbm glesv1_cm glesv2 vg; do \
 		$(INSTALL) -m 0644 -D \
 			$(@D)/gpu-core/usr/lib/pkgconfig/$${lib}.pc \
Signature · 6 lines
2.31.1

_______________________________________________
buildroot mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/buildroot
#1 lore raw

PATCH 2/4 package/freescale-imx/imx-gpu-viv: drop pkg-config files installation

We manually install pkg-config files from $(@D)/gpu-core/usr/lib/pkgconfig to the STAGING_DIR right after copying the entire $(@D)/gpu-core/usr/* files to STAGING_DIR. This makes the manual copying of pkg-config files pretty useless.

---
 package/freescale-imx/imx-gpu-viv/imx-gpu-viv.mk | 5 -----
 1 file changed, 5 deletions(-)
package/freescale-imx/imx-gpu-viv/imx-gpu-viv.mk +0 -5
index 51b04f82d4..9d974cac41 100644
@@ -75,11 +75,6 @@ endef
 
 define IMX_GPU_VIV_INSTALL_STAGING_CMDS
 	cp -r $(@D)/gpu-core/usr/* $(STAGING_DIR)/usr
-	for lib in egl gbm glesv1_cm glesv2 vg; do \
-		$(INSTALL) -m 0644 -D \
-			$(@D)/gpu-core/usr/lib/pkgconfig/$${lib}.pc \
-			$(STAGING_DIR)/usr/lib/pkgconfig/$${lib}.pc; \
-	done
 endef
 
 ifeq ($(BR2_PACKAGE_IMX_GPU_VIV_EXAMPLES),y)
Signature · 6 lines
2.31.1

_______________________________________________
buildroot mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/buildroot
Reviewed-by on v1 2/4
#2 lore raw

Re: [Buildroot] [PATCH 2/4] package/freescale-imx/imx-gpu-viv: drop pkg-config files installation

Hi,

Quoted 6 lines · Thomas Petazzoni

We manually install pkg-config files from $(@D)/gpu-core/usr/lib/pkgconfig to the STAGING_DIR right after copying the entire $(@D)/gpu-core/usr/* files to STAGING_DIR. This makes the manual copying of pkg-config files pretty useless.

Indeed, this step can be removed. I checked the .files-list-staging.txt file and confirm nothing has changed with this patch.

Maybe a cleaner way would be to not copy everything first and only copy the .pc files that are needed but this could be done later. At least this patch doesn't change the behavior and makes the package simpler.

Regards,
Gary
_______________________________________________
buildroot mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/buildroot

#3 lore raw

PATCH 3/4 package/freescale-imx/imx-gpu-viv: make pkg-config fixups mutually exclusive

In reply to Thomas Petazzoni

The IMX_GPU_VIV_FIXUP_PKGCONFIG fixup is defined conditionally depending on the value of IMX_GPU_VIV_LIB_TARGET, which means that obviously only one of the definitions is possible. Make this clear by using a ifeq ... else ifeq ... else ifeq ... endif logic.

---
 package/freescale-imx/imx-gpu-viv/imx-gpu-viv.mk | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)
package/freescale-imx/imx-gpu-viv/imx-gpu-viv.mk +2 -6
index 9d974cac41..df39d3ddc2 100644
@@ -46,15 +46,11 @@ ifeq ($(IMX_GPU_VIV_LIB_TARGET),fb)
 define IMX_GPU_VIV_FIXUP_PKGCONFIG
 	ln -sf egl_linuxfb.pc $(@D)/gpu-core/usr/lib/pkgconfig/egl.pc
 endef
-endif
-
-ifeq ($(IMX_GPU_VIV_LIB_TARGET),wayland)
+else ifeq ($(IMX_GPU_VIV_LIB_TARGET),wayland)
 define IMX_GPU_VIV_FIXUP_PKGCONFIG
 	ln -sf egl_wayland.pc $(@D)/gpu-core/usr/lib/pkgconfig/egl.pc
 endef
-endif
-
-ifeq ($(IMX_GPU_VIV_LIB_TARGET),x11)
+else ifeq ($(IMX_GPU_VIV_LIB_TARGET),x11)
 define IMX_GPU_VIV_FIXUP_PKGCONFIG
 	for lib in egl gbm glesv1_cm glesv2 vg; do \
 		ln -sf $${lib}_x11.pc $(@D)/gpu-core/usr/lib/pkgconfig/$${lib}.pc || exit 1; \
Signature · 6 lines
2.31.1

_______________________________________________
buildroot mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/buildroot
Reviewed-by on v1 3/4
#4 lore raw

Re: [Buildroot] [PATCH 3/4] package/freescale-imx/imx-gpu-viv: make pkg-config fixups mutually exclusive

Hi,

Quoted 6 lines · Thomas Petazzoni

The IMX_GPU_VIV_FIXUP_PKGCONFIG fixup is defined conditionally depending on the value of IMX_GPU_VIV_LIB_TARGET, which means that obviously only one of the definitions is possible. Make this clear by using a ifeq ... else ifeq ... else ifeq ... endif logic.

Good point, not sure why it wasn't like this since day one.

Regards,
Gary
_______________________________________________
buildroot mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/buildroot

#5 lore raw

PATCH 4/4 package/freescale-imx/imx-gpu-viv: use make loops instead of shell loops

In reply to Thomas Petazzoni

We generally prefer using make loops instead of shell loops. They bring automatic error handling, as they abort the loop when there is an error, without the need for "|| exit 1".

---
 package/freescale-imx/imx-gpu-viv/imx-gpu-viv.mk | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
package/freescale-imx/imx-gpu-viv/imx-gpu-viv.mk +6 -6
index df39d3ddc2..fec19523a3 100644
@@ -52,9 +52,9 @@ define IMX_GPU_VIV_FIXUP_PKGCONFIG
 endef
 else ifeq ($(IMX_GPU_VIV_LIB_TARGET),x11)
 define IMX_GPU_VIV_FIXUP_PKGCONFIG
-	for lib in egl gbm glesv1_cm glesv2 vg; do \
-		ln -sf $${lib}_x11.pc $(@D)/gpu-core/usr/lib/pkgconfig/$${lib}.pc || exit 1; \
-	done
+	$(foreach lib,egl gbm glesv1_cm glesv2 vg, \
+		ln -sf $(lib)_x11.pc $(@D)/gpu-core/usr/lib/pkgconfig/$(lib).pc
+	)
 endef
 endif
 
@@ -63,9 +63,9 @@ endif
 # Make sure these commands are idempotent.
 define IMX_GPU_VIV_BUILD_CMDS
 	cp -dpfr $(@D)/gpu-core/usr/lib/$(IMX_GPU_VIV_LIB_TARGET)/* $(@D)/gpu-core/usr/lib/
-	for backend in fb x11 wayland; do \
-		$(RM) -r $(@D)/gpu-core/usr/lib/$$backend ; \
-	done
+	$(foreach backend,fb x11 wayland, \
+		$(RM) -r $(@D)/gpu-core/usr/lib/$(backend)
+	)
 	$(IMX_GPU_VIV_FIXUP_PKGCONFIG)
 endef
 
Signature · 6 lines
2.31.1

_______________________________________________
buildroot mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/buildroot
Reviewed-by on v1 4/4
#6 lore raw

Re: [Buildroot] [PATCH 4/4] package/freescale-imx/imx-gpu-viv: use make loops instead of shell loops

Hi,

Quoted 5 lines · Thomas Petazzoni

We generally prefer using make loops instead of shell loops. They bring automatic error handling, as they abort the loop when there is an error, without the need for "|| exit 1".

Same, not sure why shell loops were used in the first place.

Regards,
Gary
_______________________________________________
buildroot mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/buildroot

Reviewed-by on v1 1/4
#7 lore raw
In reply to Thomas Petazzoni

Hi Thomas,

Quoted 7 lines · Thomas Petazzoni

The fixup of the pkg-config files modifies files in the build directory (@D) but is done in the staging installation step, which doesn't make much sense, especially since the build step already has some fixup logic. So we move the fixup logic of the pkg-config files into the build step.

Agreed, makes more sense to do the "magic" in the build step.

Thanks,
Gary
_______________________________________________
buildroot mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/buildroot

#8 lore raw
In reply to Thomas Petazzoni
Quoted 10 lines · On Thu, 5 Aug 2021 23:27:32 +0200 Thomas Petazzoni…

The fixup of the pkg-config files modifies files in the build directory (@D) but is done in the staging installation step, which doesn't make much sense, especially since the build step already has some fixup logic. So we move the fixup logic of the pkg-config files into the build step.

---
 .../freescale-imx/imx-gpu-viv/imx-gpu-viv.mk  | 22 +++++++++----------
 1 file changed, 11 insertions(+), 11 deletions(-)

Following the review of Gary, I have applied to next those 4 patches. Thanks Gary!

Thomas

Signature · 7 lines
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
_______________________________________________
buildroot mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/buildroot