All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH 1/2] meson: add entry for libgcrypt-config in cross file
@ 2019-04-03 18:32 Jörg Krause
  2019-04-03 18:32 ` [Buildroot] [PATCH 2/2] package/mpd: bump to version 0.21.7 Jörg Krause
                   ` (2 more replies)
  0 siblings, 3 replies; 21+ messages in thread
From: Jörg Krause @ 2019-04-03 18:32 UTC (permalink / raw)
  To: buildroot

Since version 0.49.0 the Meson build system has native support for
looking for `libgcrypt-config` if no pkg-config file is found. As the
latest version 1.8.4 of libgcrypt does not provide a .pc file, using
`libgcrypt-config` is the only way for detecting the required libraries
when linking agains libgrypt.

The `libgcrypt-config` entry is necessary for updating package mpd,
which switched from the Autotools to the Meson build system when bumping
from version 0.20 to 0.21.

Signed-off-by: J?rg Krause <joerg.krause@embedded.rocks>
---
 package/meson/cross-compilation.conf.in | 1 +
 package/meson/meson.mk                  | 1 +
 package/pkg-meson.mk                    | 1 +
 3 files changed, 3 insertions(+)

diff --git a/package/meson/cross-compilation.conf.in b/package/meson/cross-compilation.conf.in
index fc8e27f7eb..b68499a6fa 100644
--- a/package/meson/cross-compilation.conf.in
+++ b/package/meson/cross-compilation.conf.in
@@ -9,6 +9,7 @@ cpp = '@TARGET_CROSS at g++'
 ar = '@TARGET_CROSS at ar'
 strip = '@TARGET_CROSS at strip'
 pkgconfig = '@HOST_DIR@/usr/bin/pkg-config'
+libgcrypt-config = '@STAGING_DIR@/usr/bin/libgcrypt-config'
 
 [properties]
 needs_exe_wrapper = true
diff --git a/package/meson/meson.mk b/package/meson/meson.mk
index 49e27f5527..113ff058f7 100644
--- a/package/meson/meson.mk
+++ b/package/meson/meson.mk
@@ -61,6 +61,7 @@ define HOST_MESON_INSTALL_CROSS_CONF
 	    -e "s%@TARGET_LDFLAGS@%$(HOST_MESON_SED_LDFLAGS)%g" \
 	    -e "s%@TARGET_CXXFLAGS@%$(HOST_MESON_SED_CXXFLAGS)%g" \
 	    -e "s%@HOST_DIR@%$(HOST_DIR)%g" \
+	    -e "s%@STAGING_DIR@%$(STAGING_DIR)%g" \
 	    $(HOST_MESON_PKGDIR)/cross-compilation.conf.in \
 	    > $(HOST_DIR)/etc/meson/cross-compilation.conf
 endef
diff --git a/package/pkg-meson.mk b/package/pkg-meson.mk
index 886fcf7205..6ec45b8b82 100644
--- a/package/pkg-meson.mk
+++ b/package/pkg-meson.mk
@@ -71,6 +71,7 @@ define $(2)_CONFIGURE_CMDS
 	    -e "s%@TARGET_LDFLAGS@%$$(HOST_MESON_SED_LDFLAGS)%g" \
 	    -e "s%@TARGET_CXXFLAGS@%$$(HOST_MESON_SED_CXXFLAGS)%g" \
 	    -e "s%@HOST_DIR@%$$(HOST_DIR)%g" \
+	    -e "s%@STAGING_DIR@%$$(STAGING_DIR)%g" \
 	    package/meson/cross-compilation.conf.in \
 	    > $$($$(PKG)_SRCDIR)/build/cross-compilation.conf
 	PATH=$$(BR_PATH) $$($$(PKG)_CONF_ENV) $$(MESON) \
-- 
2.21.0

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [Buildroot] [PATCH 2/2] package/mpd: bump to version 0.21.7
  2019-04-03 18:32 [Buildroot] [PATCH 1/2] meson: add entry for libgcrypt-config in cross file Jörg Krause
@ 2019-04-03 18:32 ` Jörg Krause
  2019-04-03 19:33 ` [Buildroot] [PATCH 1/2] meson: add entry for libgcrypt-config in cross file Thomas Petazzoni
  2019-04-13 16:24 ` Thomas Petazzoni
  2 siblings, 0 replies; 21+ messages in thread
From: Jörg Krause @ 2019-04-03 18:32 UTC (permalink / raw)
  To: buildroot

MPD changed from Autotools to the Meson build system.

Add config options for the qobuz and tidal plugins and group them
together with the soundcloud plugin under "Commercial services".

Note, that MPD cannot be build with both Tremor (libvorbis soft float library)
and libvorbis (hard float library) support. Therefore, default to Tremor
on soft float targets and to libvorbis otherwise.

Signed-off-by: J?rg Krause <joerg.krause@embedded.rocks>
---
 ...gure.ac-check-if-libatomic-is-needed.patch |  40 ----
 package/mpd/Config.in                         |  36 +++-
 package/mpd/mpd.hash                          |   2 +-
 package/mpd/mpd.mk                            | 175 ++++++++++--------
 4 files changed, 121 insertions(+), 132 deletions(-)
 delete mode 100644 package/mpd/0001-configure.ac-check-if-libatomic-is-needed.patch

diff --git a/package/mpd/0001-configure.ac-check-if-libatomic-is-needed.patch b/package/mpd/0001-configure.ac-check-if-libatomic-is-needed.patch
deleted file mode 100644
index a9873a741f..0000000000
--- a/package/mpd/0001-configure.ac-check-if-libatomic-is-needed.patch
+++ /dev/null
@@ -1,40 +0,0 @@
-From 8eaf14a17244aaf000b4d19e4fde4a637576939f Mon Sep 17 00:00:00 2001
-From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
-Date: Sun, 7 Feb 2016 21:40:47 +0100
-Subject: [PATCH] configure.ac: check if libatomic is needed
-
-The mpd source code uses the C++11 <atomic> functionality, which
-internally is implemented using the __atomic_*() gcc built-ins. On
-certain architectures, the __atomic_*() built-ins are implemented in
-the libatomic library that comes with the rest of the gcc runtime. Due
-to this, code using <atomic> might need to link against libatomic,
-otherwise one hits build issues such as:
-
-GlobalEvents.cxx:(.text._ZN12GlobalEvents4EmitENS_5EventE+0x14): undefined reference to `__atomic_fetch_or_4'
-
-on an architecture like SPARC.
-
-To solve this, a configure.ac check is added to know if we need to
-link against libatomic or not.
-
-Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
----
- configure.ac | 2 ++
- 1 file changed, 2 insertions(+)
-
-diff --git a/configure.ac b/configure.ac
-index 107b45a..8e6fab7 100644
---- a/configure.ac
-+++ b/configure.ac
-@@ -233,6 +233,8 @@ if test x$have_pthread_setname_np = xyes; then
- 	AC_DEFINE(HAVE_PTHREAD_SETNAME_NP, 1, [Is pthread_setname_np() available?])
- fi
- 
-+AC_SEARCH_LIBS([__atomic_load_4], [atomic])
-+
- dnl ---------------------------------------------------------------------------
- dnl Event loop selection
- dnl ---------------------------------------------------------------------------
--- 
-2.6.4
-
diff --git a/package/mpd/Config.in b/package/mpd/Config.in
index d3844391a2..84108428ee 100644
--- a/package/mpd/Config.in
+++ b/package/mpd/Config.in
@@ -9,7 +9,6 @@ menuconfig BR2_PACKAGE_MPD
 	depends on !BR2_TOOLCHAIN_HAS_GCC_BUG_64735 # exception_ptr
 	select BR2_PACKAGE_BOOST
 	select BR2_PACKAGE_LIBICONV if !BR2_ENABLE_LOCALE
-	select BR2_PACKAGE_MPD_TREMOR if !(BR2_PACKAGE_MPD_MAD || BR2_PACKAGE_MPD_MPG123 || BR2_PACKAGE_MPD_VORBIS || BR2_PACKAGE_MPD_WAVPACK || BR2_PACKAGE_MPD_FLAC || BR2_PACKAGE_MPD_MUSEPACK || BR2_PACKAGE_MPD_FFMPEG)
 	help
 	  MPD is a flexible, powerful, server-side application
 	  for playing music. Through plugins and libraries
@@ -35,6 +34,29 @@ config BR2_PACKAGE_MPD_SQLITE
 	  Enable sqlite database support.
 	  If you don't use sqlite it will use an ASCII database.
 
+comment "Commercial services"
+
+config BR2_PACKAGE_MPD_QOBUZ
+	bool "qobuz"
+	select BR2_PACKAGE_MPD_CURL
+	select BR2_PACKAGE_LIBGCRYPT
+	select BR2_PACKAGE_YAJL
+	help
+	  Play songs from the commercial streaming service Qobuz.
+
+config BR2_PACKAGE_MPD_SOUNDCLOUD
+	bool "soundcloud"
+	select BR2_PACKAGE_YAJL
+	help
+	  Enable soundcloud.com playlist support.
+
+config BR2_PACKAGE_MPD_TIDAL
+	bool "tidal"
+	select BR2_PACKAGE_MPD_CURL
+	select BR2_PACKAGE_YAJL
+	help
+	  Play songs from the commercial streaming service TIDAL.
+
 comment "Converter plugins"
 
 config BR2_PACKAGE_MPD_LIBSAMPLERATE
@@ -132,18 +154,20 @@ config BR2_PACKAGE_MPD_OPUS
 	  Select this if you want to play back OPUS encoded files.
 
 config BR2_PACKAGE_MPD_TREMOR
-	bool "tremor"
+	bool "tremor" if BR2_SOFT_FLOAT
 	select BR2_PACKAGE_LIBOGG
 	select BR2_PACKAGE_TREMOR
+	default y if BR2_SOFT_FLOAT
 	help
 	  Enable vorbis input support.
 	  Select this if you want to play back OGG files on softfloat
 	  targets.
 
 config BR2_PACKAGE_MPD_VORBIS
-	bool "vorbis"
+	bool "vorbis" if !BR2_SOFT_FLOAT
 	select BR2_PACKAGE_LIBOGG
 	select BR2_PACKAGE_LIBVORBIS
+	default y if !BR2_SOFT_FLOAT
 	help
 	  Enable vorbis input/streaming support.
 	  Select this if you want to play back OGG files on hardfloat
@@ -217,12 +241,6 @@ config BR2_PACKAGE_MPD_LIBSMBCLIENT
 	help
 	  Enable Samba support.
 
-config BR2_PACKAGE_MPD_SOUNDCLOUD
-	bool "soundcloud"
-	select BR2_PACKAGE_YAJL
-	help
-	  Enable soundcloud.com playlist support.
-
 comment "Output plugins"
 
 config BR2_PACKAGE_MPD_ALSA
diff --git a/package/mpd/mpd.hash b/package/mpd/mpd.hash
index b80bfc82a4..cb9749cd52 100644
--- a/package/mpd/mpd.hash
+++ b/package/mpd/mpd.hash
@@ -1,3 +1,3 @@
 # Locally calculated after checking pgp signature
-sha256  503e5f9f237290f568ff7956ab2f9aed563594bf749f19b8fe994fb21434afea  mpd-0.20.23.tar.xz
+sha256  512062bc529bee04d4ccfaa2c6e720afc85bb071e49850a096b5ed518b3b412c  mpd-0.21.7.tar.xz
 sha256  ab15fd526bd8dd18a9e77ebc139656bf4d33e97fc7238cd11bf60e2b9b8666c6  COPYING
diff --git a/package/mpd/mpd.mk b/package/mpd/mpd.mk
index f410c1fd95..69bbfed941 100644
--- a/package/mpd/mpd.mk
+++ b/package/mpd/mpd.mk
@@ -4,8 +4,8 @@
 #
 ################################################################################
 
-MPD_VERSION_MAJOR = 0.20
-MPD_VERSION = $(MPD_VERSION_MAJOR).23
+MPD_VERSION_MAJOR = 0.21
+MPD_VERSION = $(MPD_VERSION_MAJOR).7
 MPD_SOURCE = mpd-$(MPD_VERSION).tar.xz
 MPD_SITE = http://www.musicpd.org/download/mpd/$(MPD_VERSION_MAJOR)
 MPD_DEPENDENCIES = host-pkgconf boost
@@ -13,270 +13,281 @@ MPD_LICENSE = GPL-2.0+
 MPD_LICENSE_FILES = COPYING
 MPD_AUTORECONF = YES
 
-# Some options need an explicit --disable or --enable
-
 # Zeroconf support depends on libdns_sd from avahi.
 ifeq ($(BR2_PACKAGE_MPD_AVAHI_SUPPORT),y)
 MPD_DEPENDENCIES += avahi
-MPD_CONF_OPTS += --with-zeroconf=avahi
+MPD_CONF_OPTS += -Dzeroconf=avahi
 else
-MPD_CONF_OPTS += --with-zeroconf=no
+MPD_CONF_OPTS += -Dzeroconf=disabled
 endif
 
 # MPD prefers libicu for utf8 collation instead of libglib2.
 ifeq ($(BR2_PACKAGE_ICU),y)
 MPD_DEPENDENCIES += icu
-MPD_CONF_OPTS += --enable-icu
+MPD_CONF_OPTS += -Dicu=enabled
 else
-MPD_CONF_OPTS += --disable-icu
+MPD_CONF_OPTS += -Dicu=disabled
 endif
 
 ifeq ($(BR2_PACKAGE_MPD_ALSA),y)
 MPD_DEPENDENCIES += alsa-lib
-MPD_CONF_OPTS += --enable-alsa
+MPD_CONF_OPTS += -Dalsa=enabled
 else
-MPD_CONF_OPTS += --disable-alsa
+MPD_CONF_OPTS += -Dalsa=disabled
 endif
 
 ifeq ($(BR2_PACKAGE_MPD_AO),y)
 MPD_DEPENDENCIES += libao
-MPD_CONF_OPTS += --enable-ao
+MPD_CONF_OPTS += -Dao=enabled
 else
-MPD_CONF_OPTS += --disable-ao
+MPD_CONF_OPTS += -Dao=disabled
 endif
 
 ifeq ($(BR2_PACKAGE_MPD_AUDIOFILE),y)
 MPD_DEPENDENCIES += audiofile
-MPD_CONF_OPTS += --enable-audiofile
+MPD_CONF_OPTS += -Daudiofile=enabled
 else
-MPD_CONF_OPTS += --disable-audiofile
+MPD_CONF_OPTS += -Daudiofile=disabled
 endif
 
 ifeq ($(BR2_PACKAGE_MPD_BZIP2),y)
 MPD_DEPENDENCIES += bzip2
-MPD_CONF_OPTS += --enable-bzip2
+MPD_CONF_OPTS += -Dbzip2=enabled
 else
-MPD_CONF_OPTS += --disable-bzip2
+MPD_CONF_OPTS += -Dbzip2=disabled
 endif
 
 ifeq ($(BR2_PACKAGE_MPD_CDIO_PARANOIA),y)
 MPD_DEPENDENCIES += libcdio-paranoia
-MPD_CONF_OPTS += --enable-cdio-paranoia
+MPD_CONF_OPTS += -Dcdio_paranoia=enabled
 else
-MPD_CONF_OPTS += --disable-cdio-paranoia
+MPD_CONF_OPTS += -Dcdio_paranoia=disabled
 endif
 
 ifeq ($(BR2_PACKAGE_MPD_CURL),y)
 MPD_DEPENDENCIES += libcurl
-MPD_CONF_OPTS += --enable-curl
+MPD_CONF_OPTS += -Dcurl=enabled
 else
-MPD_CONF_OPTS += --disable-curl
+MPD_CONF_OPTS += -Dcurl=disabled
 endif
 
 ifeq ($(BR2_PACKAGE_MPD_DSD),y)
-MPD_CONF_OPTS += --enable-dsd
+MPD_CONF_OPTS += -Ddsd=true
 else
-MPD_CONF_OPTS += --disable-dsd
+MPD_CONF_OPTS += -Ddsd=false
 endif
 
 ifeq ($(BR2_PACKAGE_MPD_FAAD2),y)
 MPD_DEPENDENCIES += faad2
-MPD_CONF_OPTS += --enable-aac
+MPD_CONF_OPTS += -Dfaad=enabled
 else
-MPD_CONF_OPTS += --disable-aac
+MPD_CONF_OPTS += -Dfaad=disabled
 endif
 
 ifeq ($(BR2_PACKAGE_MPD_FFMPEG),y)
 MPD_DEPENDENCIES += ffmpeg
-MPD_CONF_OPTS += --enable-ffmpeg
+MPD_CONF_OPTS += -Dffmpeg=enabled
 else
-MPD_CONF_OPTS += --disable-ffmpeg
+MPD_CONF_OPTS += -Dffmpeg=disabled
 endif
 
 ifeq ($(BR2_PACKAGE_MPD_FLAC),y)
 MPD_DEPENDENCIES += flac
-MPD_CONF_OPTS += --enable-flac
+MPD_CONF_OPTS += -Dflac=enabled
 else
-MPD_CONF_OPTS += --disable-flac
+MPD_CONF_OPTS += -Dflac=disabled
 endif
 
 ifeq ($(BR2_PACKAGE_MPD_HTTPD_OUTPUT),y)
-MPD_CONF_OPTS += --enable-httpd-output
+MPD_CONF_OPTS += -Dhttpd=true
 else
-MPD_CONF_OPTS += --disable-httpd-output
+MPD_CONF_OPTS += -Dhttpd=false
 endif
 
 ifeq ($(BR2_PACKAGE_MPD_JACK2),y)
 MPD_DEPENDENCIES += jack2
-MPD_CONF_OPTS += --enable-jack
+MPD_CONF_OPTS += -Djack=enabled
 else
-MPD_CONF_OPTS += --disable-jack
+MPD_CONF_OPTS += -Djack=disabled
 endif
 
 ifeq ($(BR2_PACKAGE_MPD_LAME),y)
 MPD_DEPENDENCIES += lame
-MPD_CONF_OPTS += --enable-lame-encoder
+MPD_CONF_OPTS += -Dlame=enabled
 else
-MPD_CONF_OPTS += --disable-lame-encoder
+MPD_CONF_OPTS += -Dlame=disabled
 endif
 
 ifeq ($(BR2_PACKAGE_MPD_LIBMPDCLIENT),y)
 MPD_DEPENDENCIES += libmpdclient
-MPD_CONF_OPTS += --enable-libmpdclient
+MPD_CONF_OPTS += -Dlibmpdclient=enabled
 else
-MPD_CONF_OPTS += --disable-libmpdclient
+MPD_CONF_OPTS += -Dlibmpdclient=disabled
 endif
 
 ifeq ($(BR2_PACKAGE_MPD_LIBMMS),y)
 MPD_DEPENDENCIES += libmms
-MPD_CONF_OPTS += --enable-mms
+MPD_CONF_OPTS += -Dmms=enabled
 else
-MPD_CONF_OPTS += --disable-mms
+MPD_CONF_OPTS += -Dmms=disabled
 endif
 
 ifeq ($(BR2_PACKAGE_MPD_LIBNFS),y)
 MPD_DEPENDENCIES += libnfs
-MPD_CONF_OPTS += --enable-nfs
+MPD_CONF_OPTS += -Dnfs=enabled
 else
-MPD_CONF_OPTS += --disable-nfs
+MPD_CONF_OPTS += -Dnfs=disabled
 endif
 
 ifeq ($(BR2_PACKAGE_MPD_LIBSMBCLIENT),y)
 MPD_DEPENDENCIES += samba4
-MPD_CONF_OPTS += --enable-smbclient
+MPD_CONF_OPTS += -Dsmbclient=enabled
 else
-MPD_CONF_OPTS += --disable-smbclient
+MPD_CONF_OPTS += -Dsmbclient=disabled
 endif
 
 ifeq ($(BR2_PACKAGE_MPD_LIBSAMPLERATE),y)
 MPD_DEPENDENCIES += libsamplerate
-MPD_CONF_OPTS += --enable-lsr
+MPD_CONF_OPTS += -Dlibsamplerate=enabled
 else
-MPD_CONF_OPTS += --disable-lsr
+MPD_CONF_OPTS += -Dlibsamplerate=disabled
 endif
 
 ifeq ($(BR2_PACKAGE_MPD_LIBSNDFILE),y)
 MPD_DEPENDENCIES += libsndfile
-MPD_CONF_OPTS += --enable-sndfile
+MPD_CONF_OPTS += -Dsndfile=enabled
 else
-MPD_CONF_OPTS += --disable-sndfile
+MPD_CONF_OPTS += -Dsndfile=disabled
 endif
 
 ifeq ($(BR2_PACKAGE_MPD_LIBSOXR),y)
 MPD_DEPENDENCIES += libsoxr
-MPD_CONF_OPTS += --enable-soxr
+MPD_CONF_OPTS += -Dsoxr=enabled
 else
-MPD_CONF_OPTS += --disable-soxr
+MPD_CONF_OPTS += -Dsoxr=disabled
 endif
 
 ifeq ($(BR2_PACKAGE_MPD_MAD),y)
 MPD_DEPENDENCIES += libid3tag libmad
-MPD_CONF_OPTS += --enable-mad
+MPD_CONF_OPTS += -Dmad=enabled
 else
-MPD_CONF_OPTS += --disable-mad
+MPD_CONF_OPTS += -Dmad=disabled
 endif
 
 ifeq ($(BR2_PACKAGE_MPD_MPG123),y)
 MPD_DEPENDENCIES += libid3tag mpg123
-MPD_CONF_OPTS += --enable-mpg123
+MPD_CONF_OPTS += -Dmpg123=enabled
 else
-MPD_CONF_OPTS += --disable-mpg123
+MPD_CONF_OPTS += -Dmpg123=disabled
 endif
 
 ifeq ($(BR2_PACKAGE_MPD_MUSEPACK),y)
 MPD_DEPENDENCIES += musepack
-MPD_CONF_OPTS += --enable-mpc
+MPD_CONF_OPTS += -Dmpcdec=enabled
 else
-MPD_CONF_OPTS += --disable-mpc
+MPD_CONF_OPTS += -Dmpcdec=disabled
 endif
 
 ifeq ($(BR2_PACKAGE_MPD_NEIGHBOR_DISCOVERY_SUPPORT),y)
-MPD_CONF_OPTS += --enable-neighbor-plugins
+MPD_CONF_OPTS += -Dneighbor=true
 else
-MPD_CONF_OPTS += --disable-neighbor-plugins
+MPD_CONF_OPTS += -Dneighbor=false
 endif
 
 ifeq ($(BR2_PACKAGE_MPD_OPUS),y)
 MPD_DEPENDENCIES += opus libogg
-MPD_CONF_OPTS += --enable-opus
+MPD_CONF_OPTS += -Dopus=enabled
 else
-MPD_CONF_OPTS += --disable-opus
+MPD_CONF_OPTS += -Dopus=disabled
 endif
 
 ifeq ($(BR2_PACKAGE_MPD_OSS),y)
-MPD_CONF_OPTS += --enable-oss
+MPD_CONF_OPTS += -Doss=enabled
 else
-MPD_CONF_OPTS += --disable-oss
+MPD_CONF_OPTS += -Doss=disabled
 endif
 
 ifeq ($(BR2_PACKAGE_MPD_PULSEAUDIO),y)
 MPD_DEPENDENCIES += pulseaudio
-MPD_CONF_OPTS += --enable-pulse
+MPD_CONF_OPTS += -Dpulse=enabled
 else
-MPD_CONF_OPTS += --disable-pulse
+MPD_CONF_OPTS += -Dpulse=disabled
+endif
+
+ifeq ($(BR2_PACKAGE_MPD_QOBUZ),y)
+MPD_DEPENDENCIES += libgcrypt yajl
+MPD_CONF_OPTS += -Dqobuz=auto
+else
+MPD_CONF_OPTS += -Dqobuz=disabled
 endif
 
 ifeq ($(BR2_PACKAGE_MPD_SHOUTCAST),y)
 MPD_DEPENDENCIES += libshout
-MPD_CONF_OPTS += --enable-shout
+MPD_CONF_OPTS += -Dshout=enabled
 else
-MPD_CONF_OPTS += --disable-shout
+MPD_CONF_OPTS += -Dshout=disabled
 endif
 
 ifeq ($(BR2_PACKAGE_MPD_SOUNDCLOUD),y)
 MPD_DEPENDENCIES += yajl
-MPD_CONF_OPTS += --enable-soundcloud
+MPD_CONF_OPTS += -Dsoundcloud=enabled
 else
-MPD_CONF_OPTS += --disable-soundcloud
+MPD_CONF_OPTS += -Dsoundcloud=disabled
 endif
 
 ifeq ($(BR2_PACKAGE_MPD_SQLITE),y)
 MPD_DEPENDENCIES += sqlite
-MPD_CONF_OPTS += --enable-sqlite
+MPD_CONF_OPTS += -Dsqlite=enabled
 else
-MPD_CONF_OPTS += --disable-sqlite
+MPD_CONF_OPTS += -Dsqlite=disabled
 endif
 
 ifneq ($(BR2_PACKAGE_MPD_TCP),y)
-MPD_CONF_OPTS += --disable-tcp
+MPD_CONF_OPTS += -Dtcp=true
+endif
+
+ifeq ($(BR2_PACKAGE_MPD_TIDAL),y)
+MPD_DEPENDENCIES += yajl
+MPD_CONF_OPTS += -Dtidal=enabled
+else
+MPD_CONF_OPTS += -Dtidal=disabled
 endif
 
 ifeq ($(BR2_PACKAGE_MPD_TREMOR),y)
 MPD_DEPENDENCIES += tremor
-# Help mpd to find tremor in static linking scenarios
-MPD_CONF_ENV += \
-	TREMOR_LIBS="`$(PKG_CONFIG_HOST_BINARY) --libs vorbisidec`"
-MPD_CONF_OPTS += --with-tremor=$(STAGING_DIR)/usr
+MPD_CONF_OPTS += -Dtremor=enabled
+else
+MPD_CONF_OPTS += -Dtremor=disabled
 endif
 
 ifeq ($(BR2_PACKAGE_MPD_TWOLAME),y)
 MPD_DEPENDENCIES += twolame
-MPD_CONF_OPTS += --enable-twolame-encoder
+MPD_CONF_OPTS += -Dtwolame=enabled
 else
-MPD_CONF_OPTS += --disable-twolame-encoder
+MPD_CONF_OPTS += -Dtwolame=disabled
 endif
 
 ifeq ($(BR2_PACKAGE_MPD_UPNP),y)
 MPD_DEPENDENCIES += \
 	expat \
 	$(if $(BR2_PACKAGE_LIBUPNP),libupnp,libupnp18)
-MPD_CONF_OPTS += --enable-upnp
+MPD_CONF_OPTS += -Dupnp=enabled
 else
-MPD_CONF_OPTS += --disable-upnp
+MPD_CONF_OPTS += -Dupnp=disabled
 endif
 
 ifeq ($(BR2_PACKAGE_MPD_VORBIS),y)
 MPD_DEPENDENCIES += libvorbis
-MPD_CONF_OPTS += --enable-vorbis --enable-vorbis-encoder
+MPD_CONF_OPTS += -Dvorbis=enabled -Dvorbisenc=enabled
 else
-MPD_CONF_OPTS += --disable-vorbis --disable-vorbis-encoder
+MPD_CONF_OPTS += -Dvorbis=disabled -Dvorbisenc=disabled
 endif
 
 ifeq ($(BR2_PACKAGE_MPD_WAVPACK),y)
 MPD_DEPENDENCIES += wavpack
-MPD_CONF_OPTS += --enable-wavpack
+MPD_CONF_OPTS += -Dwavpack=enabled
 else
-MPD_CONF_OPTS += --disable-wavpack
+MPD_CONF_OPTS += -Dwavpack=disabled
 endif
 
 define MPD_INSTALL_EXTRA_FILES
@@ -290,4 +301,4 @@ define MPD_INSTALL_INIT_SYSV
 		$(TARGET_DIR)/etc/init.d/S95mpd
 endef
 
-$(eval $(autotools-package))
+$(eval $(meson-package))
-- 
2.21.0

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [Buildroot] [PATCH 1/2] meson: add entry for libgcrypt-config in cross file
  2019-04-03 18:32 [Buildroot] [PATCH 1/2] meson: add entry for libgcrypt-config in cross file Jörg Krause
  2019-04-03 18:32 ` [Buildroot] [PATCH 2/2] package/mpd: bump to version 0.21.7 Jörg Krause
@ 2019-04-03 19:33 ` Thomas Petazzoni
  2019-04-05  6:58   ` Jörg Krause
  2019-04-13 16:24 ` Thomas Petazzoni
  2 siblings, 1 reply; 21+ messages in thread
From: Thomas Petazzoni @ 2019-04-03 19:33 UTC (permalink / raw)
  To: buildroot

Hello,

On Wed,  3 Apr 2019 20:32:01 +0200
J?rg Krause <joerg.krause@embedded.rocks> wrote:

> Since version 0.49.0 the Meson build system has native support for
> looking for `libgcrypt-config` if no pkg-config file is found. As the
> latest version 1.8.4 of libgcrypt does not provide a .pc file, using
> `libgcrypt-config` is the only way for detecting the required libraries
> when linking agains libgrypt.
> 
> The `libgcrypt-config` entry is necessary for updating package mpd,
> which switched from the Autotools to the Meson build system when bumping
> from version 0.20 to 0.21.
> 
> Signed-off-by: J?rg Krause <joerg.krause@embedded.rocks>
> ---
>  package/meson/cross-compilation.conf.in | 1 +
>  package/meson/meson.mk                  | 1 +
>  package/pkg-meson.mk                    | 1 +
>  3 files changed, 3 insertions(+)
> 
> diff --git a/package/meson/cross-compilation.conf.in b/package/meson/cross-compilation.conf.in
> index fc8e27f7eb..b68499a6fa 100644
> --- a/package/meson/cross-compilation.conf.in
> +++ b/package/meson/cross-compilation.conf.in
> @@ -9,6 +9,7 @@ cpp = '@TARGET_CROSS at g++'
>  ar = '@TARGET_CROSS at ar'
>  strip = '@TARGET_CROSS at strip'
>  pkgconfig = '@HOST_DIR@/usr/bin/pkg-config'
> +libgcrypt-config = '@STAGING_DIR@/usr/bin/libgcrypt-config'

Hm, this is a bit annoying. We really have no other solution but to
pass this through cross-compilation.conf ? It cannot be passed on the
meson command line, on a per-package basis, like we do for the autotools ?

Thanks,

Thomas
-- 
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [Buildroot] [PATCH 1/2] meson: add entry for libgcrypt-config in cross file
  2019-04-03 19:33 ` [Buildroot] [PATCH 1/2] meson: add entry for libgcrypt-config in cross file Thomas Petazzoni
@ 2019-04-05  6:58   ` Jörg Krause
  0 siblings, 0 replies; 21+ messages in thread
From: Jörg Krause @ 2019-04-05  6:58 UTC (permalink / raw)
  To: buildroot

Hello,

Am Mittwoch, den 03.04.2019, 21:33 +0200 schrieb Thomas Petazzoni:
> Hello,
> 
> On Wed,  3 Apr 2019 20:32:01 +0200
> J?rg Krause <joerg.krause@embedded.rocks> wrote:
> 
> > Since version 0.49.0 the Meson build system has native support for
> > looking for `libgcrypt-config` if no pkg-config file is found. As the
> > latest version 1.8.4 of libgcrypt does not provide a .pc file, using
> > `libgcrypt-config` is the only way for detecting the required libraries
> > when linking agains libgrypt.
> > 
> > The `libgcrypt-config` entry is necessary for updating package mpd,
> > which switched from the Autotools to the Meson build system when bumping
> > from version 0.20 to 0.21.
> > 
> > Signed-off-by: J?rg Krause <joerg.krause@embedded.rocks>
> > ---
> >  package/meson/cross-compilation.conf.in | 1 +
> >  package/meson/meson.mk                  | 1 +
> >  package/pkg-meson.mk                    | 1 +
> >  3 files changed, 3 insertions(+)
> > 
> > diff --git a/package/meson/cross-compilation.conf.in b/package/meson/cross-compilation.conf.in
> > index fc8e27f7eb..b68499a6fa 100644
> > --- a/package/meson/cross-compilation.conf.in
> > +++ b/package/meson/cross-compilation.conf.in
> > @@ -9,6 +9,7 @@ cpp = '@TARGET_CROSS at g++'
> >  ar = '@TARGET_CROSS at ar'
> >  strip = '@TARGET_CROSS at strip'
> >  pkgconfig = '@HOST_DIR@/usr/bin/pkg-config'
> > +libgcrypt-config = '@STAGING_DIR@/usr/bin/libgcrypt-config'
> 
> Hm, this is a bit annoying. We really have no other solution but to
> pass this through cross-compilation.conf ? It cannot be passed on the
> meson command line, on a per-package basis, like we do for the autotools ?

I am not a Meson expert, but I did not find any options howto pass
libgcrypt-config path through the command line.

Best regards
J?rg Krause

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [Buildroot] [PATCH 1/2] meson: add entry for libgcrypt-config in cross file
  2019-04-03 18:32 [Buildroot] [PATCH 1/2] meson: add entry for libgcrypt-config in cross file Jörg Krause
  2019-04-03 18:32 ` [Buildroot] [PATCH 2/2] package/mpd: bump to version 0.21.7 Jörg Krause
  2019-04-03 19:33 ` [Buildroot] [PATCH 1/2] meson: add entry for libgcrypt-config in cross file Thomas Petazzoni
@ 2019-04-13 16:24 ` Thomas Petazzoni
  2019-04-23 21:29   ` Peter Seiderer
  2 siblings, 1 reply; 21+ messages in thread
From: Thomas Petazzoni @ 2019-04-13 16:24 UTC (permalink / raw)
  To: buildroot

Hello J?rg,

+Peter Seiderer in Cc.

On Wed,  3 Apr 2019 20:32:01 +0200
J?rg Krause <joerg.krause@embedded.rocks> wrote:

> Since version 0.49.0 the Meson build system has native support for
> looking for `libgcrypt-config` if no pkg-config file is found. As the
> latest version 1.8.4 of libgcrypt does not provide a .pc file, using
> `libgcrypt-config` is the only way for detecting the required libraries
> when linking agains libgrypt.
> 
> The `libgcrypt-config` entry is necessary for updating package mpd,
> which switched from the Autotools to the Meson build system when bumping
> from version 0.20 to 0.21.
> 
> Signed-off-by: J?rg Krause <joerg.krause@embedded.rocks>

As I said in my previous reply, I'm not too happy with this
libgcrypt-config variable creeping into the global cross-compilation
file. Can we instead look at extending what Peter Seiderer is doing in
http://patchwork.ozlabs.org/patch/1081486/ and allow some per-package
additions to the per-package cross-compilation file ? Peter's patch
does it for CFLAGS/CXXFLAGS/LDFLAGS, we could perhaps do the same with
arbitrary program paths ?

Thanks!

Thomas
-- 
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [Buildroot] [PATCH 1/2] meson: add entry for libgcrypt-config in cross file
  2019-04-13 16:24 ` Thomas Petazzoni
@ 2019-04-23 21:29   ` Peter Seiderer
  2019-04-24 11:09     ` Jörg Krause
  2019-04-30  8:11     ` Jörg Krause
  0 siblings, 2 replies; 21+ messages in thread
From: Peter Seiderer @ 2019-04-23 21:29 UTC (permalink / raw)
  To: buildroot

Hello J?rg, Thomas,

On Sat, 13 Apr 2019 18:24:22 +0200, Thomas Petazzoni <thomas.petazzoni@bootlin.com> wrote:

> Hello J?rg,
> 
> +Peter Seiderer in Cc.
> 
> On Wed,  3 Apr 2019 20:32:01 +0200
> J?rg Krause <joerg.krause@embedded.rocks> wrote:
> 
> > Since version 0.49.0 the Meson build system has native support for
> > looking for `libgcrypt-config` if no pkg-config file is found. As the
> > latest version 1.8.4 of libgcrypt does not provide a .pc file, using
> > `libgcrypt-config` is the only way for detecting the required libraries
> > when linking agains libgrypt.
> > 
> > The `libgcrypt-config` entry is necessary for updating package mpd,
> > which switched from the Autotools to the Meson build system when bumping
> > from version 0.20 to 0.21.
> > 
> > Signed-off-by: J?rg Krause <joerg.krause@embedded.rocks>  
> 
> As I said in my previous reply, I'm not too happy with this
> libgcrypt-config variable creeping into the global cross-compilation
> file. Can we instead look at extending what Peter Seiderer is doing in
> http://patchwork.ozlabs.org/patch/1081486/ and allow some per-package
> additions to the per-package cross-compilation file ? Peter's patch
> does it for CFLAGS/CXXFLAGS/LDFLAGS, we could perhaps do the same with
> arbitrary program paths ?

Something like the following (draft) should work:

diff --git a/package/meson/cross-compilation.conf.in b/package/meson/cross-compilation.conf.in
index 4056c2b2f4..7cd372128e 100644
--- a/package/meson/cross-compilation.conf.in
+++ b/package/meson/cross-compilation.conf.in
@@ -9,6 +9,7 @@ cpp = '@TARGET_CROSS at g++'
 ar = '@TARGET_CROSS at ar'
 strip = '@TARGET_CROSS at strip'
 pkgconfig = '@HOST_DIR@/usr/bin/pkg-config'
+ at PKG_TARGET_BINARIES@
 
 [properties]
 needs_exe_wrapper = true
diff --git a/package/meson/meson.mk b/package/meson/meson.mk
index 70128f6bad..e550c80c9d 100644
--- a/package/meson/meson.mk
+++ b/package/meson/meson.mk
@@ -60,6 +60,7 @@ define HOST_MESON_INSTALL_CROSS_CONF
            -e "s%@TARGET_CFLAGS@%$(HOST_MESON_SED_CFLAGS)%g" \
            -e "s%@TARGET_LDFLAGS@%$(HOST_MESON_SED_LDFLAGS)%g" \
            -e "s%@TARGET_CXXFLAGS@%$(HOST_MESON_SED_CXXFLAGS)%g" \
+           -e "s%@PKG_TARGET_BINARIES@%%g" \
            -e "s%@PKG_TARGET_CFLAGS@%%g" \
            -e "s%@PKG_TARGET_LDFLAGS@%%g" \
            -e "s%@PKG_TARGET_CXXFLAGS@%%g" \
diff --git a/package/pkg-meson.mk b/package/pkg-meson.mk
index 9974b1e513..93df43fe3e 100644
--- a/package/pkg-meson.mk
+++ b/package/pkg-meson.mk
@@ -74,6 +74,7 @@ define $(2)_CONFIGURE_CMDS
            -e "s%@TARGET_CFLAGS@%$$(HOST_MESON_SED_CFLAGS)%g" \
            -e "s%@TARGET_LDFLAGS@%$$(HOST_MESON_SED_LDFLAGS)%g" \
            -e "s%@TARGET_CXXFLAGS@%$$(HOST_MESON_SED_CXXFLAGS)%g" \
+           -e "s%@PKG_TARGET_BINARIES@%$$($$(PKG)_MESON_BINARIES)%g" \
            -e "s%@PKG_TARGET_CFLAGS@%$$($$(PKG)_MESON_SED_CFLAGS)%g" \
            -e "s%@PKG_TARGET_LDFLAGS@%$$($$(PKG)_MESON_SED_LDFLAGS)%g" \
            -e "s%@PKG_TARGET_CXXFLAGS@%$$($$(PKG)_MESON_SED_CXXFLAGS)%g" \


and with: 

MPD_MESON_BINARIES = libgcrypt-config = '$(STAGING_DIR)/usr/bin/libgcrypt-config'

Regards,
Peter

> 
> Thanks!
> 
> Thomas

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [Buildroot] [PATCH 1/2] meson: add entry for libgcrypt-config in cross file
  2019-04-23 21:29   ` Peter Seiderer
@ 2019-04-24 11:09     ` Jörg Krause
  2019-04-30  8:11     ` Jörg Krause
  1 sibling, 0 replies; 21+ messages in thread
From: Jörg Krause @ 2019-04-24 11:09 UTC (permalink / raw)
  To: buildroot

Hello Peter,

On Tue, 2019-04-23 at 23:29 +0200, Peter Seiderer wrote:
> Hello J?rg, Thomas,
> 
> On Sat, 13 Apr 2019 18:24:22 +0200, Thomas Petazzoni <thomas.petazzoni@bootlin.com> wrote:
> 
> > Hello J?rg,
> > 
> > +Peter Seiderer in Cc.
> > 
> > On Wed,  3 Apr 2019 20:32:01 +0200
> > J?rg Krause <joerg.krause@embedded.rocks> wrote:
> > 
> > > Since version 0.49.0 the Meson build system has native support for
> > > looking for `libgcrypt-config` if no pkg-config file is found. As the
> > > latest version 1.8.4 of libgcrypt does not provide a .pc file, using
> > > `libgcrypt-config` is the only way for detecting the required libraries
> > > when linking agains libgrypt.
> > > 
> > > The `libgcrypt-config` entry is necessary for updating package mpd,
> > > which switched from the Autotools to the Meson build system when bumping
> > > from version 0.20 to 0.21.
> > > 
> > > Signed-off-by: J?rg Krause <joerg.krause@embedded.rocks>  
> > 
> > As I said in my previous reply, I'm not too happy with this
> > libgcrypt-config variable creeping into the global cross-compilation
> > file. Can we instead look at extending what Peter Seiderer is doing in
> > http://patchwork.ozlabs.org/patch/1081486/ and allow some per-package
> > additions to the per-package cross-compilation file ? Peter's patch
> > does it for CFLAGS/CXXFLAGS/LDFLAGS, we could perhaps do the same with
> > arbitrary program paths ?
> 
> Something like the following (draft) should work:
> 
> diff --git a/package/meson/cross-compilation.conf.in b/package/meson/cross-compilation.conf.in
> index 4056c2b2f4..7cd372128e 100644
> --- a/package/meson/cross-compilation.conf.in
> +++ b/package/meson/cross-compilation.conf.in
> @@ -9,6 +9,7 @@ cpp = '@TARGET_CROSS at g++'
>  ar = '@TARGET_CROSS at ar'
>  strip = '@TARGET_CROSS at strip'
>  pkgconfig = '@HOST_DIR@/usr/bin/pkg-config'
> + at PKG_TARGET_BINARIES@
>  
>  [properties]
>  needs_exe_wrapper = true
> diff --git a/package/meson/meson.mk b/package/meson/meson.mk
> index 70128f6bad..e550c80c9d 100644
> --- a/package/meson/meson.mk
> +++ b/package/meson/meson.mk
> @@ -60,6 +60,7 @@ define HOST_MESON_INSTALL_CROSS_CONF
>             -e "s%@TARGET_CFLAGS@%$(HOST_MESON_SED_CFLAGS)%g" \
>             -e "s%@TARGET_LDFLAGS@%$(HOST_MESON_SED_LDFLAGS)%g" \
>             -e "s%@TARGET_CXXFLAGS@%$(HOST_MESON_SED_CXXFLAGS)%g" \
> +           -e "s%@PKG_TARGET_BINARIES@%%g" \
>             -e "s%@PKG_TARGET_CFLAGS@%%g" \
>             -e "s%@PKG_TARGET_LDFLAGS@%%g" \
>             -e "s%@PKG_TARGET_CXXFLAGS@%%g" \
> diff --git a/package/pkg-meson.mk b/package/pkg-meson.mk
> index 9974b1e513..93df43fe3e 100644
> --- a/package/pkg-meson.mk
> +++ b/package/pkg-meson.mk
> @@ -74,6 +74,7 @@ define $(2)_CONFIGURE_CMDS
>             -e "s%@TARGET_CFLAGS@%$$(HOST_MESON_SED_CFLAGS)%g" \
>             -e "s%@TARGET_LDFLAGS@%$$(HOST_MESON_SED_LDFLAGS)%g" \
>             -e "s%@TARGET_CXXFLAGS@%$$(HOST_MESON_SED_CXXFLAGS)%g" \
> +           -e "s%@PKG_TARGET_BINARIES@%$$($$(PKG)_MESON_BINARIES)%g" \
>             -e "s%@PKG_TARGET_CFLAGS@%$$($$(PKG)_MESON_SED_CFLAGS)%g" \
>             -e "s%@PKG_TARGET_LDFLAGS@%$$($$(PKG)_MESON_SED_LDFLAGS)%g" \
>             -e "s%@PKG_TARGET_CXXFLAGS@%$$($$(PKG)_MESON_SED_CXXFLAGS)%g" \
> 
> 
> and with: 
> 
> MPD_MESON_BINARIES = libgcrypt-config = '$(STAGING_DIR)/usr/bin/libgcrypt-config'

Looks good to me. I will test and send an updated patch if Thomas
agrees.

J?rg

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [Buildroot] [PATCH 1/2] meson: add entry for libgcrypt-config in cross file
  2019-04-23 21:29   ` Peter Seiderer
  2019-04-24 11:09     ` Jörg Krause
@ 2019-04-30  8:11     ` Jörg Krause
  2019-04-30  8:27       ` Peter Seiderer
  1 sibling, 1 reply; 21+ messages in thread
From: Jörg Krause @ 2019-04-30  8:11 UTC (permalink / raw)
  To: buildroot

Hi Peter,

On Tue, 2019-04-23 at 23:29 +0200, Peter Seiderer wrote:
> Hello J?rg, Thomas,
> 
> On Sat, 13 Apr 2019 18:24:22 +0200, Thomas Petazzoni <thomas.petazzoni@bootlin.com> wrote:
> 
> > Hello J?rg,
> > 
> > +Peter Seiderer in Cc.
> > 
> > On Wed,  3 Apr 2019 20:32:01 +0200
> > J?rg Krause <joerg.krause@embedded.rocks> wrote:
> > 
> > > Since version 0.49.0 the Meson build system has native support for
> > > looking for `libgcrypt-config` if no pkg-config file is found. As the
> > > latest version 1.8.4 of libgcrypt does not provide a .pc file, using
> > > `libgcrypt-config` is the only way for detecting the required libraries
> > > when linking agains libgrypt.
> > > 
> > > The `libgcrypt-config` entry is necessary for updating package mpd,
> > > which switched from the Autotools to the Meson build system when bumping
> > > from version 0.20 to 0.21.
> > > 
> > > Signed-off-by: J?rg Krause <joerg.krause@embedded.rocks>  
> > 
> > As I said in my previous reply, I'm not too happy with this
> > libgcrypt-config variable creeping into the global cross-compilation
> > file. Can we instead look at extending what Peter Seiderer is doing in
> > http://patchwork.ozlabs.org/patch/1081486/ and allow some per-package
> > additions to the per-package cross-compilation file ? Peter's patch
> > does it for CFLAGS/CXXFLAGS/LDFLAGS, we could perhaps do the same with
> > arbitrary program paths ?
> 
> Something like the following (draft) should work:
> 
> diff --git a/package/meson/cross-compilation.conf.in b/package/meson/cross-compilation.conf.in
> index 4056c2b2f4..7cd372128e 100644
> --- a/package/meson/cross-compilation.conf.in
> +++ b/package/meson/cross-compilation.conf.in
> @@ -9,6 +9,7 @@ cpp = '@TARGET_CROSS at g++'
>  ar = '@TARGET_CROSS at ar'
>  strip = '@TARGET_CROSS at strip'
>  pkgconfig = '@HOST_DIR@/usr/bin/pkg-config'
> + at PKG_TARGET_BINARIES@
>  
>  [properties]
>  needs_exe_wrapper = true
> diff --git a/package/meson/meson.mk b/package/meson/meson.mk
> index 70128f6bad..e550c80c9d 100644
> --- a/package/meson/meson.mk
> +++ b/package/meson/meson.mk
> @@ -60,6 +60,7 @@ define HOST_MESON_INSTALL_CROSS_CONF
>             -e "s%@TARGET_CFLAGS@%$(HOST_MESON_SED_CFLAGS)%g" \
>             -e "s%@TARGET_LDFLAGS@%$(HOST_MESON_SED_LDFLAGS)%g" \
>             -e "s%@TARGET_CXXFLAGS@%$(HOST_MESON_SED_CXXFLAGS)%g" \
> +           -e "s%@PKG_TARGET_BINARIES@%%g" \
>             -e "s%@PKG_TARGET_CFLAGS@%%g" \
>             -e "s%@PKG_TARGET_LDFLAGS@%%g" \
>             -e "s%@PKG_TARGET_CXXFLAGS@%%g" \
> diff --git a/package/pkg-meson.mk b/package/pkg-meson.mk
> index 9974b1e513..93df43fe3e 100644
> --- a/package/pkg-meson.mk
> +++ b/package/pkg-meson.mk
> @@ -74,6 +74,7 @@ define $(2)_CONFIGURE_CMDS
>             -e "s%@TARGET_CFLAGS@%$$(HOST_MESON_SED_CFLAGS)%g" \
>             -e "s%@TARGET_LDFLAGS@%$$(HOST_MESON_SED_LDFLAGS)%g" \
>             -e "s%@TARGET_CXXFLAGS@%$$(HOST_MESON_SED_CXXFLAGS)%g" \
> +           -e "s%@PKG_TARGET_BINARIES@%$$($$(PKG)_MESON_BINARIES)%g" \
>             -e "s%@PKG_TARGET_CFLAGS@%$$($$(PKG)_MESON_SED_CFLAGS)%g" \
>             -e "s%@PKG_TARGET_LDFLAGS@%$$($$(PKG)_MESON_SED_LDFLAGS)%g" \
>             -e "s%@PKG_TARGET_CXXFLAGS@%$$($$(PKG)_MESON_SED_CXXFLAGS)%g" \
> 
> 
> and with: 
> 
> MPD_MESON_BINARIES = libgcrypt-config = '$(STAGING_DIR)/usr/bin/libgcrypt-config'

I've just tested your draft. This still inserts libgcrypt-config in the
global cross-compilation.conf.

I will send an updated version of the patch which does insert
libgcrypt-config in the package cross file, but not in the global cross
file.

Many thanks!

J?rg

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [Buildroot] [PATCH 1/2] meson: add entry for libgcrypt-config in cross file
  2019-04-30  8:11     ` Jörg Krause
@ 2019-04-30  8:27       ` Peter Seiderer
  2019-04-30 11:04         ` Jörg Krause
  0 siblings, 1 reply; 21+ messages in thread
From: Peter Seiderer @ 2019-04-30  8:27 UTC (permalink / raw)
  To: buildroot

Hello J?rg,

> Gesendet: Dienstag, 30. April 2019 um 10:11 Uhr
> Von: "J?rg Krause" <joerg.krause@embedded.rocks>
> An: "Peter Seiderer" <ps.report@gmx.net>, "Thomas Petazzoni" <thomas.petazzoni@bootlin.com>
> Cc: buildroot at buildroot.org
> Betreff: Re: [Buildroot] [PATCH 1/2] meson: add entry for libgcrypt-config in cross file
>
> Hi Peter,
> 
> On Tue, 2019-04-23 at 23:29 +0200, Peter Seiderer wrote:
> > Hello J?rg, Thomas,
> > 
> > On Sat, 13 Apr 2019 18:24:22 +0200, Thomas Petazzoni <thomas.petazzoni@bootlin.com> wrote:
> > 
> > > Hello J?rg,
> > > 
> > > +Peter Seiderer in Cc.
> > > 
> > > On Wed,  3 Apr 2019 20:32:01 +0200
> > > J?rg Krause <joerg.krause@embedded.rocks> wrote:
> > > 
> > > > Since version 0.49.0 the Meson build system has native support for
> > > > looking for `libgcrypt-config` if no pkg-config file is found. As the
> > > > latest version 1.8.4 of libgcrypt does not provide a .pc file, using
> > > > `libgcrypt-config` is the only way for detecting the required libraries
> > > > when linking agains libgrypt.
> > > > 
> > > > The `libgcrypt-config` entry is necessary for updating package mpd,
> > > > which switched from the Autotools to the Meson build system when bumping
> > > > from version 0.20 to 0.21.
> > > > 
> > > > Signed-off-by: J?rg Krause <joerg.krause@embedded.rocks>  
> > > 
> > > As I said in my previous reply, I'm not too happy with this
> > > libgcrypt-config variable creeping into the global cross-compilation
> > > file. Can we instead look at extending what Peter Seiderer is doing in
> > > http://patchwork.ozlabs.org/patch/1081486/ and allow some per-package
> > > additions to the per-package cross-compilation file ? Peter's patch
> > > does it for CFLAGS/CXXFLAGS/LDFLAGS, we could perhaps do the same with
> > > arbitrary program paths ?
> > 
> > Something like the following (draft) should work:
> > 
> > diff --git a/package/meson/cross-compilation.conf.in b/package/meson/cross-compilation.conf.in
> > index 4056c2b2f4..7cd372128e 100644
> > --- a/package/meson/cross-compilation.conf.in
> > +++ b/package/meson/cross-compilation.conf.in
> > @@ -9,6 +9,7 @@ cpp = '@TARGET_CROSS at g++'
> >  ar = '@TARGET_CROSS at ar'
> >  strip = '@TARGET_CROSS at strip'
> >  pkgconfig = '@HOST_DIR@/usr/bin/pkg-config'
> > + at PKG_TARGET_BINARIES@
> >  
> >  [properties]
> >  needs_exe_wrapper = true
> > diff --git a/package/meson/meson.mk b/package/meson/meson.mk
> > index 70128f6bad..e550c80c9d 100644
> > --- a/package/meson/meson.mk
> > +++ b/package/meson/meson.mk
> > @@ -60,6 +60,7 @@ define HOST_MESON_INSTALL_CROSS_CONF
> >             -e "s%@TARGET_CFLAGS@%$(HOST_MESON_SED_CFLAGS)%g" \
> >             -e "s%@TARGET_LDFLAGS@%$(HOST_MESON_SED_LDFLAGS)%g" \
> >             -e "s%@TARGET_CXXFLAGS@%$(HOST_MESON_SED_CXXFLAGS)%g" \
> > +           -e "s%@PKG_TARGET_BINARIES@%%g" \
> >             -e "s%@PKG_TARGET_CFLAGS@%%g" \
> >             -e "s%@PKG_TARGET_LDFLAGS@%%g" \
> >             -e "s%@PKG_TARGET_CXXFLAGS@%%g" \
> > diff --git a/package/pkg-meson.mk b/package/pkg-meson.mk
> > index 9974b1e513..93df43fe3e 100644
> > --- a/package/pkg-meson.mk
> > +++ b/package/pkg-meson.mk
> > @@ -74,6 +74,7 @@ define $(2)_CONFIGURE_CMDS
> >             -e "s%@TARGET_CFLAGS@%$$(HOST_MESON_SED_CFLAGS)%g" \
> >             -e "s%@TARGET_LDFLAGS@%$$(HOST_MESON_SED_LDFLAGS)%g" \
> >             -e "s%@TARGET_CXXFLAGS@%$$(HOST_MESON_SED_CXXFLAGS)%g" \
> > +           -e "s%@PKG_TARGET_BINARIES@%$$($$(PKG)_MESON_BINARIES)%g" \
> >             -e "s%@PKG_TARGET_CFLAGS@%$$($$(PKG)_MESON_SED_CFLAGS)%g" \
> >             -e "s%@PKG_TARGET_LDFLAGS@%$$($$(PKG)_MESON_SED_LDFLAGS)%g" \
> >             -e "s%@PKG_TARGET_CXXFLAGS@%$$($$(PKG)_MESON_SED_CXXFLAGS)%g" \
> > 
> > 
> > and with: 
> > 
> > MPD_MESON_BINARIES = libgcrypt-config = '$(STAGING_DIR)/usr/bin/libgcrypt-config'
> 
> I've just tested your draft. This still inserts libgcrypt-config in the
> global cross-compilation.conf.

Are you sure? The

+           -e "s%@PKG_TARGET_BINARIES@%%g"

in package/meson/meson.mk should not add anything to the global file...

Would have expected the trick/non-trivial thing to add more than one
binary entry (to get the newlines for the entries right)...

Regards,
Peter

> 
> I will send an updated version of the patch which does insert
> libgcrypt-config in the package cross file, but not in the global cross
> file.
> 
> Many thanks!
> 
> J?rg
> 
>

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [Buildroot] [PATCH 1/2] meson: add entry for libgcrypt-config in cross file
  2019-04-30  8:27       ` Peter Seiderer
@ 2019-04-30 11:04         ` Jörg Krause
  2019-05-01 11:13           ` Arnout Vandecappelle
  0 siblings, 1 reply; 21+ messages in thread
From: Jörg Krause @ 2019-04-30 11:04 UTC (permalink / raw)
  To: buildroot

Hello Peter,

On Tue, 2019-04-30 at 10:27 +0200, Peter Seiderer wrote:
> Hello J?rg,
> 
> > Gesendet: Dienstag, 30. April 2019 um 10:11 Uhr
> > Von: "J?rg Krause" <joerg.krause@embedded.rocks>
> > An: "Peter Seiderer" <ps.report@gmx.net>, "Thomas Petazzoni" <thomas.petazzoni@bootlin.com>
> > Cc: buildroot at buildroot.org
> > Betreff: Re: [Buildroot] [PATCH 1/2] meson: add entry for libgcrypt-config in cross file
> > 
> > Hi Peter,
> > 
> > On Tue, 2019-04-23 at 23:29 +0200, Peter Seiderer wrote:
> > > Hello J?rg, Thomas,
> > > 
> > > On Sat, 13 Apr 2019 18:24:22 +0200, Thomas Petazzoni <thomas.petazzoni@bootlin.com> wrote:
> > > 
> > > > Hello J?rg,
> > > > 
> > > > +Peter Seiderer in Cc.
> > > > 
> > > > On Wed,  3 Apr 2019 20:32:01 +0200
> > > > J?rg Krause <joerg.krause@embedded.rocks> wrote:
> > > > 
> > > > > Since version 0.49.0 the Meson build system has native support for
> > > > > looking for `libgcrypt-config` if no pkg-config file is found. As the
> > > > > latest version 1.8.4 of libgcrypt does not provide a .pc file, using
> > > > > `libgcrypt-config` is the only way for detecting the required libraries
> > > > > when linking agains libgrypt.
> > > > > 
> > > > > The `libgcrypt-config` entry is necessary for updating package mpd,
> > > > > which switched from the Autotools to the Meson build system when bumping
> > > > > from version 0.20 to 0.21.
> > > > > 
> > > > > Signed-off-by: J?rg Krause <joerg.krause@embedded.rocks>  
> > > > 
> > > > As I said in my previous reply, I'm not too happy with this
> > > > libgcrypt-config variable creeping into the global cross-compilation
> > > > file. Can we instead look at extending what Peter Seiderer is doing in
> > > > http://patchwork.ozlabs.org/patch/1081486/ and allow some per-package
> > > > additions to the per-package cross-compilation file ? Peter's patch
> > > > does it for CFLAGS/CXXFLAGS/LDFLAGS, we could perhaps do the same with
> > > > arbitrary program paths ?
> > > 
> > > Something like the following (draft) should work:
> > > 
> > > diff --git a/package/meson/cross-compilation.conf.in b/package/meson/cross-compilation.conf.in
> > > index 4056c2b2f4..7cd372128e 100644
> > > --- a/package/meson/cross-compilation.conf.in
> > > +++ b/package/meson/cross-compilation.conf.in
> > > @@ -9,6 +9,7 @@ cpp = '@TARGET_CROSS at g++'
> > >  ar = '@TARGET_CROSS at ar'
> > >  strip = '@TARGET_CROSS at strip'
> > >  pkgconfig = '@HOST_DIR@/usr/bin/pkg-config'
> > > + at PKG_TARGET_BINARIES@
> > >  
> > >  [properties]
> > >  needs_exe_wrapper = true
> > > diff --git a/package/meson/meson.mk b/package/meson/meson.mk
> > > index 70128f6bad..e550c80c9d 100644
> > > --- a/package/meson/meson.mk
> > > +++ b/package/meson/meson.mk
> > > @@ -60,6 +60,7 @@ define HOST_MESON_INSTALL_CROSS_CONF
> > >             -e "s%@TARGET_CFLAGS@%$(HOST_MESON_SED_CFLAGS)%g" \
> > >             -e "s%@TARGET_LDFLAGS@%$(HOST_MESON_SED_LDFLAGS)%g" \
> > >             -e "s%@TARGET_CXXFLAGS@%$(HOST_MESON_SED_CXXFLAGS)%g" \
> > > +           -e "s%@PKG_TARGET_BINARIES@%%g" \
> > >             -e "s%@PKG_TARGET_CFLAGS@%%g" \
> > >             -e "s%@PKG_TARGET_LDFLAGS@%%g" \
> > >             -e "s%@PKG_TARGET_CXXFLAGS@%%g" \
> > > diff --git a/package/pkg-meson.mk b/package/pkg-meson.mk
> > > index 9974b1e513..93df43fe3e 100644
> > > --- a/package/pkg-meson.mk
> > > +++ b/package/pkg-meson.mk
> > > @@ -74,6 +74,7 @@ define $(2)_CONFIGURE_CMDS
> > >             -e "s%@TARGET_CFLAGS@%$$(HOST_MESON_SED_CFLAGS)%g" \
> > >             -e "s%@TARGET_LDFLAGS@%$$(HOST_MESON_SED_LDFLAGS)%g" \
> > >             -e "s%@TARGET_CXXFLAGS@%$$(HOST_MESON_SED_CXXFLAGS)%g" \
> > > +           -e "s%@PKG_TARGET_BINARIES@%$$($$(PKG)_MESON_BINARIES)%g" \
> > >             -e "s%@PKG_TARGET_CFLAGS@%$$($$(PKG)_MESON_SED_CFLAGS)%g" \
> > >             -e "s%@PKG_TARGET_LDFLAGS@%$$($$(PKG)_MESON_SED_LDFLAGS)%g" \
> > >             -e "s%@PKG_TARGET_CXXFLAGS@%$$($$(PKG)_MESON_SED_CXXFLAGS)%g" \
> > > 
> > > 
> > > and with: 
> > > 
> > > MPD_MESON_BINARIES = libgcrypt-config = '$(STAGING_DIR)/usr/bin/libgcrypt-config'
> > 
> > I've just tested your draft. This still inserts libgcrypt-config in the
> > global cross-compilation.conf.
> 
> Are you sure? The
> 
> +           -e "s%@PKG_TARGET_BINARIES@%%g"
> 
> in package/meson/meson.mk should not add anything to the global file...

You're right! I missed that line, sorry.

> Would have expected the trick/non-trivial thing to add more than one
> binary entry (to get the newlines for the entries right)...

That's indeed a difficult case to solve. I didn't managed to get
multpile binary entries added to the [binaries] field, e.g.

PKG_TARGET_BINARIES = \
	libgcrypt-config = '...' \
	llvm-config = '...'

.. will not work.

I spent some time to find a magic rule which splits the Makefile
variable into a proper newline seperated string which can be used by
sed, but I failed.

Maybe you have an idea?

Best regards
J?rg Krause

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [Buildroot] [PATCH 1/2] meson: add entry for libgcrypt-config in cross file
  2019-04-30 11:04         ` Jörg Krause
@ 2019-05-01 11:13           ` Arnout Vandecappelle
  2019-05-01 19:04             ` Peter Seiderer
                               ` (2 more replies)
  0 siblings, 3 replies; 21+ messages in thread
From: Arnout Vandecappelle @ 2019-05-01 11:13 UTC (permalink / raw)
  To: buildroot



On 30/04/2019 13:04, J?rg Krause wrote:
> Hello Peter,
> 
> On Tue, 2019-04-30 at 10:27 +0200, Peter Seiderer wrote:
[snip]
>> Would have expected the trick/non-trivial thing to add more than one
>> binary entry (to get the newlines for the entries right)...
> 
> That's indeed a difficult case to solve. I didn't managed to get
> multpile binary entries added to the [binaries] field, e.g.
> 
> PKG_TARGET_BINARIES = \
> 	libgcrypt-config = '...' \
> 	llvm-config = '...'
> 
> .. will not work.
> 
> I spent some time to find a magic rule which splits the Makefile
> variable into a proper newline seperated string which can be used by
> sed, but I failed.
> 
> Maybe you have an idea?

 Instead of sed, use the PRINTF macro and append to the file:

	$Q$$(if $$($$(PKG)_TARGET_BINARIES),\
		$$(call PRINTF,$$($$(PKG)_TARGET_BINARIES)) \
		>> $$($$(PKG)_SRCDIR)/build/cross-compilation.conf


 Completely unrelated to this, but I notice now some things in that pkg-meson.mk
that make me wonder what our coding style is in pkg-infra.mk files... Adding
Yann and Eric in Cc for that.

- We usually use $(2), but here it's $$(PKG). Recently there was a patch that
changed the $(PKG) back to $(2) in the download infra. So I think we really
should be using $(2).

- meson infra builds in PKG_SRCDIR/build. That really should be PKG_BUILDDIR,
with a default of $(2)_BUILDDIR ?= $$($(2)_SRCDIR)/build.

- I don't think it's appropriate to generate the cross-compilation.conf file in
 PKG_BUILDDIR. I think it should be at top level, i.e. $(@D).


 Regards,
 Arnout

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [Buildroot] [PATCH 1/2] meson: add entry for libgcrypt-config in cross file
  2019-05-01 11:13           ` Arnout Vandecappelle
@ 2019-05-01 19:04             ` Peter Seiderer
  2019-05-02 12:17               ` Arnout Vandecappelle
  2019-05-01 19:23             ` Peter Seiderer
  2019-05-01 19:36             ` Thomas Petazzoni
  2 siblings, 1 reply; 21+ messages in thread
From: Peter Seiderer @ 2019-05-01 19:04 UTC (permalink / raw)
  To: buildroot

Hello Arnout,

On Wed, 1 May 2019 13:13:03 +0200, Arnout Vandecappelle <arnout@mind.be> wrote:

> On 30/04/2019 13:04, J?rg Krause wrote:
> > Hello Peter,
> > 
> > On Tue, 2019-04-30 at 10:27 +0200, Peter Seiderer wrote:  
> [snip]
> >> Would have expected the trick/non-trivial thing to add more than one
> >> binary entry (to get the newlines for the entries right)...  
> > 
> > That's indeed a difficult case to solve. I didn't managed to get
> > multpile binary entries added to the [binaries] field, e.g.
> > 
> > PKG_TARGET_BINARIES = \
> > 	libgcrypt-config = '...' \
> > 	llvm-config = '...'
> > 
> > .. will not work.
> > 
> > I spent some time to find a magic rule which splits the Makefile
> > variable into a proper newline seperated string which can be used by
> > sed, but I failed.
> > 
> > Maybe you have an idea?  
> 
>  Instead of sed, use the PRINTF macro and append to the file:
> 
> 	$Q$$(if $$($$(PKG)_TARGET_BINARIES),\
> 		$$(call PRINTF,$$($$(PKG)_TARGET_BINARIES)) \
> 		>> $$($$(PKG)_SRCDIR)/build/cross-compilation.conf  

Simple appending will not work, the extra binaries must be under the '[binaries]'
section (maybe reordering the sections in the cross-compilation.conf.in template
will work), does the printf approach fix the newline problem for more than one
entry?

> 
> 
>  Completely unrelated to this, but I notice now some things in that pkg-meson.mk
> that make me wonder what our coding style is in pkg-infra.mk files... Adding
> Yann and Eric in Cc for that.
> 
> - We usually use $(2), but here it's $$(PKG). Recently there was a patch that
> changed the $(PKG) back to $(2) in the download infra. So I think we really
> should be using $(2).

Any link to the relevant patch? Can test/rework my patch/pkg-meson.mk in case...

> 
> - meson infra builds in PKG_SRCDIR/build. That really should be PKG_BUILDDIR,
> with a default of $(2)_BUILDDIR ?= $$($(2)_SRCDIR)/build.

O.k.

> 
> - I don't think it's appropriate to generate the cross-compilation.conf file in
>  PKG_BUILDDIR. I think it should be at top level, i.e. $(@D).

Why (I think more a matter of taste?)? With cross-compilation.conf in PKG_BUILDDIR
(or in other words build) it is automatically removed/refreshed by pkg-meson.mk
(see the rm command in the configure step) and there is no danger of potentially
collision with an already source package provided version?

Regards,
Peter
  
> 
> 
>  Regards,
>  Arnout

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [Buildroot] [PATCH 1/2] meson: add entry for libgcrypt-config in cross file
  2019-05-01 11:13           ` Arnout Vandecappelle
  2019-05-01 19:04             ` Peter Seiderer
@ 2019-05-01 19:23             ` Peter Seiderer
  2019-05-01 19:36             ` Thomas Petazzoni
  2 siblings, 0 replies; 21+ messages in thread
From: Peter Seiderer @ 2019-05-01 19:23 UTC (permalink / raw)
  To: buildroot

Hello Arnout, J?rg,

On Wed, 1 May 2019 13:13:03 +0200, Arnout Vandecappelle <arnout@mind.be> wrote:

> On 30/04/2019 13:04, J?rg Krause wrote:
> > Hello Peter,
> > 
> > On Tue, 2019-04-30 at 10:27 +0200, Peter Seiderer wrote:  
> [snip]
> >> Would have expected the trick/non-trivial thing to add more than one
> >> binary entry (to get the newlines for the entries right)...  
> > 
> > That's indeed a difficult case to solve. I didn't managed to get
> > multpile binary entries added to the [binaries] field, e.g.
> > 


> > 
> > .. will not work.
> > 
> > I spent some time to find a magic rule which splits the Makefile
> > variable into a proper newline seperated string which can be used by
> > sed, but I failed.
> > 
> > Maybe you have an idea?  

The version with added '\n', like:

PKG_TARGET_BINARIES = \
 	libgcrypt-config = '...' \
 	\nllvm-config = '...'

works for the sed variant but not for the given printf one...

Regards,
Peter

> 
>  Instead of sed, use the PRINTF macro and append to the file:
> 
> 	$Q$$(if $$($$(PKG)_TARGET_BINARIES),\
> 		$$(call PRINTF,$$($$(PKG)_TARGET_BINARIES)) \
> 		>> $$($$(PKG)_SRCDIR)/build/cross-compilation.conf  
> 
> 
>  Completely unrelated to this, but I notice now some things in that pkg-meson.mk
> that make me wonder what our coding style is in pkg-infra.mk files... Adding
> Yann and Eric in Cc for that.
> 
> - We usually use $(2), but here it's $$(PKG). Recently there was a patch that
> changed the $(PKG) back to $(2) in the download infra. So I think we really
> should be using $(2).
> 
> - meson infra builds in PKG_SRCDIR/build. That really should be PKG_BUILDDIR,
> with a default of $(2)_BUILDDIR ?= $$($(2)_SRCDIR)/build.
> 
> - I don't think it's appropriate to generate the cross-compilation.conf file in
>  PKG_BUILDDIR. I think it should be at top level, i.e. $(@D).
> 
> 
>  Regards,
>  Arnout

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [Buildroot] [PATCH 1/2] meson: add entry for libgcrypt-config in cross file
  2019-05-01 11:13           ` Arnout Vandecappelle
  2019-05-01 19:04             ` Peter Seiderer
  2019-05-01 19:23             ` Peter Seiderer
@ 2019-05-01 19:36             ` Thomas Petazzoni
  2019-05-02 12:20               ` Arnout Vandecappelle
  2 siblings, 1 reply; 21+ messages in thread
From: Thomas Petazzoni @ 2019-05-01 19:36 UTC (permalink / raw)
  To: buildroot

Hello,

On Wed, 1 May 2019 13:13:03 +0200
Arnout Vandecappelle <arnout@mind.be> wrote:

> - I don't think it's appropriate to generate the cross-compilation.conf file in
>  PKG_BUILDDIR. I think it should be at top level, i.e. $(@D).

I'd say it depends the $(@D) of which step. Indeed, in the (admittedly
long term) perspective of per-package out-of-tree build, the source
tree would be shared between the host and target builds of a given
package, and this cross-compilation.conf file would only make sense for
the target variant of the package, and therefore it should be in the
build directory of the target variant.

So, if this file is generated during the "configure" step, we are good,
because $(@D) will point to the build directory. If it's generated in
an earlier step, $(@D) points to the source directory (with per-package
out-of-tree build implemented, of course).

Best regards,

Thomas
-- 
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [Buildroot] [PATCH 1/2] meson: add entry for libgcrypt-config in cross file
  2019-05-01 19:04             ` Peter Seiderer
@ 2019-05-02 12:17               ` Arnout Vandecappelle
  2019-05-02 20:02                 ` Peter Seiderer
  2019-05-23 22:51                 ` Jörg Krause
  0 siblings, 2 replies; 21+ messages in thread
From: Arnout Vandecappelle @ 2019-05-02 12:17 UTC (permalink / raw)
  To: buildroot



On 01/05/2019 21:04, Peter Seiderer wrote:
> Hello Arnout,
> 
> On Wed, 1 May 2019 13:13:03 +0200, Arnout Vandecappelle <arnout@mind.be> wrote:
> 
>> On 30/04/2019 13:04, J?rg Krause wrote:
>>> Hello Peter,
>>>
>>> On Tue, 2019-04-30 at 10:27 +0200, Peter Seiderer wrote:  
>> [snip]
>>>> Would have expected the trick/non-trivial thing to add more than one
>>>> binary entry (to get the newlines for the entries right)...  
>>>
>>> That's indeed a difficult case to solve. I didn't managed to get
>>> multpile binary entries added to the [binaries] field, e.g.
>>>
>>> PKG_TARGET_BINARIES = \
>>> 	libgcrypt-config = '...' \
>>> 	llvm-config = '...'
>>>
>>> .. will not work.
>>>
>>> I spent some time to find a magic rule which splits the Makefile
>>> variable into a proper newline seperated string which can be used by
>>> sed, but I failed.
>>>
>>> Maybe you have an idea?  
>>
>>  Instead of sed, use the PRINTF macro and append to the file:
>>
>> 	$Q$$(if $$($$(PKG)_TARGET_BINARIES),\
>> 		$$(call PRINTF,$$($$(PKG)_TARGET_BINARIES)) \
>> 		>> $$($$(PKG)_SRCDIR)/build/cross-compilation.conf  
> 
> Simple appending will not work, the extra binaries must be under the '[binaries]'
> section (maybe reordering the sections in the cross-compilation.conf.in template
> will work)

 It should work if the [binaries] part is at the end, right? And if binaries is
empty, that's OK, no?

 Alternatively, the [binaries] part could be included in the _TARGET_BINARIES
(which would then have to be renamed to _CROSS_COMPILATION_CONF). So for a
package that needs libgcrypt-config, it would be

define FOO_CROSS_COMPILATION_CONF
[binaries]
libgcrypt-config = '$(STAGING_DIR)/usr/bin/libgcrypt-config'
endef

> , does the printf approach fix the newline problem for more than one
> entry?

 It does, but you can't use _CROSS_COMPILATION_CONF = ..., you have to use
define, because the actual newlines have to be in the variable itself. Actually,
you can still use = assignment, but then you need to use $(sep), i.e.:

FOO_CROSS_COMPILATION_CONF = [binaries]$(sep)libgcrypt-config =
'$(STAGING_DIR)/usr/bin/libgcrypt-config'$(sep)

(which is ugly so don't do that :-)


> 
>>
>>
>>  Completely unrelated to this, but I notice now some things in that pkg-meson.mk
>> that make me wonder what our coding style is in pkg-infra.mk files... Adding
>> Yann and Eric in Cc for that.
>>
>> - We usually use $(2), but here it's $$(PKG). Recently there was a patch that
>> changed the $(PKG) back to $(2) in the download infra. So I think we really
>> should be using $(2).
> 
> Any link to the relevant patch? Can test/rework my patch/pkg-meson.mk in case...

5a0d6813948fea2cdb88a2e35984520eec856dec

 Note that the reasons for doing it in that patch don't apply here. However, I
feel it is better/easier to have a general rule to always do things the same
way, which is diverged from only in specific cases when there is a good reason
to diverge. Like we have the rule that in macros which get $(eval)'ed, we always
use $$ (even though it's really needed only in a small minority of the instances).

 It doesn't really matter which one we choose, $(PKG) or $(2), as long as it is
done consistently.

 The advantage of $(PKG) is that it can be used in contexts where you don't have
a $(2). The advantage of $(2) is that it is less surprising - by the time $(PKG)
gets expanded, it's hard to be sure which value it has (depends on the rule
within which it is expanded).


>> - meson infra builds in PKG_SRCDIR/build. That really should be PKG_BUILDDIR,
>> with a default of $(2)_BUILDDIR ?= $$($(2)_SRCDIR)/build.
> 
> O.k.
> 
>>
>> - I don't think it's appropriate to generate the cross-compilation.conf file in
>>  PKG_BUILDDIR. I think it should be at top level, i.e. $(@D).
> 
> Why (I think more a matter of taste?)? With cross-compilation.conf in PKG_BUILDDIR
> (or in other words build) it is automatically removed/refreshed by pkg-meson.mk
> (see the rm command in the configure step) and there is no danger of potentially
> collision with an already source package provided version?

 It's a matter of taste unless there are additional reasons, and you gave
additional reasons, so it's no longer a matter of taste :-) Let's keep it in
BUILDDIR.

 Regards,
 Arnout

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [Buildroot] [PATCH 1/2] meson: add entry for libgcrypt-config in cross file
  2019-05-01 19:36             ` Thomas Petazzoni
@ 2019-05-02 12:20               ` Arnout Vandecappelle
  0 siblings, 0 replies; 21+ messages in thread
From: Arnout Vandecappelle @ 2019-05-02 12:20 UTC (permalink / raw)
  To: buildroot



On 01/05/2019 21:36, Thomas Petazzoni wrote:
> Hello,
> 
> On Wed, 1 May 2019 13:13:03 +0200
> Arnout Vandecappelle <arnout@mind.be> wrote:
> 
>> - I don't think it's appropriate to generate the cross-compilation.conf file in
>>  PKG_BUILDDIR. I think it should be at top level, i.e. $(@D).
> 
> I'd say it depends the $(@D) of which step. Indeed, in the (admittedly
> long term) perspective of per-package out-of-tree build, the source
> tree would be shared between the host and target builds of a given
> package, and this cross-compilation.conf file would only make sense for
> the target variant of the package, and therefore it should be in the
> build directory of the target variant.
> 
> So, if this file is generated during the "configure" step, we are good,
> because $(@D) will point to the build directory. If it's generated in
> an earlier step, $(@D) points to the source directory (with per-package
> out-of-tree build implemented, of course).

 Similarly like for $(2) vs. $(PKG), I think we should have a "default" for how
to address "the directory where stuff happens". We currently use $(@D) in many
places, but perhaps it's better to turn that into $(FOO_BUILDDIR).

 Regards,
 Arnout

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [Buildroot] [PATCH 1/2] meson: add entry for libgcrypt-config in cross file
  2019-05-02 12:17               ` Arnout Vandecappelle
@ 2019-05-02 20:02                 ` Peter Seiderer
  2019-05-03  9:21                   ` Arnout Vandecappelle
  2019-05-23 22:51                 ` Jörg Krause
  1 sibling, 1 reply; 21+ messages in thread
From: Peter Seiderer @ 2019-05-02 20:02 UTC (permalink / raw)
  To: buildroot

Hello Arnout,

On Thu, 2 May 2019 14:17:45 +0200, Arnout Vandecappelle <arnout@mind.be> wrote:

> On 01/05/2019 21:04, Peter Seiderer wrote:
> > Hello Arnout,
> > 
> > On Wed, 1 May 2019 13:13:03 +0200, Arnout Vandecappelle <arnout@mind.be> wrote:
> >   
> >> On 30/04/2019 13:04, J?rg Krause wrote:  
> >>> Hello Peter,
> >>>
> >>> On Tue, 2019-04-30 at 10:27 +0200, Peter Seiderer wrote:    
> >> [snip]  
> >>>> Would have expected the trick/non-trivial thing to add more than one
> >>>> binary entry (to get the newlines for the entries right)...    
> >>>
> >>> That's indeed a difficult case to solve. I didn't managed to get
> >>> multpile binary entries added to the [binaries] field, e.g.
> >>>
> >>> PKG_TARGET_BINARIES = \
> >>> 	libgcrypt-config = '...' \
> >>> 	llvm-config = '...'
> >>>
> >>> .. will not work.
> >>>
> >>> I spent some time to find a magic rule which splits the Makefile
> >>> variable into a proper newline seperated string which can be used by
> >>> sed, but I failed.
> >>>
> >>> Maybe you have an idea?    
> >>
> >>  Instead of sed, use the PRINTF macro and append to the file:
> >>
> >> 	$Q$$(if $$($$(PKG)_TARGET_BINARIES),\
> >> 		$$(call PRINTF,$$($$(PKG)_TARGET_BINARIES)) \  
> >> 		>> $$($$(PKG)_SRCDIR)/build/cross-compilation.conf    
> > 
> > Simple appending will not work, the extra binaries must be under the '[binaries]'
> > section (maybe reordering the sections in the cross-compilation.conf.in template
> > will work)  
> 
>  It should work if the [binaries] part is at the end, right? And if binaries is
> empty, that's OK, no?
> 
>  Alternatively, the [binaries] part could be included in the _TARGET_BINARIES
> (which would then have to be renamed to _CROSS_COMPILATION_CONF). So for a
> package that needs libgcrypt-config, it would be
> 
> define FOO_CROSS_COMPILATION_CONF
> [binaries]
> libgcrypt-config = '$(STAGING_DIR)/usr/bin/libgcrypt-config'
> endef

With this and the printf approach I get the following in the cross-compilation.conf
file (mind the leading spaces in the binaries line):

[host_machine]
system = 'linux'
cpu_family ='arm'
cpu = 'cortex-a53'
endian = 'little'

   [binaries]
libgcrypt-config = '.../host/arm-buildroot-linux-gnueabihf/sysroot/usr/bin/libgcrypt-config'

And meson complains with:

ERROR: Malformed value in cross file variable endian.

Regards,
Peter

> 
> > , does the printf approach fix the newline problem for more than one
> > entry?  
> 
>  It does, but you can't use _CROSS_COMPILATION_CONF = ..., you have to use
> define, because the actual newlines have to be in the variable itself. Actually,
> you can still use = assignment, but then you need to use $(sep), i.e.:
> 
> FOO_CROSS_COMPILATION_CONF = [binaries]$(sep)libgcrypt-config =
> '$(STAGING_DIR)/usr/bin/libgcrypt-config'$(sep)
> 
> (which is ugly so don't do that :-)
> 
> 
> >   
> >>
> >>
> >>  Completely unrelated to this, but I notice now some things in that pkg-meson.mk
> >> that make me wonder what our coding style is in pkg-infra.mk files... Adding
> >> Yann and Eric in Cc for that.
> >>
> >> - We usually use $(2), but here it's $$(PKG). Recently there was a patch that
> >> changed the $(PKG) back to $(2) in the download infra. So I think we really
> >> should be using $(2).  
> > 
> > Any link to the relevant patch? Can test/rework my patch/pkg-meson.mk in case...  
> 
> 5a0d6813948fea2cdb88a2e35984520eec856dec
> 
>  Note that the reasons for doing it in that patch don't apply here. However, I
> feel it is better/easier to have a general rule to always do things the same
> way, which is diverged from only in specific cases when there is a good reason
> to diverge. Like we have the rule that in macros which get $(eval)'ed, we always
> use $$ (even though it's really needed only in a small minority of the instances).
> 
>  It doesn't really matter which one we choose, $(PKG) or $(2), as long as it is
> done consistently.
> 
>  The advantage of $(PKG) is that it can be used in contexts where you don't have
> a $(2). The advantage of $(2) is that it is less surprising - by the time $(PKG)
> gets expanded, it's hard to be sure which value it has (depends on the rule
> within which it is expanded).
> 
> 
> >> - meson infra builds in PKG_SRCDIR/build. That really should be PKG_BUILDDIR,
> >> with a default of $(2)_BUILDDIR ?= $$($(2)_SRCDIR)/build.  
> > 
> > O.k.
> >   
> >>
> >> - I don't think it's appropriate to generate the cross-compilation.conf file in
> >>  PKG_BUILDDIR. I think it should be at top level, i.e. $(@D).  
> > 
> > Why (I think more a matter of taste?)? With cross-compilation.conf in PKG_BUILDDIR
> > (or in other words build) it is automatically removed/refreshed by pkg-meson.mk
> > (see the rm command in the configure step) and there is no danger of potentially
> > collision with an already source package provided version?  
> 
>  It's a matter of taste unless there are additional reasons, and you gave
> additional reasons, so it's no longer a matter of taste :-) Let's keep it in
> BUILDDIR.
> 
>  Regards,
>  Arnout
> 
> _______________________________________________
> buildroot mailing list
> buildroot at busybox.net
> http://lists.busybox.net/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [Buildroot] [PATCH 1/2] meson: add entry for libgcrypt-config in cross file
  2019-05-02 20:02                 ` Peter Seiderer
@ 2019-05-03  9:21                   ` Arnout Vandecappelle
  0 siblings, 0 replies; 21+ messages in thread
From: Arnout Vandecappelle @ 2019-05-03  9:21 UTC (permalink / raw)
  To: buildroot



On 02/05/2019 22:02, Peter Seiderer wrote:
> Hello Arnout,
> 
> On Thu, 2 May 2019 14:17:45 +0200, Arnout Vandecappelle <arnout@mind.be> wrote:
> 
>> On 01/05/2019 21:04, Peter Seiderer wrote:
>>> Hello Arnout,
>>>
>>> On Wed, 1 May 2019 13:13:03 +0200, Arnout Vandecappelle <arnout@mind.be> wrote:
>>>   
>>>> On 30/04/2019 13:04, J?rg Krause wrote:  
>>>>> Hello Peter,
>>>>>
>>>>> On Tue, 2019-04-30 at 10:27 +0200, Peter Seiderer wrote:    
>>>> [snip]  
>>>>>> Would have expected the trick/non-trivial thing to add more than one
>>>>>> binary entry (to get the newlines for the entries right)...    
>>>>>
>>>>> That's indeed a difficult case to solve. I didn't managed to get
>>>>> multpile binary entries added to the [binaries] field, e.g.
>>>>>
>>>>> PKG_TARGET_BINARIES = \
>>>>> 	libgcrypt-config = '...' \
>>>>> 	llvm-config = '...'
>>>>>
>>>>> .. will not work.
>>>>>
>>>>> I spent some time to find a magic rule which splits the Makefile
>>>>> variable into a proper newline seperated string which can be used by
>>>>> sed, but I failed.
>>>>>
>>>>> Maybe you have an idea?    
>>>>
>>>>  Instead of sed, use the PRINTF macro and append to the file:
>>>>
>>>> 	$Q$$(if $$($$(PKG)_TARGET_BINARIES),\
>>>> 		$$(call PRINTF,$$($$(PKG)_TARGET_BINARIES)) \  
>>>> 		>> $$($$(PKG)_SRCDIR)/build/cross-compilation.conf    
>>>
>>> Simple appending will not work, the extra binaries must be under the '[binaries]'
>>> section (maybe reordering the sections in the cross-compilation.conf.in template
>>> will work)  
>>
>>  It should work if the [binaries] part is at the end, right? And if binaries is
>> empty, that's OK, no?
>>
>>  Alternatively, the [binaries] part could be included in the _TARGET_BINARIES
>> (which would then have to be renamed to _CROSS_COMPILATION_CONF). So for a
>> package that needs libgcrypt-config, it would be
>>
>> define FOO_CROSS_COMPILATION_CONF
>> [binaries]
>> libgcrypt-config = '$(STAGING_DIR)/usr/bin/libgcrypt-config'
>> endef
> 
> With this and the printf approach I get the following in the cross-compilation.conf
> file (mind the leading spaces in the binaries line):
> 
> [host_machine]
> system = 'linux'
> cpu_family ='arm'
> cpu = 'cortex-a53'
> endian = 'little'
> 
>    [binaries]

 Oh yes, that's because of the newlines in the definition of PRINTF. `make`
replaces backslash-newline-space-space-space with a single space. Since there
are three backslash-newlines in that macro, you get three spaces.

 However, the definition of PERCENT and QUOTE is actually not needed, since
neither of those are special from `make`. So you could instead define the macro as:

        printf '$(subst $(sep),\n,$(subst %,%%,$(subst ','\'',$(subst
\,\\,$(1)))))\n'

 Syntax highlighting in vim is completely screwed up then, but it's the end of
the file so too bad :-)

 If you think that that is still too long, you could define it in two steps:

shell-quote = '$(subst ','\'',$(subst \,\\,$(1)))'
define PRINTF
	printf $(subst $(sep),\n,$(subst %,%%,$(call shell-quote,$(1)$(sep))))
endef

But I'm not convinced that that is nicer.

 Oh, and all of that is untested of course.

 Regards,
 Arnout


> libgcrypt-config = '.../host/arm-buildroot-linux-gnueabihf/sysroot/usr/bin/libgcrypt-config'
> 
> And meson complains with:
> 
> ERROR: Malformed value in cross file variable endian.
> 
> Regards,
> Peter
> 
>>
>>> , does the printf approach fix the newline problem for more than one
>>> entry?  
>>
>>  It does, but you can't use _CROSS_COMPILATION_CONF = ..., you have to use
>> define, because the actual newlines have to be in the variable itself. Actually,
>> you can still use = assignment, but then you need to use $(sep), i.e.:
>>
>> FOO_CROSS_COMPILATION_CONF = [binaries]$(sep)libgcrypt-config =
>> '$(STAGING_DIR)/usr/bin/libgcrypt-config'$(sep)
>>
>> (which is ugly so don't do that :-)
>>
>>
>>>   
>>>>
>>>>
>>>>  Completely unrelated to this, but I notice now some things in that pkg-meson.mk
>>>> that make me wonder what our coding style is in pkg-infra.mk files... Adding
>>>> Yann and Eric in Cc for that.
>>>>
>>>> - We usually use $(2), but here it's $$(PKG). Recently there was a patch that
>>>> changed the $(PKG) back to $(2) in the download infra. So I think we really
>>>> should be using $(2).  
>>>
>>> Any link to the relevant patch? Can test/rework my patch/pkg-meson.mk in case...  
>>
>> 5a0d6813948fea2cdb88a2e35984520eec856dec
>>
>>  Note that the reasons for doing it in that patch don't apply here. However, I
>> feel it is better/easier to have a general rule to always do things the same
>> way, which is diverged from only in specific cases when there is a good reason
>> to diverge. Like we have the rule that in macros which get $(eval)'ed, we always
>> use $$ (even though it's really needed only in a small minority of the instances).
>>
>>  It doesn't really matter which one we choose, $(PKG) or $(2), as long as it is
>> done consistently.
>>
>>  The advantage of $(PKG) is that it can be used in contexts where you don't have
>> a $(2). The advantage of $(2) is that it is less surprising - by the time $(PKG)
>> gets expanded, it's hard to be sure which value it has (depends on the rule
>> within which it is expanded).
>>
>>
>>>> - meson infra builds in PKG_SRCDIR/build. That really should be PKG_BUILDDIR,
>>>> with a default of $(2)_BUILDDIR ?= $$($(2)_SRCDIR)/build.  
>>>
>>> O.k.
>>>   
>>>>
>>>> - I don't think it's appropriate to generate the cross-compilation.conf file in
>>>>  PKG_BUILDDIR. I think it should be at top level, i.e. $(@D).  
>>>
>>> Why (I think more a matter of taste?)? With cross-compilation.conf in PKG_BUILDDIR
>>> (or in other words build) it is automatically removed/refreshed by pkg-meson.mk
>>> (see the rm command in the configure step) and there is no danger of potentially
>>> collision with an already source package provided version?  
>>
>>  It's a matter of taste unless there are additional reasons, and you gave
>> additional reasons, so it's no longer a matter of taste :-) Let's keep it in
>> BUILDDIR.
>>
>>  Regards,
>>  Arnout
>>
>> _______________________________________________
>> buildroot mailing list
>> buildroot at busybox.net
>> http://lists.busybox.net/mailman/listinfo/buildroot
> 

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [Buildroot] [PATCH 1/2] meson: add entry for libgcrypt-config in cross file
  2019-05-02 12:17               ` Arnout Vandecappelle
  2019-05-02 20:02                 ` Peter Seiderer
@ 2019-05-23 22:51                 ` Jörg Krause
  2019-05-24  8:18                   ` Arnout Vandecappelle
  1 sibling, 1 reply; 21+ messages in thread
From: Jörg Krause @ 2019-05-23 22:51 UTC (permalink / raw)
  To: buildroot

Hi all,

thank you all for your ideas. Please take a look at my proposal
below...

On Thu, 2019-05-02 at 14:17 +0200, Arnout Vandecappelle wrote:
> 
> On 01/05/2019 21:04, Peter Seiderer wrote:
> > Hello Arnout,
> > 
> > On Wed, 1 May 2019 13:13:03 +0200, Arnout Vandecappelle <arnout@mind.be> wrote:
> > 
> > > On 30/04/2019 13:04, J?rg Krause wrote:
> > > > Hello Peter,
> > > > 
> > > > On Tue, 2019-04-30 at 10:27 +0200, Peter Seiderer wrote:  
> > > [snip]
> > > > > Would have expected the trick/non-trivial thing to add more than one
> > > > > binary entry (to get the newlines for the entries right)...  
> > > > 
> > > > That's indeed a difficult case to solve. I didn't managed to get
> > > > multpile binary entries added to the [binaries] field, e.g.
> > > > 
> > > > PKG_TARGET_BINARIES = \
> > > > 	libgcrypt-config = '...' \
> > > > 	llvm-config = '...'
> > > > 
> > > > .. will not work.
> > > > 
> > > > I spent some time to find a magic rule which splits the Makefile
> > > > variable into a proper newline seperated string which can be used by
> > > > sed, but I failed.
> > > > 
> > > > Maybe you have an idea?  
> > > 
> > >  Instead of sed, use the PRINTF macro and append to the file:
> > > 
> > > 	$Q$$(if $$($$(PKG)_TARGET_BINARIES),\
> > > 		$$(call PRINTF,$$($$(PKG)_TARGET_BINARIES)) \
> > > 		>> $$($$(PKG)_SRCDIR)/build/cross-compilation.conf  
> > 
> > Simple appending will not work, the extra binaries must be under the '[binaries]'
> > section (maybe reordering the sections in the cross-compilation.conf.in template
> > will work)
> 
>  It should work if the [binaries] part is at the end, right? And if binaries is
> empty, that's OK, no?
> 
>  Alternatively, the [binaries] part could be included in the _TARGET_BINARIES
> (which would then have to be renamed to _CROSS_COMPILATION_CONF). So for a
> package that needs libgcrypt-config, it would be
> 
> define FOO_CROSS_COMPILATION_CONF
> [binaries]
> libgcrypt-config = '$(STAGING_DIR)/usr/bin/libgcrypt-config'
> endef
> 
> > , does the printf approach fix the newline problem for more than one
> > entry?
> 
>  It does, but you can't use _CROSS_COMPILATION_CONF = ..., you have to use
> define, because the actual newlines have to be in the variable itself. Actually,
> you can still use = assignment, but then you need to use $(sep), i.e.:
> 
> FOO_CROSS_COMPILATION_CONF = [binaries]$(sep)libgcrypt-config =
> '$(STAGING_DIR)/usr/bin/libgcrypt-config'$(sep)
> 
> (which is ugly so don't do that :-)

The package using the meson infrastructure defines:

   define libfoo_MESON_CROSS_CONF_BINARIES
   libgcrypt-config = '$(STAGING_DIR)/usr/bin/libgcrypt-config'
   llvm-config = '$(STAGING_DIR)/usr/bin/llvm-config'
   endef

pkg-meson.mk is using PRINTF to a temporary file and sed is using this
file as input for appending to the [binaries section]:

   $Q$$(if $$($$(PKG)_MESON_CROSS_CONF_BINARIES), \
   	$$(call PRINTF,$$($$(PKG)_MESON_CROSS_CONF_BINARIES))) \
   	> $$($$(PKG)_SRCDIR)/build/cross-binaries.tmp
   sed -i "s/^[ \t]*//" $$($$(PKG)_SRCDIR)/build/cross-binaries.tmp
   sed -e "s%@TARGET_CROSS@%$$(TARGET_CROSS)%g" \
       ...
       -e  "/\[binaries\]/r $$($$(PKG)_SRCDIR)/build/cross-binaries.tmp" \
       package/meson/cross-compilation.conf.in \
       > $$($$(PKG)_SRCDIR)/build/cross-compilation.conf
   rm -f $$($$(PKG)_SRCDIR)/build/cross-binaries.tmp

Best regards
J?rg Krause

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [Buildroot] [PATCH 1/2] meson: add entry for libgcrypt-config in cross file
  2019-05-23 22:51                 ` Jörg Krause
@ 2019-05-24  8:18                   ` Arnout Vandecappelle
  2019-05-26  9:17                     ` Jörg Krause
  0 siblings, 1 reply; 21+ messages in thread
From: Arnout Vandecappelle @ 2019-05-24  8:18 UTC (permalink / raw)
  To: buildroot



On 24/05/2019 00:51, J?rg Krause wrote:
> Hi all,
> 
> thank you all for your ideas. Please take a look at my proposal
> below...
> 
> On Thu, 2019-05-02 at 14:17 +0200, Arnout Vandecappelle wrote:
>>
>> On 01/05/2019 21:04, Peter Seiderer wrote:
>>> Hello Arnout,
>>>
>>> On Wed, 1 May 2019 13:13:03 +0200, Arnout Vandecappelle <arnout@mind.be> wrote:
>>>
>>>> On 30/04/2019 13:04, J?rg Krause wrote:
>>>>> Hello Peter,
>>>>>
>>>>> On Tue, 2019-04-30 at 10:27 +0200, Peter Seiderer wrote:  
>>>> [snip]
>>>>>> Would have expected the trick/non-trivial thing to add more than one
>>>>>> binary entry (to get the newlines for the entries right)...  
>>>>>
>>>>> That's indeed a difficult case to solve. I didn't managed to get
>>>>> multpile binary entries added to the [binaries] field, e.g.
>>>>>
>>>>> PKG_TARGET_BINARIES = \
>>>>> 	libgcrypt-config = '...' \
>>>>> 	llvm-config = '...'
>>>>>
>>>>> .. will not work.
>>>>>
>>>>> I spent some time to find a magic rule which splits the Makefile
>>>>> variable into a proper newline seperated string which can be used by
>>>>> sed, but I failed.
>>>>>
>>>>> Maybe you have an idea?  
>>>>
>>>>  Instead of sed, use the PRINTF macro and append to the file:
>>>>
>>>> 	$Q$$(if $$($$(PKG)_TARGET_BINARIES),\
>>>> 		$$(call PRINTF,$$($$(PKG)_TARGET_BINARIES)) \
>>>> 		>> $$($$(PKG)_SRCDIR)/build/cross-compilation.conf  
>>>
>>> Simple appending will not work, the extra binaries must be under the '[binaries]'
>>> section (maybe reordering the sections in the cross-compilation.conf.in template
>>> will work)
>>
>>  It should work if the [binaries] part is at the end, right? And if binaries is
>> empty, that's OK, no?
>>
>>  Alternatively, the [binaries] part could be included in the _TARGET_BINARIES
>> (which would then have to be renamed to _CROSS_COMPILATION_CONF). So for a
>> package that needs libgcrypt-config, it would be
>>
>> define FOO_CROSS_COMPILATION_CONF
>> [binaries]
>> libgcrypt-config = '$(STAGING_DIR)/usr/bin/libgcrypt-config'
>> endef

 Is there any reason why this proposal doesn't work? AFAIU, it should be no
problem to repeat the '[binaries]' part several times, right?

 I'm insisting on this since I expect that we'll need to override something else
at some point as well.

>>> , does the printf approach fix the newline problem for more than one
>>> entry?
>>
>>  It does, but you can't use _CROSS_COMPILATION_CONF = ..., you have to use
>> define, because the actual newlines have to be in the variable itself. Actually,
>> you can still use = assignment, but then you need to use $(sep), i.e.:
>>
>> FOO_CROSS_COMPILATION_CONF = [binaries]$(sep)libgcrypt-config =
>> '$(STAGING_DIR)/usr/bin/libgcrypt-config'$(sep)
>>
>> (which is ugly so don't do that :-)
> 
> The package using the meson infrastructure defines:
> 
>    define libfoo_MESON_CROSS_CONF_BINARIES
>    libgcrypt-config = '$(STAGING_DIR)/usr/bin/libgcrypt-config'
>    llvm-config = '$(STAGING_DIR)/usr/bin/llvm-config'
>    endef
> 
> pkg-meson.mk is using PRINTF to a temporary file and sed is using this
> file as input for appending to the [binaries section]:
> 
>    $Q$$(if $$($$(PKG)_MESON_CROSS_CONF_BINARIES), \
>    	$$(call PRINTF,$$($$(PKG)_MESON_CROSS_CONF_BINARIES))) \
>    	> $$($$(PKG)_SRCDIR)/build/cross-binaries.tmp
>    sed -i "s/^[ \t]*//" $$($$(PKG)_SRCDIR)/build/cross-binaries.tmp

 I would rather have the PRINTF macro to be fixed not to insert these tabs. It's
just an artefact of how make works, and can be fairly easily fixed, either by
reordering the newlines in the PRINTF definition, or by putting a $(strip)
around it (although the latter has potential side effect since it also replaces
all internal whitespace with a single space).


>    sed -e "s%@TARGET_CROSS@%$$(TARGET_CROSS)%g" \
>        ...
>        -e  "/\[binaries\]/r $$($$(PKG)_SRCDIR)/build/cross-binaries.tmp" \

 Not many people understand the r command which makes this hard to read, but
it's acceptable for me.

>        package/meson/cross-compilation.conf.in \
>        > $$($$(PKG)_SRCDIR)/build/cross-compilation.conf
>    rm -f $$($$(PKG)_SRCDIR)/build/cross-binaries.tmp


 Maybe, however, we should drop the cross-compilation.conf.in and generate
everything with PRINTF (assuming that PRINTF gets fixed first, of course):

define meson_cross_compilation_conf_template
# Note: Buildroot's and Meson's terminologies differ about the meaning
# of 'build', 'host' and 'target':
# - Buildroot's 'host' is Meson's 'build'
# - Buildroot's 'target' is Meson's 'host'

[binaries]
c = '$(TARGET_CROSS)gcc'
cpp = '$(TARGET_CROSS)g++'
ar = '$(TARGET_CROSS)ar'
strip = '$(TARGET_CROSS)strip'
pkgconfig = '$(HOST_DIR)/usr/bin/pkg-config'
$($(PKG)_MESON_CROSS_CONF_BINARIES)

[properties]
needs_exe_wrapper = true
...
endef


	$(call PRINTF,$(meson_cross_compilation_conf_template)) \
		> $$($$(PKG)_SRCDIR)/build/cross-compilation.conf


(Note: even with the above, I would prefer to have a $($(PKG)_MESON_CROSS_CONF)
that gets appended at the end and that has the [binaries] embedded in it; the
above is assuming that that doesn't work for some reason.)


 Regards,
 Arnout

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [Buildroot] [PATCH 1/2] meson: add entry for libgcrypt-config in cross file
  2019-05-24  8:18                   ` Arnout Vandecappelle
@ 2019-05-26  9:17                     ` Jörg Krause
  0 siblings, 0 replies; 21+ messages in thread
From: Jörg Krause @ 2019-05-26  9:17 UTC (permalink / raw)
  To: buildroot

Hi,

On Fri, 2019-05-24 at 10:18 +0200, Arnout Vandecappelle wrote:
> 
> On 24/05/2019 00:51, J?rg Krause wrote:
> > Hi all,
> > 
> > thank you all for your ideas. Please take a look at my proposal
> > below...
> > 
> > On Thu, 2019-05-02 at 14:17 +0200, Arnout Vandecappelle wrote:
> > > On 01/05/2019 21:04, Peter Seiderer wrote:
> > > > Hello Arnout,
> > > > 
> > > > On Wed, 1 May 2019 13:13:03 +0200, Arnout Vandecappelle <arnout@mind.be> wrote:
> > > > 
> > > > > On 30/04/2019 13:04, J?rg Krause wrote:
> > > > > > Hello Peter,
> > > > > > 
> > > > > > On Tue, 2019-04-30 at 10:27 +0200, Peter Seiderer wrote:  
> > > > > [snip]
> > > > > > > Would have expected the trick/non-trivial thing to add more than one
> > > > > > > binary entry (to get the newlines for the entries right)...  
> > > > > > 
> > > > > > That's indeed a difficult case to solve. I didn't managed to get
> > > > > > multpile binary entries added to the [binaries] field, e.g.
> > > > > > 
> > > > > > PKG_TARGET_BINARIES = \
> > > > > > 	libgcrypt-config = '...' \
> > > > > > 	llvm-config = '...'
> > > > > > 
> > > > > > .. will not work.
> > > > > > 
> > > > > > I spent some time to find a magic rule which splits the Makefile
> > > > > > variable into a proper newline seperated string which can be used by
> > > > > > sed, but I failed.
> > > > > > 
> > > > > > Maybe you have an idea?  
> > > > > 
> > > > >  Instead of sed, use the PRINTF macro and append to the file:
> > > > > 
> > > > > 	$Q$$(if $$($$(PKG)_TARGET_BINARIES),\
> > > > > 		$$(call PRINTF,$$($$(PKG)_TARGET_BINARIES)) \
> > > > > 		>> $$($$(PKG)_SRCDIR)/build/cross-compilation.conf  
> > > > 
> > > > Simple appending will not work, the extra binaries must be under the '[binaries]'
> > > > section (maybe reordering the sections in the cross-compilation.conf.in template
> > > > will work)
> > > 
> > >  It should work if the [binaries] part is at the end, right? And if binaries is
> > > empty, that's OK, no?
> > > 
> > >  Alternatively, the [binaries] part could be included in the _TARGET_BINARIES
> > > (which would then have to be renamed to _CROSS_COMPILATION_CONF). So for a
> > > package that needs libgcrypt-config, it would be
> > > 
> > > define FOO_CROSS_COMPILATION_CONF
> > > [binaries]
> > > libgcrypt-config = '$(STAGING_DIR)/usr/bin/libgcrypt-config'
> > > endef
> 
>  Is there any reason why this proposal doesn't work? AFAIU, it should be no
> problem to repeat the '[binaries]' part several times, right?

Meson does not accept the same section name more than once. It fails
with:

configparser.DuplicateSectionError: While reading from '/buildroot/output/build/mpd-0.21.9//build/cross-compilation.conf' [line 26]
: section 'binaries' already exists
FAILED: build.ninja

>  I'm insisting on this since I expect that we'll need to override something else
> at some point as well.
> 
> > > > , does the printf approach fix the newline problem for more than one
> > > > entry?
> > > 
> > >  It does, but you can't use _CROSS_COMPILATION_CONF = ..., you have to use
> > > define, because the actual newlines have to be in the variable itself. Actually,
> > > you can still use = assignment, but then you need to use $(sep), i.e.:
> > > 
> > > FOO_CROSS_COMPILATION_CONF = [binaries]$(sep)libgcrypt-config =
> > > '$(STAGING_DIR)/usr/bin/libgcrypt-config'$(sep)
> > > 
> > > (which is ugly so don't do that :-)
> > 
> > The package using the meson infrastructure defines:
> > 
> >    define libfoo_MESON_CROSS_CONF_BINARIES
> >    libgcrypt-config = '$(STAGING_DIR)/usr/bin/libgcrypt-config'
> >    llvm-config = '$(STAGING_DIR)/usr/bin/llvm-config'
> >    endef
> > 
> > pkg-meson.mk is using PRINTF to a temporary file and sed is using this
> > file as input for appending to the [binaries section]:
> > 
> >    $Q$$(if $$($$(PKG)_MESON_CROSS_CONF_BINARIES), \
> >    	$$(call PRINTF,$$($$(PKG)_MESON_CROSS_CONF_BINARIES))) \
> >    	> $$($$(PKG)_SRCDIR)/build/cross-binaries.tmp
> >    sed -i "s/^[ \t]*//" $$($$(PKG)_SRCDIR)/build/cross-binaries.tmp
> 
>  I would rather have the PRINTF macro to be fixed not to insert these tabs. It's
> just an artefact of how make works, and can be fairly easily fixed, either by
> reordering the newlines in the PRINTF definition, or by putting a $(strip)
> around it (although the latter has potential side effect since it also replaces
> all internal whitespace with a single space).

I see! So, this should be fixed first.

> >    sed -e "s%@TARGET_CROSS@%$$(TARGET_CROSS)%g" \
> >        ...
> >        -e  "/\[binaries\]/r $$($$(PKG)_SRCDIR)/build/cross-binaries.tmp" \
> 
>  Not many people understand the r command which makes this hard to read, but
> it's acceptable for me.
> 
> >        package/meson/cross-compilation.conf.in \
> >        > $$($$(PKG)_SRCDIR)/build/cross-compilation.conf
> >    rm -f $$($$(PKG)_SRCDIR)/build/cross-binaries.tmp
> 
>  Maybe, however, we should drop the cross-compilation.conf.in and generate
> everything with PRINTF (assuming that PRINTF gets fixed first, of course):
> 
> define meson_cross_compilation_conf_template
> # Note: Buildroot's and Meson's terminologies differ about the meaning
> # of 'build', 'host' and 'target':
> # - Buildroot's 'host' is Meson's 'build'
> # - Buildroot's 'target' is Meson's 'host'
> 
> [binaries]
> c = '$(TARGET_CROSS)gcc'
> cpp = '$(TARGET_CROSS)g++'
> ar = '$(TARGET_CROSS)ar'
> strip = '$(TARGET_CROSS)strip'
> pkgconfig = '$(HOST_DIR)/usr/bin/pkg-config'
> $($(PKG)_MESON_CROSS_CONF_BINARIES)
> 
> [properties]
> needs_exe_wrapper = true
> ...
> endef
> 
> 
> 	$(call PRINTF,$(meson_cross_compilation_conf_template)) \
> 		> $$($$(PKG)_SRCDIR)/build/cross-compilation.conf
> 
> 
> (Note: even with the above, I would prefer to have a $($(PKG)_MESON_CROSS_CONF)
> that gets appended at the end and that has the [binaries] embedded in it; the
> above is assuming that that doesn't work for some reason.)

As Meson does not accept duplicated sections, $($(PKG)_MESON_CROSS_CONF
isn't an option. So, what does others think about:

a) using seds 'r' command?
b) drop the cross-compilation.conf.in and generate everything with
PRINTF?
c) Something else

Best regards
J?rg Krause

^ permalink raw reply	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2019-05-26  9:17 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-03 18:32 [Buildroot] [PATCH 1/2] meson: add entry for libgcrypt-config in cross file Jörg Krause
2019-04-03 18:32 ` [Buildroot] [PATCH 2/2] package/mpd: bump to version 0.21.7 Jörg Krause
2019-04-03 19:33 ` [Buildroot] [PATCH 1/2] meson: add entry for libgcrypt-config in cross file Thomas Petazzoni
2019-04-05  6:58   ` Jörg Krause
2019-04-13 16:24 ` Thomas Petazzoni
2019-04-23 21:29   ` Peter Seiderer
2019-04-24 11:09     ` Jörg Krause
2019-04-30  8:11     ` Jörg Krause
2019-04-30  8:27       ` Peter Seiderer
2019-04-30 11:04         ` Jörg Krause
2019-05-01 11:13           ` Arnout Vandecappelle
2019-05-01 19:04             ` Peter Seiderer
2019-05-02 12:17               ` Arnout Vandecappelle
2019-05-02 20:02                 ` Peter Seiderer
2019-05-03  9:21                   ` Arnout Vandecappelle
2019-05-23 22:51                 ` Jörg Krause
2019-05-24  8:18                   ` Arnout Vandecappelle
2019-05-26  9:17                     ` Jörg Krause
2019-05-01 19:23             ` Peter Seiderer
2019-05-01 19:36             ` Thomas Petazzoni
2019-05-02 12:20               ` Arnout Vandecappelle

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.