Skip to contentSkip to conversation

meson: change from global to per package cross-compilation.conf

RFC New Peter Seiderer 4 participants 12 messages Jul 13, 2018 – Jul 17, 2018 Arm/Amlogic Meson SoC support

lore
Share & tools
lore
#0 lore raw

RFC 1/2 meson: change from global to per package cross-compilation.conf

Add FOO_MESON_CFLAGS, FOO_MESON_LDFLAGS and FOO_MESON_CXXFLAGS variables to allow per package additional flags.

Change to buildtype plain as all compiler/linker flags forcing debug/release are already given via the cross-compilation.conf file.

---
Notes:
- documentation change for new flags missing
- use in pkg-meson.mk the same sed/printf for flags quotation mark and comma adding

---
 package/meson/cross-compilation.conf.in | 8 ++++----
 package/meson/meson.mk                  | 6 +++---
 package/pkg-meson.mk                    | 9 +++++++--
 3 files changed, 14 insertions(+), 9 deletions(-)
package/meson/cross-compilation.conf.in +4 -4
index 0eec74087b..6af03314eb 100644
@@ -11,10 +11,10 @@ strip = '@TARGET_CROSS at strip'
 pkgconfig = '@HOST_DIR@/usr/bin/pkg-config'
 
 [properties]
-c_args = [@TARGET_CFLAGS@]
-c_link_args = [@TARGET_LDFLAGS@]
-cpp_args = [@TARGET_CXXFLAGS@]
-cpp_link_args = [@TARGET_LDFLAGS@]
+c_args = [@TARGET_CFLAGS@ @PKG_TARGET_CFLAGS@]
+c_link_args = [@TARGET_LDFLAGS@ @PKG_TARGET_LDFLAGS@]
+cpp_args = [@TARGET_CXXFLAGS@ @PKG_TARGET_CXXFLAGS@]
+cpp_link_args = [@TARGET_LDFLAGS@ @PKG_TARGET_LDFLAGS@]
 
 [host_machine]
 system = 'linux'
package/meson/meson.mk +3 -3
index 28c9e6f202..5c1123a8ad 100644
@@ -20,7 +20,7 @@ HOST_MESON_SED_CFLAGS = $(if $(TARGET_CFLAGS),`printf '"%s"$(comma) ' $(TARGET_C
 HOST_MESON_SED_LDFLAGS = $(if $(TARGET_LDFLAGS),`printf '"%s"$(comma) ' $(TARGET_LDFLAGS)`)
 HOST_MESON_SED_CXXFLAGS = $(if $(TARGET_CXXFLAGS),`printf '"%s"$(comma) ' $(TARGET_CXXFLAGS)`)
 
-define HOST_MESON_INSTALL_CROSS_CONF
+define HOST_MESON_INSTALL_CROSS_CONF_IN
 	mkdir -p $(HOST_DIR)/etc/meson
 	sed -e "s%@TARGET_CROSS@%$(TARGET_CROSS)%g" \
 	    -e "s%@TARGET_ARCH@%$(ARCH)%g" \
@@ -31,9 +31,9 @@ define HOST_MESON_INSTALL_CROSS_CONF
 	    -e "s%@TARGET_CXXFLAGS@%$(HOST_MESON_SED_CXXFLAGS)%g" \
 	    -e "s%@HOST_DIR@%$(HOST_DIR)%g" \
 	    $(HOST_MESON_PKGDIR)/cross-compilation.conf.in \
-	    > $(HOST_DIR)/etc/meson/cross-compilation.conf
+	    > $(HOST_DIR)/etc/meson/cross-compilation.conf.in
 endef
 
-HOST_MESON_POST_INSTALL_HOOKS += HOST_MESON_INSTALL_CROSS_CONF
+HOST_MESON_POST_INSTALL_HOOKS += HOST_MESON_INSTALL_CROSS_CONF_IN
 
 $(eval $(host-python-package))
package/pkg-meson.mk +7 -2
index 507e686068..565e10e8fb 100644
@@ -64,12 +64,17 @@ ifeq ($(4),target)
 define $(2)_CONFIGURE_CMDS
 	rm -rf $$($$(PKG)_SRCDIR)/build
 	mkdir -p $$($$(PKG)_SRCDIR)/build
+	sed -e "s%@PKG_TARGET_CFLAGS@%$$($$(PKG)_MESON_CFLAGS)%g" \
+	    -e "s%@PKG_TARGET_LDFLAGS@%$$($$(PKG)_MESON_LDFLAGS)%g" \
+	    -e "s%@PKG_TARGET_CXXFLAGS@%$$($$(PKG)_MESON_CXXFLAGS)%g" \
+	    $(HOST_DIR)/etc/meson/cross-compilation.conf.in \
+	    > $$($$(PKG)_SRCDIR)/build//cross-compilation.conf
 	PATH=$$(BR_PATH) $$($$(PKG)_CONF_ENV) $$(MESON) \
 		--prefix=/usr \
 		--libdir=lib \
 		--default-library=$(if $(BR2_STATIC_LIBS),static,shared) \
-		--buildtype=$(if $(BR2_ENABLE_DEBUG),debug,release) \
-		--cross-file=$(HOST_DIR)/etc/meson/cross-compilation.conf \
+		--buildtype=plain \
+		--cross-file=$$($$(PKG)_SRCDIR)/build/cross-compilation.conf \
 		$$($$(PKG)_CONF_OPTS) \
 		$$($$(PKG)_SRCDIR) $$($$(PKG)_SRCDIR)/build
 endef
Signature · 1 line
2.17.1
#1 lore raw

RFC 2/2 libdrm: change to meson build system

---
Notes:
- convertion from "LIBDRM_CONF_ENV = ac_cv_prog_cc_c99='-std=gnu99'" is missing (maybe meson gets it right (?) or use LIBDRM_MESON_CFLAGS to force it)

---
 ...le.am-use-pkg-config-to-discover-lib.patch | 162 ------------------
 package/libdrm/libdrm.mk                      |  71 ++++----
 2 files changed, 32 insertions(+), 201 deletions(-)
 delete mode 100644 package/libdrm/0003-configure-Makefile.am-use-pkg-config-to-discover-lib.patch
package/libdrm/0003-configure-Makefile.am-use-pkg-config-to-discover-lib.patch deleted +0 -162
deleted file mode 100644
index 0fbe77ef7c..0000000000
@@ -1,162 +0,0 @@
-From 57d544ff2f96a26cac07d5be00ff7b67678ae7b8 Mon Sep 17 00:00:00 2001
-From: Thomas Petazzoni <[email protected]>
-Date: Mon, 18 Dec 2017 13:08:39 +0100
-Subject: [PATCH] configure/Makefile.am: use pkg-config to discover
- libatomic_ops
-
-The configure script currently tests the availability of libatomic_ops
-by checking the presence of atomic_ops.h. While this is good enough as
-an availability test, it is not sufficient as on some platforms,
-libatomic_ops provides an actual shared library against which we
-should be linked to access libatomic_ops functionality.
-
-Therefore, we instead use PKG_CHECK_MODULES() to test the availability
-of libatomic_ops. Besides testing its availability, this also fills in
-the ATOMIC_OPS_LIBS variable with the list of libraries we need to
-link with to use libatomic_ops.
-
-All Mesa drivers that include xf86atomic.h have been updated to link
-against ATOMIC_OPS_LIBS.
-
-Of course, if we're not using libatomic_ops, ATOMIC_OPS_LIBS is empty,
-and we don't link against it.
-
-Signed-off-by: Thomas Petazzoni <[email protected]>
-Signed-off-by: Peter Seiderer <[email protected]>
-[Bernd: PKG_CHECK_MODULES should not fail when libatomic_ops is missing]
-Signed-off-by: Bernd Kuhls <[email protected]>
----
- amdgpu/Makefile.am    | 2 +-
- configure.ac          | 2 +-
- etnaviv/Makefile.am   | 3 ++-
- freedreno/Makefile.am | 3 ++-
- intel/Makefile.am     | 3 ++-
- nouveau/Makefile.am   | 2 +-
- omap/Makefile.am      | 2 +-
- radeon/Makefile.am    | 2 +-
- tegra/Makefile.am     | 2 +-
- 9 files changed, 12 insertions(+), 9 deletions(-)
-
-diff --git a/amdgpu/Makefile.am b/amdgpu/Makefile.am
-index a1b0d05c..b2bcceff 100644
---- a/amdgpu/Makefile.am
-+++ b/amdgpu/Makefile.am
-@@ -36,7 +36,7 @@ AM_CPPFLAGS = -DAMDGPU_ASIC_ID_TABLE=\"${libdrmdatadir}/amdgpu.ids\"
- libdrm_amdgpu_la_LTLIBRARIES = libdrm_amdgpu.la
- libdrm_amdgpu_ladir = $(libdir)
- libdrm_amdgpu_la_LDFLAGS = -version-number 1:0:0 -no-undefined
--libdrm_amdgpu_la_LIBADD = ../libdrm.la @PTHREADSTUBS_LIBS@
-+libdrm_amdgpu_la_LIBADD = ../libdrm.la @PTHREADSTUBS_LIBS@ @ATOMIC_OPS_LIBS@
- 
- libdrm_amdgpu_la_SOURCES = $(LIBDRM_AMDGPU_FILES)
- amdgpu_asic_id.lo: $(top_srcdir)/data/amdgpu.ids
-diff --git a/configure.ac b/configure.ac
-index 35378b33..501d0871 100644
---- a/configure.ac
-+++ b/configure.ac
-@@ -247,7 +247,7 @@ AC_CACHE_CHECK([for native atomic primitives], drm_cv_atomic_primitives, [
- 					  ]],[[]])], [drm_cv_atomic_primitives="Intel"],[])
- 
- 	if test "x$drm_cv_atomic_primitives" = "xnone"; then
--		AC_CHECK_HEADER([atomic_ops.h], drm_cv_atomic_primitives="libatomic-ops")
-+		PKG_CHECK_MODULES(ATOMIC_OPS, [atomic_ops], drm_cv_atomic_primitives="libatomic-ops", true)
- 	fi
- 
- 	# atomic functions defined in <atomic.h> & libc on Solaris
-diff --git a/etnaviv/Makefile.am b/etnaviv/Makefile.am
-index be96ba86..669cf14f 100644
---- a/etnaviv/Makefile.am
-+++ b/etnaviv/Makefile.am
-@@ -12,7 +12,8 @@ libdrm_etnaviv_la_LDFLAGS = -version-number 1:0:0 -no-undefined
- libdrm_etnaviv_la_LIBADD = \
- 	../libdrm.la \
- 	@PTHREADSTUBS_LIBS@ \
--	@CLOCK_LIB@
-+	@CLOCK_LIB@ \
-+	@ATOMIC_OPS_LIBS@
- 
- libdrm_etnaviv_la_SOURCES = $(LIBDRM_ETNAVIV_FILES)
- 
-diff --git a/freedreno/Makefile.am b/freedreno/Makefile.am
-index cbb0d031..238407e3 100644
---- a/freedreno/Makefile.am
-+++ b/freedreno/Makefile.am
-@@ -14,7 +14,8 @@ libdrm_freedreno_la_LDFLAGS = -version-number 1:0:0 -no-undefined
- libdrm_freedreno_la_LIBADD = \
- 	../libdrm.la \
- 	@PTHREADSTUBS_LIBS@ \
--	@CLOCK_LIB@
-+	@CLOCK_LIB@ \
-+	@ATOMIC_OPS_LIBS@
- 
- libdrm_freedreno_la_SOURCES = $(LIBDRM_FREEDRENO_FILES)
- if HAVE_FREEDRENO_KGSL
-diff --git a/intel/Makefile.am b/intel/Makefile.am
-index c52e8c08..f3635a64 100644
---- a/intel/Makefile.am
-+++ b/intel/Makefile.am
-@@ -38,7 +38,8 @@ libdrm_intel_la_LDFLAGS = -version-number 1:0:0 -no-undefined
- libdrm_intel_la_LIBADD = ../libdrm.la \
- 	@PTHREADSTUBS_LIBS@ \
- 	@PCIACCESS_LIBS@ \
--	@CLOCK_LIB@
-+	@CLOCK_LIB@ \
-+	@ATOMIC_OPS_LIBS@
- 
- libdrm_intel_la_SOURCES = $(LIBDRM_INTEL_FILES)
- 
-diff --git a/nouveau/Makefile.am b/nouveau/Makefile.am
-index 344a8445..a4e6a78b 100644
---- a/nouveau/Makefile.am
-+++ b/nouveau/Makefile.am
-@@ -10,7 +10,7 @@ AM_CFLAGS = \
- libdrm_nouveau_la_LTLIBRARIES = libdrm_nouveau.la
- libdrm_nouveau_ladir = $(libdir)
- libdrm_nouveau_la_LDFLAGS = -version-number 2:0:0 -no-undefined
--libdrm_nouveau_la_LIBADD = ../libdrm.la @PTHREADSTUBS_LIBS@
-+libdrm_nouveau_la_LIBADD = ../libdrm.la @PTHREADSTUBS_LIBS@ @ATOMIC_OPS_LIBS@
- 
- libdrm_nouveau_la_SOURCES = $(LIBDRM_NOUVEAU_FILES)
- 
-diff --git a/omap/Makefile.am b/omap/Makefile.am
-index 599bb9de..524afee3 100644
---- a/omap/Makefile.am
-+++ b/omap/Makefile.am
-@@ -7,7 +7,7 @@ AM_CFLAGS = \
- libdrm_omap_la_LTLIBRARIES = libdrm_omap.la
- libdrm_omap_ladir = $(libdir)
- libdrm_omap_la_LDFLAGS = -version-number 1:0:0 -no-undefined
--libdrm_omap_la_LIBADD = ../libdrm.la @PTHREADSTUBS_LIBS@
-+libdrm_omap_la_LIBADD = ../libdrm.la @PTHREADSTUBS_LIBS@ @ATOMIC_OPS_LIBS@
- 
- libdrm_omap_la_SOURCES = omap_drm.c
- 
-diff --git a/radeon/Makefile.am b/radeon/Makefile.am
-index e2415314..c27d3c75 100644
---- a/radeon/Makefile.am
-+++ b/radeon/Makefile.am
-@@ -33,7 +33,7 @@ AM_CFLAGS = \
- libdrm_radeon_la_LTLIBRARIES = libdrm_radeon.la
- libdrm_radeon_ladir = $(libdir)
- libdrm_radeon_la_LDFLAGS = -version-number 1:0:1 -no-undefined
--libdrm_radeon_la_LIBADD = ../libdrm.la @PTHREADSTUBS_LIBS@
-+libdrm_radeon_la_LIBADD = ../libdrm.la @PTHREADSTUBS_LIBS@ @ATOMIC_OPS_LIBS@
- 
- libdrm_radeon_la_SOURCES = $(LIBDRM_RADEON_FILES)
- 
-diff --git a/tegra/Makefile.am b/tegra/Makefile.am
-index fb40be55..12abe8c4 100644
---- a/tegra/Makefile.am
-+++ b/tegra/Makefile.am
-@@ -9,7 +9,7 @@ AM_CFLAGS = \
- libdrm_tegra_ladir = $(libdir)
- libdrm_tegra_la_LTLIBRARIES = libdrm_tegra.la
- libdrm_tegra_la_LDFLAGS = -version-number 0:0:0 -no-undefined
--libdrm_tegra_la_LIBADD = ../libdrm.la @PTHREADSTUBS_LIBS@
-+libdrm_tegra_la_LIBADD = ../libdrm.la @PTHREADSTUBS_LIBS@ @ATOMIC_OPS_LIBS@
- 
- libdrm_tegra_la_SOURCES = \
- 	private.h \
--- 
-2.14.3
-
package/libdrm/libdrm.mk +32 -39

143 lines not on this page · raw message

Signature · 1 line
2.17.1
#2 lore raw

RFC 2/2 libdrm: change to meson build system

Hello,

Quoted 6 lines · Peter Seiderer

---
Notes:
- convertion from "LIBDRM_CONF_ENV = ac_cv_prog_cc_c99='-std=gnu99'" is missing (maybe meson gets it right (?) or use LIBDRM_MESON_CFLAGS to force it)

With all those packages migrating to meson, would it be possible to look at removing some dependencies from host-ninja/host-meson ? Right now, host-ninja forces to build a Python interpreter, either host-python or host-python3, and then host-meson forces to build host-python3.

If Ninja is compatible with both Python 2 and Python 3, why can't we use the system-provided Python interpreter rather than building our own ?

Does Meson absolutely needs a Python 3 interpreter ?

Meson allows faster builds than autoconf/automake, but in practice, for a simple build with just a few packages, if one of them uses Meson, then the build is actually slower due to the need to build host-python3, and maybe even host-python, as that's what host-ninja defaults to.

Best regards,

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.com
#3 lore raw

RFC 2/2 libdrm: change to meson build system

Hello,

Quoted 11 lines · Thomas Petazzoni

With all those packages migrating to meson, would it be possible to look at removing some dependencies from host-ninja/host-meson ? Right now, host-ninja forces to build a Python interpreter, either host-python or host-python3, and then host-meson forces to build host-python3.

If Ninja is compatible with both Python 2 and Python 3, why can't we use the system-provided Python interpreter rather than building our own ?

Does Meson absolutely needs a Python 3 interpreter ?

Just to illustrate what I'm saying: https://i.imgur.com/xLIziDo.png

A thing that clearly is silly is to build both host-python3 and host-python, we definitely want to fix this. I think the only way to fix this properly is to introduce hidden Config.in.host options. This way, host-ninja would know that host-python3 is going to be built, and will use it instead of building host-python.

Best regards,

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.com
#4 lore raw

RFC 2/2 libdrm: change to meson build system

In reply to Thomas Petazzoni

Hi!

Quoted 16 lines · Thomas Petazzoni

Hello,

Quoted 6 lines · Peter Seiderer

---
Notes:
- convertion from "LIBDRM_CONF_ENV = ac_cv_prog_cc_c99='-std=gnu99'" is missing (maybe meson gets it right (?) or use LIBDRM_MESON_CFLAGS to force it)

With all those packages migrating to meson, would it be possible to look at removing some dependencies from host-ninja/host-meson ? Right now, host-ninja forces to build a Python interpreter, either host-python or host-python3, and then host-meson forces to build host-python3.

Quoted 3 lines

If Ninja is compatible with both Python 2 and Python 3, why can't we use the system-provided Python interpreter rather than building our own ?

Is it the technique used for cmake with $(BR2_CMAKE_HOST_DEPENDENCY), or am I mistaken?

Quoted 1 line

Does Meson absolutely needs a Python 3 interpreter ?

Meson is strict about this. From setup.py:

```
if sys.version_info < (3, 5, 0):
    print('Tried to install with an unsupported version of Python. '
              'Meson requires Python 3.5.0 or greater')
	          sys.exit(1)
```

Regards,

--
ELB

#5 lore raw

RFC 2/2 libdrm: change to meson build system

Hello Eric,

Quoted 6 lines · Eric Le Bihan
Quoted 3 lines

If Ninja is compatible with both Python 2 and Python 3, why can't we use the system-provided Python interpreter rather than building our own ?

Is it the technique used for cmake with $(BR2_CMAKE_HOST_DEPENDENCY), or am I mistaken?

No, it's not the same thing. BR2_CMAKE_HOST_DEPENDENCY is to avoid building CMake if a suitable CMake version is already provided on the host.

What I'm suggesting as a first step is to avoid building both host-python3 and host-python. Once this first step is done, and only host-python3 gets built, then maybe we can think of avoiding the host-python3 build by using the system-provided version, with something similar to BR2_CMAKE_HOST_DEPENDENCY.

Quoted 3 lines
Quoted 1 line

Does Meson absolutely needs a Python 3 interpreter ?

Meson is strict about this. From setup.py:

Meh, OK :-/

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.com
#6 lore raw

RFC 2/2 libdrm: change to meson build system

In reply to Thomas Petazzoni

Hello Thomas,

Quoted 16 lines · Thomas Petazzoni

Hello,

Quoted 6 lines · Peter Seiderer

---
Notes:
- convertion from "LIBDRM_CONF_ENV = ac_cv_prog_cc_c99='-std=gnu99'" is missing (maybe meson gets it right (?) or use LIBDRM_MESON_CFLAGS to force it)

With all those packages migrating to meson, would it be possible to look at removing some dependencies from host-ninja/host-meson ? Right now, host-ninja forces to build a Python interpreter, either host-python or host-python3, and then host-meson forces to build host-python3.

Quoted 5 lines

If Ninja is compatible with both Python 2 and Python 3, why can't we use the system-provided Python interpreter rather than building our own ?

Does Meson absolutely needs a Python 3 interpreter ?

Yes, the dependency on two different Phython versions is ridiculous for two tools working togehter...

For ninja the FAQ [1] states:

Does Ninja support Python 3?

Using Ninja for your project is language-agnostic. Internally Ninja uses Python 2 to build itself. It is my belief that systems where /usr/bin/python is not Python 2 are broken (given that we can't go back in time and add a /usr/bin/python2 on existing systems; see also this discussion). However, I've grudgingly accepted patches to make the code run under Python 3 when they're not horrifically ugly.

The other way round for meson to downgrade to Python 2 there is a mesa patch 'meson: Build with Python 3' stating:

Now that all the build scripts are compatible with both Python 2 and 3, we can flip the switch and tell Meson to use the latter.

Since Meson already depends on Python 3 anyway, this means we don't need two different Python stacks to build Mesa.

Quoted 6 lines

Meson allows faster builds than autoconf/automake, but in practice, for a simple build with just a few packages, if one of them uses Meson, then the build is actually slower due to the need to build host-python3, and maybe even host-python, as that's what host-ninja defaults to.

My speedup for libdrm only was from 20 seconds down to 7 seconds...

Regards,
Peter

[1] https://github.com/ninja-build/ninja/wiki/FAQ
[2] https://gitlab.freedesktop.org/bochecha/mesa/commit/f024258066e310757b37c2fc31376300c72a4805

Quoted 4 lines

Best regards,

Thomas

#7 lore raw

RFC 2/2 libdrm: change to meson build system

In reply to Peter Seiderer

package/libdrm/0003-configure-Makefile.am-use-pkg-config-to-discover-lib.patch

Quoted 17 lines · Peter Seiderer

---
Notes:
- convertion from "LIBDRM_CONF_ENV = ac_cv_prog_cc_c99='-std=gnu99'" is missing (maybe meson gets it right (?) or use LIBDRM_MESON_CFLAGS to force it)

---
 ...le.am-use-pkg-config-to-discover-lib.patch | 162 ------------------
 package/libdrm/libdrm.mk                      |  71 ++++----
 2 files changed, 32 insertions(+), 201 deletions(-)
 delete mode 100644 package/libdrm/0003-configure-Makefile.am-use-pkg-config-to-discover-lib.patch
package/libdrm/0003-configure-Makefile.am-use-pkg-config-to-discover-lib.patch deleted +0 -0
deleted file mode 100644
index 0fbe77ef7c..0000000000

Needs substitute patch for this one, the build of the following defconfig failes (again) with meson:

.../host/bin/sparc-linux-gcc -o etnaviv/libdrm_etnaviv.so.1.0.0 'etnaviv/etnaviv@@drm_etnaviv at sha/etnaviv_device.c.o' 'etnaviv/etnaviv@@drm_etnaviv at sha/etnaviv_gpu.c.o' 'etnaviv/etnaviv@@drm_etnaviv at sha/etnaviv_bo.c.o' 'etnaviv/etnaviv@@drm_etnaviv at sha/etnaviv_bo_cache.c.o' 'etnaviv/etnaviv@@drm_etnaviv at sha/etnaviv_perfmon.c.o' 'etnaviv/etnaviv@@drm_etnaviv at sha/etnaviv_pipe.c.o' 'etnaviv/etnaviv@@drm_etnaviv at sha/etnaviv_cmd_stream.c.o' -Wl,--no-undefined -Wl,--as-needed -shared -fPIC -Wl,--start-group -Wl,-soname,libdrm_etnaviv.so.1 libdrm.so.2.4.0 -Wl,--end-group '-Wl,-rpath,$ORIGIN/..' -Wl,-rpath-link,.../build/libdrm-2.4.92/build/ etnaviv/etnaviv@@drm_etnaviv at sha/etnaviv_device.c.o: In function `etna_device_ref':
.../build/libdrm-2.4.92/build/../etnaviv/etnaviv_device.c:77: undefined reference to `__sync_fetch_and_add_4'
etnaviv/etnaviv@@drm_etnaviv at sha/etnaviv_device.c.o: In function `etna_device_del_locked':
.../build/libdrm-2.4.92/build/../etnaviv/etnaviv_device.c:96: undefined reference to `__sync_add_and_fetch_4'
etnaviv/etnaviv@@drm_etnaviv at sha/etnaviv_device.c.o: In function `etna_device_del':
.../build/libdrm-2.4.92/build/../etnaviv/etnaviv_device.c:104: undefined reference to `__sync_add_and_fetch_4'
etnaviv/etnaviv@@drm_etnaviv at sha/etnaviv_bo.c.o: In function `etna_bo_ref':
.../build/libdrm-2.4.92/build/../etnaviv/etnaviv_bo.c:136: undefined reference to `__sync_fetch_and_add_4'
etnaviv/etnaviv@@drm_etnaviv at sha/etnaviv_bo.c.o: In function `etna_bo_del':
.../build/libdrm-2.4.92/build/../etnaviv/etnaviv_bo.c:241: undefined reference to `__sync_add_and_fetch_4'
collect2: error: ld returned 1 exit status

BR2_sparc=y
BR2_ENABLE_DEBUG=y
BR2_TOOLCHAIN_EXTERNAL=y
BR2_TOOLCHAIN_EXTERNAL_DOWNLOAD=y BR2_TOOLCHAIN_EXTERNAL_URL="http://autobuild.buildroot.org/toolchains/tarballs/br-sparc-uclibc-2017.11-rc1.tar.bz2" BR2_TOOLCHAIN_EXTERNAL_GCC_6=y
BR2_TOOLCHAIN_EXTERNAL_HEADERS_4_1=y
BR2_TOOLCHAIN_EXTERNAL_LOCALE=y
# BR2_TOOLCHAIN_EXTERNAL_HAS_THREADS_DEBUG is not set
BR2_TOOLCHAIN_EXTERNAL_CXX=y
BR2_SYSTEM_BIN_SH_NONE=y
BR2_PACKAGE_LIBDRM=y
BR2_PACKAGE_LIBDRM_NOUVEAU=y
BR2_PACKAGE_LIBDRM_ETNAVIV=y

Regards,
Peter

Quoted 311 lines
package/libdrm/0003-configure-Makefile.am-use-pkg-config-to-discover-lib.patch deleted +0 -162
@@ -1,162 +0,0 @@
-From 57d544ff2f96a26cac07d5be00ff7b67678ae7b8 Mon Sep 17 00:00:00 2001
-From: Thomas Petazzoni <[email protected]>
-Date: Mon, 18 Dec 2017 13:08:39 +0100
-Subject: [PATCH] configure/Makefile.am: use pkg-config to discover
- libatomic_ops
-
-The configure script currently tests the availability of libatomic_ops
-by checking the presence of atomic_ops.h. While this is good enough as
-an availability test, it is not sufficient as on some platforms,
-libatomic_ops provides an actual shared library against which we
-should be linked to access libatomic_ops functionality.
-
-Therefore, we instead use PKG_CHECK_MODULES() to test the availability
-of libatomic_ops. Besides testing its availability, this also fills in
-the ATOMIC_OPS_LIBS variable with the list of libraries we need to
-link with to use libatomic_ops.
-
-All Mesa drivers that include xf86atomic.h have been updated to link
-against ATOMIC_OPS_LIBS.
-
-Of course, if we're not using libatomic_ops, ATOMIC_OPS_LIBS is empty,
-and we don't link against it.
-
-Signed-off-by: Thomas Petazzoni <[email protected]>
-Signed-off-by: Peter Seiderer <[email protected]>
-[Bernd: PKG_CHECK_MODULES should not fail when libatomic_ops is missing]
-Signed-off-by: Bernd Kuhls <[email protected]>
----
- amdgpu/Makefile.am    | 2 +-
- configure.ac          | 2 +-
- etnaviv/Makefile.am   | 3 ++-
- freedreno/Makefile.am | 3 ++-
- intel/Makefile.am     | 3 ++-
- nouveau/Makefile.am   | 2 +-
- omap/Makefile.am      | 2 +-
- radeon/Makefile.am    | 2 +-
- tegra/Makefile.am     | 2 +-
- 9 files changed, 12 insertions(+), 9 deletions(-)
-
-diff --git a/amdgpu/Makefile.am b/amdgpu/Makefile.am
-index a1b0d05c..b2bcceff 100644
---- a/amdgpu/Makefile.am
-+++ b/amdgpu/Makefile.am
-@@ -36,7 +36,7 @@ AM_CPPFLAGS = -DAMDGPU_ASIC_ID_TABLE=\"${libdrmdatadir}/amdgpu.ids\"
- libdrm_amdgpu_la_LTLIBRARIES = libdrm_amdgpu.la
- libdrm_amdgpu_ladir = $(libdir)
- libdrm_amdgpu_la_LDFLAGS = -version-number 1:0:0 -no-undefined
--libdrm_amdgpu_la_LIBADD = ../libdrm.la @PTHREADSTUBS_LIBS@
-+libdrm_amdgpu_la_LIBADD = ../libdrm.la @PTHREADSTUBS_LIBS@ @ATOMIC_OPS_LIBS@
- 
- libdrm_amdgpu_la_SOURCES = $(LIBDRM_AMDGPU_FILES)
- amdgpu_asic_id.lo: $(top_srcdir)/data/amdgpu.ids
-diff --git a/configure.ac b/configure.ac
-index 35378b33..501d0871 100644
---- a/configure.ac
-+++ b/configure.ac
-@@ -247,7 +247,7 @@ AC_CACHE_CHECK([for native atomic primitives], drm_cv_atomic_primitives, [
- 					  ]],[[]])], [drm_cv_atomic_primitives="Intel"],[])
- 
- 	if test "x$drm_cv_atomic_primitives" = "xnone"; then
--		AC_CHECK_HEADER([atomic_ops.h], drm_cv_atomic_primitives="libatomic-ops")
-+		PKG_CHECK_MODULES(ATOMIC_OPS, [atomic_ops], drm_cv_atomic_primitives="libatomic-ops", true)
- 	fi
- 
- 	# atomic functions defined in <atomic.h> & libc on Solaris
-diff --git a/etnaviv/Makefile.am b/etnaviv/Makefile.am
-index be96ba86..669cf14f 100644
---- a/etnaviv/Makefile.am
-+++ b/etnaviv/Makefile.am
-@@ -12,7 +12,8 @@ libdrm_etnaviv_la_LDFLAGS = -version-number 1:0:0 -no-undefined
- libdrm_etnaviv_la_LIBADD = \
- 	../libdrm.la \
- 	@PTHREADSTUBS_LIBS@ \
--	@CLOCK_LIB@
-+	@CLOCK_LIB@ \
-+	@ATOMIC_OPS_LIBS@
- 
- libdrm_etnaviv_la_SOURCES = $(LIBDRM_ETNAVIV_FILES)
- 
-diff --git a/freedreno/Makefile.am b/freedreno/Makefile.am
-index cbb0d031..238407e3 100644
---- a/freedreno/Makefile.am
-+++ b/freedreno/Makefile.am
-@@ -14,7 +14,8 @@ libdrm_freedreno_la_LDFLAGS = -version-number 1:0:0 -no-undefined
- libdrm_freedreno_la_LIBADD = \
- 	../libdrm.la \
- 	@PTHREADSTUBS_LIBS@ \
--	@CLOCK_LIB@
-+	@CLOCK_LIB@ \
-+	@ATOMIC_OPS_LIBS@
- 
- libdrm_freedreno_la_SOURCES = $(LIBDRM_FREEDRENO_FILES)
- if HAVE_FREEDRENO_KGSL
-diff --git a/intel/Makefile.am b/intel/Makefile.am
-index c52e8c08..f3635a64 100644
---- a/intel/Makefile.am
-+++ b/intel/Makefile.am
-@@ -38,7 +38,8 @@ libdrm_intel_la_LDFLAGS = -version-number 1:0:0 -no-undefined
- libdrm_intel_la_LIBADD = ../libdrm.la \
- 	@PTHREADSTUBS_LIBS@ \
- 	@PCIACCESS_LIBS@ \
--	@CLOCK_LIB@
-+	@CLOCK_LIB@ \
-+	@ATOMIC_OPS_LIBS@
- 
- libdrm_intel_la_SOURCES = $(LIBDRM_INTEL_FILES)
- 
-diff --git a/nouveau/Makefile.am b/nouveau/Makefile.am
-index 344a8445..a4e6a78b 100644
---- a/nouveau/Makefile.am
-+++ b/nouveau/Makefile.am
-@@ -10,7 +10,7 @@ AM_CFLAGS = \
- libdrm_nouveau_la_LTLIBRARIES = libdrm_nouveau.la
- libdrm_nouveau_ladir = $(libdir)
- libdrm_nouveau_la_LDFLAGS = -version-number 2:0:0 -no-undefined
--libdrm_nouveau_la_LIBADD = ../libdrm.la @PTHREADSTUBS_LIBS@
-+libdrm_nouveau_la_LIBADD = ../libdrm.la @PTHREADSTUBS_LIBS@ @ATOMIC_OPS_LIBS@
- 
- libdrm_nouveau_la_SOURCES = $(LIBDRM_NOUVEAU_FILES)
- 
-diff --git a/omap/Makefile.am b/omap/Makefile.am
-index 599bb9de..524afee3 100644
---- a/omap/Makefile.am
-+++ b/omap/Makefile.am
-@@ -7,7 +7,7 @@ AM_CFLAGS = \
- libdrm_omap_la_LTLIBRARIES = libdrm_omap.la
- libdrm_omap_ladir = $(libdir)
- libdrm_omap_la_LDFLAGS = -version-number 1:0:0 -no-undefined
--libdrm_omap_la_LIBADD = ../libdrm.la @PTHREADSTUBS_LIBS@
-+libdrm_omap_la_LIBADD = ../libdrm.la @PTHREADSTUBS_LIBS@ @ATOMIC_OPS_LIBS@
- 
- libdrm_omap_la_SOURCES = omap_drm.c
- 
-diff --git a/radeon/Makefile.am b/radeon/Makefile.am
-index e2415314..c27d3c75 100644
---- a/radeon/Makefile.am
-+++ b/radeon/Makefile.am
-@@ -33,7 +33,7 @@ AM_CFLAGS = \
- libdrm_radeon_la_LTLIBRARIES = libdrm_radeon.la
- libdrm_radeon_ladir = $(libdir)
- libdrm_radeon_la_LDFLAGS = -version-number 1:0:1 -no-undefined
--libdrm_radeon_la_LIBADD = ../libdrm.la @PTHREADSTUBS_LIBS@
-+libdrm_radeon_la_LIBADD = ../libdrm.la @PTHREADSTUBS_LIBS@ @ATOMIC_OPS_LIBS@
- 
- libdrm_radeon_la_SOURCES = $(LIBDRM_RADEON_FILES)
- 
-diff --git a/tegra/Makefile.am b/tegra/Makefile.am
-index fb40be55..12abe8c4 100644
---- a/tegra/Makefile.am
-+++ b/tegra/Makefile.am
-@@ -9,7 +9,7 @@ AM_CFLAGS = \
- libdrm_tegra_ladir = $(libdir)
- libdrm_tegra_la_LTLIBRARIES = libdrm_tegra.la
- libdrm_tegra_la_LDFLAGS = -version-number 0:0:0 -no-undefined
--libdrm_tegra_la_LIBADD = ../libdrm.la @PTHREADSTUBS_LIBS@
-+libdrm_tegra_la_LIBADD = ../libdrm.la @PTHREADSTUBS_LIBS@ @ATOMIC_OPS_LIBS@
- 
- libdrm_tegra_la_SOURCES = \
- 	private.h \
--- 
-2.14.3
-
package/libdrm/libdrm.mk +32 -39
index 06b1144616..65ed01bb16 100644
@@ -10,111 +10,104 @@ LIBDRM_SITE = https://dri.freedesktop.org/libdrm
 LIBDRM_LICENSE = MIT
 LIBDRM_INSTALL_STAGING = YES
 
-# patch 0003-configure-Makefile.am-use-pkg-config-to-discover-lib.patch
-# touching configure.ac/Makefile.am (and host-xutil_util-macros dependency)
-LIBDRM_AUTORECONF = YES
-
 LIBDRM_DEPENDENCIES = \
 	libpthread-stubs \
-	host-pkgconf \
-	host-xutil_util-macros
+	host-pkgconf
 
 LIBDRM_CONF_OPTS = \
-	--disable-cairo-tests \
-	--disable-manpages
-
-LIBDRM_CONF_ENV = ac_cv_prog_cc_c99='-std=gnu99'
+	-Dcairo-tests=false \
+	-Dmanpages=false
 
 ifeq ($(BR2_PACKAGE_LIBATOMIC_OPS),y)
 LIBDRM_DEPENDENCIES += libatomic_ops
 ifeq ($(BR2_sparc_v8)$(BR2_sparc_leon3),y)
-LIBDRM_CONF_ENV += CFLAGS="$(TARGET_CFLAGS) -DAO_NO_SPARC_V9"
+LIBDRM_MESON_CFLAGS += "\"-DAO_NO_SPARC_V9\","
 endif
 endif
 
 ifeq ($(BR2_PACKAGE_LIBDRM_INTEL),y)
-LIBDRM_CONF_OPTS += --enable-intel
+LIBDRM_CONF_OPTS += -Dintel=true
 LIBDRM_DEPENDENCIES += libpciaccess
 else
-LIBDRM_CONF_OPTS += --disable-intel
+LIBDRM_CONF_OPTS += -Dintel=false
 endif
 
 ifeq ($(BR2_PACKAGE_LIBDRM_RADEON),y)
-LIBDRM_CONF_OPTS += --enable-radeon
+LIBDRM_CONF_OPTS += -Dradeon=true
 else
-LIBDRM_CONF_OPTS += --disable-radeon
+LIBDRM_CONF_OPTS += -Dradeon=false
 endif
 
 ifeq ($(BR2_PACKAGE_LIBDRM_AMDGPU),y)
-LIBDRM_CONF_OPTS += --enable-amdgpu
+LIBDRM_CONF_OPTS += -Damdgpu=true
 else
-LIBDRM_CONF_OPTS += --disable-amdgpu
+LIBDRM_CONF_OPTS += -Damdgpu=false
 endif
 
 ifeq ($(BR2_PACKAGE_LIBDRM_NOUVEAU),y)
-LIBDRM_CONF_OPTS += --enable-nouveau
+LIBDRM_CONF_OPTS += -Dnouveau=true
 else
-LIBDRM_CONF_OPTS += --disable-nouveau
+LIBDRM_CONF_OPTS += -Dnouveau=false
 endif
 
 ifeq ($(BR2_PACKAGE_LIBDRM_VMWGFX),y)
-LIBDRM_CONF_OPTS += --enable-vmwgfx
+LIBDRM_CONF_OPTS += -Dvmwgfx=true
 else
-LIBDRM_CONF_OPTS += --disable-vmwgfx
+LIBDRM_CONF_OPTS += -Dvmwgfx=false
 endif
 
 ifeq ($(BR2_PACKAGE_LIBDRM_OMAP),y)
-LIBDRM_CONF_OPTS += --enable-omap-experimental-api
+LIBDRM_CONF_OPTS += -Domap=true
 else
-LIBDRM_CONF_OPTS += --disable-omap-experimental-api
+LIBDRM_CONF_OPTS += -Domap=false
 endif
 
 ifeq ($(BR2_PACKAGE_LIBDRM_ETNAVIV),y)
-LIBDRM_CONF_OPTS += --enable-etnaviv-experimental-api
+LIBDRM_CONF_OPTS += -Detnaviv=true
 else
-LIBDRM_CONF_OPTS += --disable-etnaviv-experimental-api
+LIBDRM_CONF_OPTS += -Detnaviv=false
 endif
 
 ifeq ($(BR2_PACKAGE_LIBDRM_EXYNOS),y)
-LIBDRM_CONF_OPTS += --enable-exynos-experimental-api
+LIBDRM_CONF_OPTS += -Dexynos=true
 else
-LIBDRM_CONF_OPTS += --disable-exynos-experimental-api
+LIBDRM_CONF_OPTS += -Dexynos=false
 endif
 
 ifeq ($(BR2_PACKAGE_LIBDRM_FREEDRENO),y)
-LIBDRM_CONF_OPTS += --enable-freedreno
+LIBDRM_CONF_OPTS += -Dfreedreno=true
 else
-LIBDRM_CONF_OPTS += --disable-freedreno
+LIBDRM_CONF_OPTS += -Dfreedreno=false
 endif
 
 ifeq ($(BR2_PACKAGE_LIBDRM_TEGRA),y)
-LIBDRM_CONF_OPTS += --enable-tegra-experimental-api
+LIBDRM_CONF_OPTS += -Dtegra=true
 else
-LIBDRM_CONF_OPTS += --disable-tegra-experimental-api
+LIBDRM_CONF_OPTS += -Dtegra=false
 endif
 
 ifeq ($(BR2_PACKAGE_LIBDRM_VC4),y)
-LIBDRM_CONF_OPTS += --enable-vc4
+LIBDRM_CONF_OPTS += -Dvc4=true
 else
-LIBDRM_CONF_OPTS += --disable-vc4
+LIBDRM_CONF_OPTS += -Dvc4=false
 endif
 
 ifeq ($(BR2_PACKAGE_HAS_UDEV),y)
-LIBDRM_CONF_OPTS += --enable-udev
+LIBDRM_CONF_OPTS += -Dudev=true
 LIBDRM_DEPENDENCIES += udev
 else
-LIBDRM_CONF_OPTS += --disable-udev
+LIBDRM_CONF_OPTS += -Dudev=false
 endif
 
 ifeq ($(BR2_PACKAGE_VALGRIND),y)
-LIBDRM_CONF_OPTS += --enable-valgrind
+LIBDRM_CONF_OPTS += -Dvalgrind=true
 LIBDRM_DEPENDENCIES += valgrind
 else
-LIBDRM_CONF_OPTS += --disable-valgrind
+LIBDRM_CONF_OPTS += -Dvalgrind=false
 endif
 
 ifeq ($(BR2_PACKAGE_LIBDRM_INSTALL_TESTS),y)
-LIBDRM_CONF_OPTS += --enable-install-test-programs
+LIBDRM_CONF_OPTS += -Dinstall-test-programs=true
 endif
 
-$(eval $(autotools-package))
+$(eval $(meson-package))
#8 lore raw

RFC 2/2 libdrm: change to meson build system

Hello *,

Quoted 36 lines · Peter Seiderer

package/libdrm/0003-configure-Makefile.am-use-pkg-config-to-discover-lib.patch

Quoted 17 lines · Peter Seiderer

---
Notes:
- convertion from "LIBDRM_CONF_ENV = ac_cv_prog_cc_c99='-std=gnu99'" is missing (maybe meson gets it right (?) or use LIBDRM_MESON_CFLAGS to force it)

---
 ...le.am-use-pkg-config-to-discover-lib.patch | 162 ------------------
 package/libdrm/libdrm.mk                      |  71 ++++----
 2 files changed, 32 insertions(+), 201 deletions(-)
 delete mode 100644 package/libdrm/0003-configure-Makefile.am-use-pkg-config-to-discover-lib.patch
package/libdrm/0003-configure-Makefile.am-use-pkg-config-to-discover-lib.patch deleted +0 -0
deleted file mode 100644
index 0fbe77ef7c..0000000000

Needs substitute patch for this one, the build of the following defconfig failes (again) with meson:

.../host/bin/sparc-linux-gcc -o etnaviv/libdrm_etnaviv.so.1.0.0 'etnaviv/etnaviv@@drm_etnaviv at sha/etnaviv_device.c.o' 'etnaviv/etnaviv@@drm_etnaviv at sha/etnaviv_gpu.c.o' 'etnaviv/etnaviv@@drm_etnaviv at sha/etnaviv_bo.c.o' 'etnaviv/etnaviv@@drm_etnaviv at sha/etnaviv_bo_cache.c.o' 'etnaviv/etnaviv@@drm_etnaviv at sha/etnaviv_perfmon.c.o' 'etnaviv/etnaviv@@drm_etnaviv at sha/etnaviv_pipe.c.o' 'etnaviv/etnaviv@@drm_etnaviv at sha/etnaviv_cmd_stream.c.o' -Wl,--no-undefined -Wl,--as-needed -shared -fPIC -Wl,--start-group -Wl,-soname,libdrm_etnaviv.so.1 libdrm.so.2.4.0 -Wl,--end-group '-Wl,-rpath,$ORIGIN/..' -Wl,-rpath-link,.../build/libdrm-2.4.92/build/ etnaviv/etnaviv@@drm_etnaviv at sha/etnaviv_device.c.o: In function `etna_device_ref':
.../build/libdrm-2.4.92/build/../etnaviv/etnaviv_device.c:77: undefined reference to `__sync_fetch_and_add_4'
etnaviv/etnaviv@@drm_etnaviv at sha/etnaviv_device.c.o: In function `etna_device_del_locked':
.../build/libdrm-2.4.92/build/../etnaviv/etnaviv_device.c:96: undefined reference to `__sync_add_and_fetch_4'
etnaviv/etnaviv@@drm_etnaviv at sha/etnaviv_device.c.o: In function `etna_device_del':
.../build/libdrm-2.4.92/build/../etnaviv/etnaviv_device.c:104: undefined reference to `__sync_add_and_fetch_4'
etnaviv/etnaviv@@drm_etnaviv at sha/etnaviv_bo.c.o: In function `etna_bo_ref':
.../build/libdrm-2.4.92/build/../etnaviv/etnaviv_bo.c:136: undefined reference to `__sync_fetch_and_add_4'
etnaviv/etnaviv@@drm_etnaviv at sha/etnaviv_bo.c.o: In function `etna_bo_del':
.../build/libdrm-2.4.92/build/../etnaviv/etnaviv_bo.c:241: undefined reference to `__sync_add_and_fetch_4'
collect2: error: ld returned 1 exit status

Quoted 15 lines

BR2_sparc=y
BR2_ENABLE_DEBUG=y
BR2_TOOLCHAIN_EXTERNAL=y
BR2_TOOLCHAIN_EXTERNAL_DOWNLOAD=y BR2_TOOLCHAIN_EXTERNAL_URL="http://autobuild.buildroot.org/toolchains/tarballs/br-sparc-uclibc-2017.11-rc1.tar.bz2" BR2_TOOLCHAIN_EXTERNAL_GCC_6=y
BR2_TOOLCHAIN_EXTERNAL_HEADERS_4_1=y
BR2_TOOLCHAIN_EXTERNAL_LOCALE=y
# BR2_TOOLCHAIN_EXTERNAL_HAS_THREADS_DEBUG is not set
BR2_TOOLCHAIN_EXTERNAL_CXX=y
BR2_SYSTEM_BIN_SH_NONE=y
BR2_PACKAGE_LIBDRM=y
BR2_PACKAGE_LIBDRM_NOUVEAU=y
BR2_PACKAGE_LIBDRM_ETNAVIV=y

The Problem fixed by 0003-configure-Makefile.am-use-pkg-config-to-discover-lib.patch was (see [1]):

../../etnaviv/.libs/libdrm_etnaviv.so: undefined reference to AO_store_full_emulation' ../../etnaviv/.libs/libdrm_etnaviv.so: undefined reference to AO_fetch_compare_and_swap_emulation'
collect2: error: ld returned 1 exit status

This one is a new one, maybe result of different config.h, from the autoconf one:

	$ grep ATOMIC build/libdrm-2.4.92/config.h
#define HAVE_LIBDRM_ATOMIC_PRIMITIVES 0
#define HAVE_LIB_ATOMIC_OPS 1

From the meson one:

	$ grep ATOMIC build/libdrm-2.4.92/build/config.h 
#define HAVE_LIBDRM_ATOMIC_PRIMITIVES 1
#define HAVE_LIB_ATOMIC_OPS 0

Regards,
Peter

[1] http://autobuild.buildroot.net/results/92e074c49417261843eef95872ff935a56077c98/build-end.log

Quoted 319 lines

Regards,
Peter

Quoted 301 lines
package/libdrm/0003-configure-Makefile.am-use-pkg-config-to-discover-lib.patch deleted +0 -162
@@ -1,162 +0,0 @@
-From 57d544ff2f96a26cac07d5be00ff7b67678ae7b8 Mon Sep 17 00:00:00 2001
-From: Thomas Petazzoni <[email protected]>
-Date: Mon, 18 Dec 2017 13:08:39 +0100
-Subject: [PATCH] configure/Makefile.am: use pkg-config to discover
- libatomic_ops
-
-The configure script currently tests the availability of libatomic_ops
-by checking the presence of atomic_ops.h. While this is good enough as
-an availability test, it is not sufficient as on some platforms,
-libatomic_ops provides an actual shared library against which we
-should be linked to access libatomic_ops functionality.
-
-Therefore, we instead use PKG_CHECK_MODULES() to test the availability
-of libatomic_ops. Besides testing its availability, this also fills in
-the ATOMIC_OPS_LIBS variable with the list of libraries we need to
-link with to use libatomic_ops.
-
-All Mesa drivers that include xf86atomic.h have been updated to link
-against ATOMIC_OPS_LIBS.
-
-Of course, if we're not using libatomic_ops, ATOMIC_OPS_LIBS is empty,
-and we don't link against it.
-
-Signed-off-by: Thomas Petazzoni <[email protected]>
-Signed-off-by: Peter Seiderer <[email protected]>
-[Bernd: PKG_CHECK_MODULES should not fail when libatomic_ops is missing]
-Signed-off-by: Bernd Kuhls <[email protected]>
----
- amdgpu/Makefile.am    | 2 +-
- configure.ac          | 2 +-
- etnaviv/Makefile.am   | 3 ++-
- freedreno/Makefile.am | 3 ++-
- intel/Makefile.am     | 3 ++-
- nouveau/Makefile.am   | 2 +-
- omap/Makefile.am      | 2 +-
- radeon/Makefile.am    | 2 +-
- tegra/Makefile.am     | 2 +-
- 9 files changed, 12 insertions(+), 9 deletions(-)
-
-diff --git a/amdgpu/Makefile.am b/amdgpu/Makefile.am
-index a1b0d05c..b2bcceff 100644
---- a/amdgpu/Makefile.am
-+++ b/amdgpu/Makefile.am
-@@ -36,7 +36,7 @@ AM_CPPFLAGS = -DAMDGPU_ASIC_ID_TABLE=\"${libdrmdatadir}/amdgpu.ids\"
- libdrm_amdgpu_la_LTLIBRARIES = libdrm_amdgpu.la
- libdrm_amdgpu_ladir = $(libdir)
- libdrm_amdgpu_la_LDFLAGS = -version-number 1:0:0 -no-undefined
--libdrm_amdgpu_la_LIBADD = ../libdrm.la @PTHREADSTUBS_LIBS@
-+libdrm_amdgpu_la_LIBADD = ../libdrm.la @PTHREADSTUBS_LIBS@ @ATOMIC_OPS_LIBS@
- 
- libdrm_amdgpu_la_SOURCES = $(LIBDRM_AMDGPU_FILES)
- amdgpu_asic_id.lo: $(top_srcdir)/data/amdgpu.ids
-diff --git a/configure.ac b/configure.ac
-index 35378b33..501d0871 100644
---- a/configure.ac
-+++ b/configure.ac
-@@ -247,7 +247,7 @@ AC_CACHE_CHECK([for native atomic primitives], drm_cv_atomic_primitives, [
- 					  ]],[[]])], [drm_cv_atomic_primitives="Intel"],[])
- 
- 	if test "x$drm_cv_atomic_primitives" = "xnone"; then
--		AC_CHECK_HEADER([atomic_ops.h], drm_cv_atomic_primitives="libatomic-ops")
-+		PKG_CHECK_MODULES(ATOMIC_OPS, [atomic_ops], drm_cv_atomic_primitives="libatomic-ops", true)
- 	fi
- 
- 	# atomic functions defined in <atomic.h> & libc on Solaris
-diff --git a/etnaviv/Makefile.am b/etnaviv/Makefile.am
-index be96ba86..669cf14f 100644
---- a/etnaviv/Makefile.am
-+++ b/etnaviv/Makefile.am
-@@ -12,7 +12,8 @@ libdrm_etnaviv_la_LDFLAGS = -version-number 1:0:0 -no-undefined
- libdrm_etnaviv_la_LIBADD = \
- 	../libdrm.la \
- 	@PTHREADSTUBS_LIBS@ \
--	@CLOCK_LIB@
-+	@CLOCK_LIB@ \
-+	@ATOMIC_OPS_LIBS@
- 
- libdrm_etnaviv_la_SOURCES = $(LIBDRM_ETNAVIV_FILES)
- 
-diff --git a/freedreno/Makefile.am b/freedreno/Makefile.am
-index cbb0d031..238407e3 100644
---- a/freedreno/Makefile.am
-+++ b/freedreno/Makefile.am
-@@ -14,7 +14,8 @@ libdrm_freedreno_la_LDFLAGS = -version-number 1:0:0 -no-undefined
- libdrm_freedreno_la_LIBADD = \
- 	../libdrm.la \
- 	@PTHREADSTUBS_LIBS@ \
--	@CLOCK_LIB@
-+	@CLOCK_LIB@ \
-+	@ATOMIC_OPS_LIBS@
- 
- libdrm_freedreno_la_SOURCES = $(LIBDRM_FREEDRENO_FILES)
- if HAVE_FREEDRENO_KGSL
-diff --git a/intel/Makefile.am b/intel/Makefile.am
-index c52e8c08..f3635a64 100644
---- a/intel/Makefile.am
-+++ b/intel/Makefile.am
-@@ -38,7 +38,8 @@ libdrm_intel_la_LDFLAGS = -version-number 1:0:0 -no-undefined
- libdrm_intel_la_LIBADD = ../libdrm.la \
- 	@PTHREADSTUBS_LIBS@ \
- 	@PCIACCESS_LIBS@ \
--	@CLOCK_LIB@
-+	@CLOCK_LIB@ \
-+	@ATOMIC_OPS_LIBS@
- 
- libdrm_intel_la_SOURCES = $(LIBDRM_INTEL_FILES)
- 
-diff --git a/nouveau/Makefile.am b/nouveau/Makefile.am
-index 344a8445..a4e6a78b 100644
---- a/nouveau/Makefile.am
-+++ b/nouveau/Makefile.am
-@@ -10,7 +10,7 @@ AM_CFLAGS = \
- libdrm_nouveau_la_LTLIBRARIES = libdrm_nouveau.la
- libdrm_nouveau_ladir = $(libdir)
- libdrm_nouveau_la_LDFLAGS = -version-number 2:0:0 -no-undefined
--libdrm_nouveau_la_LIBADD = ../libdrm.la @PTHREADSTUBS_LIBS@
-+libdrm_nouveau_la_LIBADD = ../libdrm.la @PTHREADSTUBS_LIBS@ @ATOMIC_OPS_LIBS@
- 
- libdrm_nouveau_la_SOURCES = $(LIBDRM_NOUVEAU_FILES)
- 
-diff --git a/omap/Makefile.am b/omap/Makefile.am
-index 599bb9de..524afee3 100644
---- a/omap/Makefile.am
-+++ b/omap/Makefile.am
-@@ -7,7 +7,7 @@ AM_CFLAGS = \
- libdrm_omap_la_LTLIBRARIES = libdrm_omap.la
- libdrm_omap_ladir = $(libdir)
- libdrm_omap_la_LDFLAGS = -version-number 1:0:0 -no-undefined
--libdrm_omap_la_LIBADD = ../libdrm.la @PTHREADSTUBS_LIBS@
-+libdrm_omap_la_LIBADD = ../libdrm.la @PTHREADSTUBS_LIBS@ @ATOMIC_OPS_LIBS@
- 
- libdrm_omap_la_SOURCES = omap_drm.c
- 
-diff --git a/radeon/Makefile.am b/radeon/Makefile.am
-index e2415314..c27d3c75 100644
---- a/radeon/Makefile.am
-+++ b/radeon/Makefile.am
-@@ -33,7 +33,7 @@ AM_CFLAGS = \
- libdrm_radeon_la_LTLIBRARIES = libdrm_radeon.la
- libdrm_radeon_ladir = $(libdir)
- libdrm_radeon_la_LDFLAGS = -version-number 1:0:1 -no-undefined
--libdrm_radeon_la_LIBADD = ../libdrm.la @PTHREADSTUBS_LIBS@
-+libdrm_radeon_la_LIBADD = ../libdrm.la @PTHREADSTUBS_LIBS@ @ATOMIC_OPS_LIBS@
- 
- libdrm_radeon_la_SOURCES = $(LIBDRM_RADEON_FILES)
- 
-diff --git a/tegra/Makefile.am b/tegra/Makefile.am
-index fb40be55..12abe8c4 100644
---- a/tegra/Makefile.am
-+++ b/tegra/Makefile.am
-@@ -9,7 +9,7 @@ AM_CFLAGS = \
- libdrm_tegra_ladir = $(libdir)
- libdrm_tegra_la_LTLIBRARIES = libdrm_tegra.la
- libdrm_tegra_la_LDFLAGS = -version-number 0:0:0 -no-undefined
--libdrm_tegra_la_LIBADD = ../libdrm.la @PTHREADSTUBS_LIBS@
-+libdrm_tegra_la_LIBADD = ../libdrm.la @PTHREADSTUBS_LIBS@ @ATOMIC_OPS_LIBS@
- 
- libdrm_tegra_la_SOURCES = \
- 	private.h \
--- 
-2.14.3
-
package/libdrm/libdrm.mk +29 -37
index 06b1144616..65ed01bb16 100644
@@ -10,111 +10,104 @@ LIBDRM_SITE = https://dri.freedesktop.org/libdrm
 LIBDRM_LICENSE = MIT
 LIBDRM_INSTALL_STAGING = YES
 
-# patch 0003-configure-Makefile.am-use-pkg-config-to-discover-lib.patch
-# touching configure.ac/Makefile.am (and host-xutil_util-macros dependency)
-LIBDRM_AUTORECONF = YES
-
 LIBDRM_DEPENDENCIES = \
 	libpthread-stubs \
-	host-pkgconf \
-	host-xutil_util-macros
+	host-pkgconf
 
 LIBDRM_CONF_OPTS = \
-	--disable-cairo-tests \
-	--disable-manpages
-
-LIBDRM_CONF_ENV = ac_cv_prog_cc_c99='-std=gnu99'
+	-Dcairo-tests=false \
+	-Dmanpages=false
 
 ifeq ($(BR2_PACKAGE_LIBATOMIC_OPS),y)
 LIBDRM_DEPENDENCIES += libatomic_ops
 ifeq ($(BR2_sparc_v8)$(BR2_sparc_leon3),y)
-LIBDRM_CONF_ENV += CFLAGS="$(TARGET_CFLAGS) -DAO_NO_SPARC_V9"
+LIBDRM_MESON_CFLAGS += "\"-DAO_NO_SPARC_V9\","
 endif
 endif
 
 ifeq ($(BR2_PACKAGE_LIBDRM_INTEL),y)
-LIBDRM_CONF_OPTS += --enable-intel
+LIBDRM_CONF_OPTS += -Dintel=true
 LIBDRM_DEPENDENCIES += libpciaccess
 else
-LIBDRM_CONF_OPTS += --disable-intel
+LIBDRM_CONF_OPTS += -Dintel=false
 endif
 
 ifeq ($(BR2_PACKAGE_LIBDRM_RADEON),y)
-LIBDRM_CONF_OPTS += --enable-radeon
+LIBDRM_CONF_OPTS += -Dradeon=true
 else
-LIBDRM_CONF_OPTS += --disable-radeon
+LIBDRM_CONF_OPTS += -Dradeon=false
 endif
 
 ifeq ($(BR2_PACKAGE_LIBDRM_AMDGPU),y)
-LIBDRM_CONF_OPTS += --enable-amdgpu
+LIBDRM_CONF_OPTS += -Damdgpu=true
 else
-LIBDRM_CONF_OPTS += --disable-amdgpu
+LIBDRM_CONF_OPTS += -Damdgpu=false
 endif
 
 ifeq ($(BR2_PACKAGE_LIBDRM_NOUVEAU),y)
-LIBDRM_CONF_OPTS += --enable-nouveau
+LIBDRM_CONF_OPTS += -Dnouveau=true
 else
-LIBDRM_CONF_OPTS += --disable-nouveau
+LIBDRM_CONF_OPTS += -Dnouveau=false
 endif
 
 ifeq ($(BR2_PACKAGE_LIBDRM_VMWGFX),y)
-LIBDRM_CONF_OPTS += --enable-vmwgfx
+LIBDRM_CONF_OPTS += -Dvmwgfx=true
 else
-LIBDRM_CONF_OPTS += --disable-vmwgfx
+LIBDRM_CONF_OPTS += -Dvmwgfx=false
 endif
 
 ifeq ($(BR2_PACKAGE_LIBDRM_OMAP),y)
-LIBDRM_CONF_OPTS += --enable-omap-experimental-api
+LIBDRM_CONF_OPTS += -Domap=true
 else
-LIBDRM_CONF_OPTS += --disable-omap-experimental-api
+LIBDRM_CONF_OPTS += -Domap=false
 endif
 
 ifeq ($(BR2_PACKAGE_LIBDRM_ETNAVIV),y)
-LIBDRM_CONF_OPTS += --enable-etnaviv-experimental-api
+LIBDRM_CONF_OPTS += -Detnaviv=true
 else
-LIBDRM_CONF_OPTS += --disable-etnaviv-experimental-api
+LIBDRM_CONF_OPTS += -Detnaviv=false
 endif
 
 ifeq ($(BR2_PACKAGE_LIBDRM_EXYNOS),y)
-LIBDRM_CONF_OPTS += --enable-exynos-experimental-api
+LIBDRM_CONF_OPTS += -Dexynos=true
 else
-LIBDRM_CONF_OPTS += --disable-exynos-experimental-api
+LIBDRM_CONF_OPTS += -Dexynos=false
 endif
 
 ifeq ($(BR2_PACKAGE_LIBDRM_FREEDRENO),y)
-LIBDRM_CONF_OPTS += --enable-freedreno
+LIBDRM_CONF_OPTS += -Dfreedreno=true
 else
-LIBDRM_CONF_OPTS += --disable-freedreno
+LIBDRM_CONF_OPTS += -Dfreedreno=false
 endif
 
 ifeq ($(BR2_PACKAGE_LIBDRM_TEGRA),y)
-LIBDRM_CONF_OPTS += --enable-tegra-experimental-api
+LIBDRM_CONF_OPTS += -Dtegra=true
 else
-LIBDRM_CONF_OPTS += --disable-tegra-experimental-api
+LIBDRM_CONF_OPTS += -Dtegra=false
 endif
 
 ifeq ($(BR2_PACKAGE_LIBDRM_VC4),y)
-LIBDRM_CONF_OPTS += --enable-vc4
+LIBDRM_CONF_OPTS += -Dvc4=true
 else
-LIBDRM_CONF_OPTS += --disable-vc4
+LIBDRM_CONF_OPTS += -Dvc4=false
 endif
 
 ifeq ($(BR2_PACKAGE_HAS_UDEV),y)
-LIBDRM_CONF_OPTS += --enable-udev
+LIBDRM_CONF_OPTS += -Dudev=true
 LIBDRM_DEPENDENCIES += udev
 else
-LIBDRM_CONF_OPTS += --disable-udev
+LIBDRM_CONF_OPTS += -Dudev=false
 endif
 
 ifeq ($(BR2_PACKAGE_VALGRIND),y)
-LIBDRM_CONF_OPTS += --enable-valgrind
+LIBDRM_CONF_OPTS += -Dvalgrind=true
 LIBDRM_DEPENDENCIES += valgrind
 else
-LIBDRM_CONF_OPTS += --disable-valgrind

package/libdrm/libdrm.mk LIBDRM_SITE = https://dri.freedesktop.org/libdrm · line 113

Quoted 10 lines
package/libdrm/libdrm.mk +3 -2
+LIBDRM_CONF_OPTS += -Dvalgrind=false
 endif
 
 ifeq ($(BR2_PACKAGE_LIBDRM_INSTALL_TESTS),y)
-LIBDRM_CONF_OPTS += --enable-install-test-programs
+LIBDRM_CONF_OPTS += -Dinstall-test-programs=true
 endif
 
-$(eval $(autotools-package))
+$(eval $(meson-package))  

_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot

#9 lore raw

RFC 2/2 libdrm: change to meson build system

In reply to Peter Seiderer

Am Fri, 13 Jul 2018 22:58:01 +0200 schrieb Peter Seiderer:

Quoted 2 lines
package/libdrm/libdrm.mk +0 -0

[..]

Quoted 2 lines

-$(eval $(autotools-package))
+$(eval $(meson-package))

Hi Peter,

last year I sent a patch to switch libpng from autotools to cmake:
http://lists.busybox.net/pipermail/buildroot/2017-September/201303.html

The patch was rejected by Yann
http://lists.busybox.net/pipermail/buildroot/2017-September/201305.html

Quoted 5 lines

If upstream has changed, or there is a *compelling* reason to switch, then so be it. In this case, the commit log *must* explain the rationale for switching.

But switching for the sake of switching is a big no-no from me.

and Thomas
http://lists.busybox.net/pipermail/buildroot/2017-September/201307.html

Quoted 3 lines

I agree that there needs to be an explanation for the switch. Is upstream moving to CMake, and getting rid of autotools support in the future ? Other reason ?

From the current discussion of your RFC I am unable to see the "*compelling* reason" for using meson. Instead the mess around python2/ python3 imho does not justify the few seconds libdrm itself will build faster, so NACK.

Regards, Bernd

#10 lore raw

RFC 2/2 libdrm: change to meson build system

Hello,

Quoted 6 lines · Bernd Kuhls
Quoted 3 lines

I agree that there needs to be an explanation for the switch. Is upstream moving to CMake, and getting rid of autotools support in the future ? Other reason ?

From the current discussion of your RFC I am unable to see the "*compelling* reason" for using meson.

I think it all depends on upstream's strategy. Are they adding meson just as an alternate build system and intend to keep autotools, or are they adding meson with the plan of phasing out and removing autotools based build ?

In the latter case, then switching to meson definitely makes sense.

Quoted 2 lines

Instead the mess around python2/python3 imho does not justify the few seconds libdrm itself will build faster, so NACK.

The python2/python3 mess has nothing to do with libdrm, it's an existing and separate meson support issue, which we already have for other packages using the meson build system.

However, I agree that the need to build host-python3 to build meson packages is really annoying :-/

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.com
#11 lore raw

RFC 2/2 libdrm: change to meson build system

In reply to Bernd Kuhls

Hello Bernd,

Quoted 25 lines · Bernd Kuhls

Am Fri, 13 Jul 2018 22:58:01 +0200 schrieb Peter Seiderer:

Quoted 2 lines
package/libdrm/libdrm.mk +0 -0

[..]

Quoted 2 lines

-$(eval $(autotools-package))
+$(eval $(meson-package))

Hi Peter,

last year I sent a patch to switch libpng from autotools to cmake:
http://lists.busybox.net/pipermail/buildroot/2017-September/201303.html

The patch was rejected by Yann
http://lists.busybox.net/pipermail/buildroot/2017-September/201305.html

Quoted 5 lines

If upstream has changed, or there is a *compelling* reason to switch, then so be it. In this case, the commit log *must* explain the rationale for switching.

But switching for the sake of switching is a big no-no from me.

and Thomas
http://lists.busybox.net/pipermail/buildroot/2017-September/201307.html

Quoted 8 lines
Quoted 3 lines

I agree that there needs to be an explanation for the switch. Is upstream moving to CMake, and getting rid of autotools support in the future ? Other reason ?

From the current discussion of your RFC I am unable to see the "*compelling* reason" for using meson. Instead the mess around python2/ python3 imho does not justify the few seconds libdrm itself will build faster, so NACK.

....thats one of the reasons I send the patch set as RFC ;-), but the long term hope would be that the conversion of enough packages will give more time saving than the additonal python/python3/meson/ninja build-time...

Converting libdrm was by random choice (I knew it has meson build enabled and the options where simple enough)...

libinput is one of the packages which switched exclusivly to meson (since 1.9.x) and GStreamer folks are pushing the conversion to meson to gain VisualStudio compiles on Windows (and because of the build-time saving)...

Regards,
Peter

Quoted 7 lines

Regards, Bernd

_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot