Message ID | 20180719204355.10465-2-ps.report@gmx.net |
---|---|
State | Superseded |
Headers | show |
Series | [RFC,v3,1/4] meson: bump version to 0.47.1 | expand |
On 2018-07-19 22:43, Peter Seiderer wrote: > 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. > > Signed-off-by: Peter Seiderer <ps.report@gmx.net> Tested-by: Eric Le Bihan <eric.le.bihan.dev@free.fr> -- ELB
Hello, On Thu, 19 Jul 2018 22:43:53 +0200, Peter Seiderer wrote: > -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 I am not super happy with this approach, because this file is not meant to be used just during the build of Buildroot packages, but potentially after the Buildroot build is finished, for people to easily cross-compile Meson-based software manually. To me, this file is similar to toolchainfile.cmake that pkg-cmake.mk is installing, and which allows to easily cross-compile stuff with CMake outside of Buildroot, using the Buildroot generated toolchain. So I would prefer to: - Move this file to $(HOST_DIR)/usr/share/buildroot/meson-cross-compilation.conf or something like that, so that we are a bit consistent with what we do for CMake. - Keep it directly usable. - Pass the additional CFLAGS/LDFLAGS to packages on the command line rather than through this file. https://mesonbuild.com/howtox.html#set-extra-compiler-and-linker-flags-from-the-outside-when-eg-building-distro-packages seems to say this is possible, no ? Or does it override the ones from the cross-compilation.conf ? Thanks! Thomas
Hello Thomas, On Thu, 16 Aug 2018 13:57:45 +0200, Thomas Petazzoni <thomas.petazzoni@bootlin.com> wrote: > Hello, > > On Thu, 19 Jul 2018 22:43:53 +0200, Peter Seiderer wrote: > > > -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 > > I am not super happy with this approach, because this file is not meant > to be used just during the build of Buildroot packages, but potentially > after the Buildroot build is finished, for people to easily > cross-compile Meson-based software manually. To me, this file is > similar to toolchainfile.cmake that pkg-cmake.mk is installing, and > which allows to easily cross-compile stuff with CMake outside of > Buildroot, using the Buildroot generated toolchain. > > So I would prefer to: > > - Move this file to > $(HOST_DIR)/usr/share/buildroot/meson-cross-compilation.conf or > something like that, so that we are a bit consistent with what we do > for CMake. > > - Keep it directly usable. > > - Pass the additional CFLAGS/LDFLAGS to packages on the command line > rather than through this file. > https://mesonbuild.com/howtox.html#set-extra-compiler-and-linker-flags-from-the-outside-when-eg-building-distro-packages > seems to say this is possible, no ? Or does it override the ones > from the cross-compilation.conf ? The CFLAGS are ignored, e.g. with 'LIBDRM_CONF_ENV += CFLAGS=-DAO_NO_SPARC_V9' in package/libdrm/libdrm.mk: $ make libdrm V=1 [...] ... CFLAGS=-DAO_NO_SPARC_V9 host/bin/meson --prefix=/usr --libdir=lib --default-library=shared --buildtype=debug --cross-file=.../host/etc/meson/cross-compilation.conf -Dcairo-tests=false -Dmanpages=false -Dintel=false -Dradeon=true -Damdgpu=true -Dnouveau=true -Dvmwgfx=false -Domap=false -Detnaviv=true -Dexynos=false -Dfreedreno=false -Dtegra=false -Dvc4=false -Dudev=true -Dvalgrind=false -Dinstall-test-programs=true .../build/libdrm-2.4.93/ .../build/libdrm-2.4.93//build The Meson build system Version: 0.47.1 Source dir: .../build/libdrm-2.4.93 Build dir: .../build/libdrm-2.4.93/build Build type: cross build WARNING: Unknown options: "manpages" Project name: libdrm Project version: 2.4.93 Appending CFLAGS from environment: '-DAO_NO_SPARC_V9' Appending CFLAGS from environment: '-DAO_NO_SPARC_V9' Native C compiler: cc (gcc 8.1.1 "cc (SUSE Linux) 8.1.1 20180719 [gcc-8-branch revision 262874]") Cross C compiler: /home/seiderer/Work/Buildroot/build_libdrm_c99/host/bin/sparc-linux-gcc (gcc 6.4.0) [...] [1/104] .../host/bin/sparc-linux-gcc -Ilibkms/libkms@@kms@sha -Ilibkms -I../libkms -I. -I../ -I../include/drm -fdiagnostics-color=always -pipe -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -std=gnu99 -O0 -g -include config.h -fPIC -Wall -Wextra -Wsign-compare -Werror=undef -Werror-implicit-function-declaration -Wpointer-arith -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wnested-externs -Wpacked -Wswitch-enum -Wmissing-format-attribute -Wstrict-aliasing=2 -Winit-self -Winline -Wshadow -Wdeclaration-after-statement -Wold-style-definition -Wno-unused-parameter -Wno-attributes -Wno-long-long -Wno-missing-field-initializers -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -Os -g2 -MD -MQ 'libkms/libkms@@kms@sha/api.c.o' -MF 'libkms/libkms@@kms@sha/api.c.o.d' -o 'libkms/libkms@@kms@sha/api.c.o' -c ../libkms/api.c Only the c_args from cross-compilation.conf ('-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -Os -g2') are used (in contrast to the 'Appending CFLAGS from environment' message)... Regards, Peter > > Thanks! > > Thomas
Peter, All, On 2018-08-19 01:15 +0200, Peter Seiderer spake thusly: > On Thu, 16 Aug 2018 13:57:45 +0200, Thomas Petazzoni <thomas.petazzoni@bootlin.com> wrote: > > On Thu, 19 Jul 2018 22:43:53 +0200, Peter Seiderer wrote: > > > -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 > > > > I am not super happy with this approach, because this file is not meant > > to be used just during the build of Buildroot packages, but potentially > > after the Buildroot build is finished, for people to easily > > cross-compile Meson-based software manually. To me, this file is > > similar to toolchainfile.cmake that pkg-cmake.mk is installing, and > > which allows to easily cross-compile stuff with CMake outside of > > Buildroot, using the Buildroot generated toolchain. > > > > So I would prefer to: > > > > - Move this file to > > $(HOST_DIR)/usr/share/buildroot/meson-cross-compilation.conf or > > something like that, so that we are a bit consistent with what we do > > for CMake. > > > > - Keep it directly usable. > > > > - Pass the additional CFLAGS/LDFLAGS to packages on the command line > > rather than through this file. > > https://mesonbuild.com/howtox.html#set-extra-compiler-and-linker-flags-from-the-outside-when-eg-building-distro-packages > > seems to say this is possible, no ? Or does it override the ones > > from the cross-compilation.conf ? > > The CFLAGS are ignored, e.g. with 'LIBDRM_CONF_ENV += CFLAGS=-DAO_NO_SPARC_V9' in package/libdrm/libdrm.mk: What if you _also_ pass them in LIBDRM_NINJA_ENV ? Regards, Yann E. MORIN. > $ make libdrm V=1 > [...] > > ... CFLAGS=-DAO_NO_SPARC_V9 host/bin/meson --prefix=/usr --libdir=lib --default-library=shared --buildtype=debug --cross-file=.../host/etc/meson/cross-compilation.conf -Dcairo-tests=false -Dmanpages=false -Dintel=false -Dradeon=true -Damdgpu=true -Dnouveau=true -Dvmwgfx=false -Domap=false -Detnaviv=true -Dexynos=false -Dfreedreno=false -Dtegra=false -Dvc4=false -Dudev=true -Dvalgrind=false -Dinstall-test-programs=true .../build/libdrm-2.4.93/ .../build/libdrm-2.4.93//build > The Meson build system > Version: 0.47.1 > Source dir: .../build/libdrm-2.4.93 > Build dir: .../build/libdrm-2.4.93/build > Build type: cross build > WARNING: Unknown options: "manpages" > Project name: libdrm > Project version: 2.4.93 > Appending CFLAGS from environment: '-DAO_NO_SPARC_V9' > Appending CFLAGS from environment: '-DAO_NO_SPARC_V9' > Native C compiler: cc (gcc 8.1.1 "cc (SUSE Linux) 8.1.1 20180719 [gcc-8-branch revision 262874]") > Cross C compiler: /home/seiderer/Work/Buildroot/build_libdrm_c99/host/bin/sparc-linux-gcc (gcc 6.4.0) > > [...] > > [1/104] .../host/bin/sparc-linux-gcc -Ilibkms/libkms@@kms@sha -Ilibkms -I../libkms -I. -I../ -I../include/drm -fdiagnostics-color=always -pipe -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -std=gnu99 -O0 -g -include config.h -fPIC -Wall -Wextra -Wsign-compare -Werror=undef -Werror-implicit-function-declaration -Wpointer-arith -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wnested-externs -Wpacked -Wswitch-enum -Wmissing-format-attribute -Wstrict-aliasing=2 -Winit-self -Winline -Wshadow -Wdeclaration-after-statement -Wold-style-definition -Wno-unused-parameter -Wno-attributes -Wno-long-long -Wno-missing-field-initializers -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -Os -g2 -MD -MQ 'libkms/libkms@@kms@sha/api.c.o' -MF 'libkms/libkms@@kms@sha/api.c.o.d' -o 'libkms/libkms@@kms@sha/api.c.o' -c ../libkms/api.c > > Only the c_args from cross-compilation.conf ('-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -Os -g2') > are used (in contrast to the 'Appending CFLAGS from environment' message)... > > Regards, > Peter > > > > > Thanks! > > > > Thomas >
Hello, On Sun, 19 Aug 2018 01:15:12 +0200, Peter Seiderer wrote: > The CFLAGS are ignored, e.g. with 'LIBDRM_CONF_ENV += CFLAGS=-DAO_NO_SPARC_V9' in package/libdrm/libdrm.mk: > > $ make libdrm V=1 It seems weird, no? It is documented to be working, and even at runtime it tells you "I am going to use those additional CFLAGS". Isn't this a bug or a misuse of meson from us ? I would really prefer to understand what is going on here instead of having to generate per-package .conf files. Thanks! Thomas
Hello Yann, On Sun, 19 Aug 2018 11:22:15 +0200, "Yann E. MORIN" <yann.morin.1998@free.fr> wrote: > Peter, All, > > On 2018-08-19 01:15 +0200, Peter Seiderer spake thusly: > > On Thu, 16 Aug 2018 13:57:45 +0200, Thomas Petazzoni <thomas.petazzoni@bootlin.com> wrote: > > > On Thu, 19 Jul 2018 22:43:53 +0200, Peter Seiderer wrote: > > > > -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 > > > > > > I am not super happy with this approach, because this file is not meant > > > to be used just during the build of Buildroot packages, but potentially > > > after the Buildroot build is finished, for people to easily > > > cross-compile Meson-based software manually. To me, this file is > > > similar to toolchainfile.cmake that pkg-cmake.mk is installing, and > > > which allows to easily cross-compile stuff with CMake outside of > > > Buildroot, using the Buildroot generated toolchain. > > > > > > So I would prefer to: > > > > > > - Move this file to > > > $(HOST_DIR)/usr/share/buildroot/meson-cross-compilation.conf or > > > something like that, so that we are a bit consistent with what we do > > > for CMake. > > > > > > - Keep it directly usable. > > > > > > - Pass the additional CFLAGS/LDFLAGS to packages on the command line > > > rather than through this file. > > > https://mesonbuild.com/howtox.html#set-extra-compiler-and-linker-flags-from-the-outside-when-eg-building-distro-packages > > > seems to say this is possible, no ? Or does it override the ones > > > from the cross-compilation.conf ? > > > > The CFLAGS are ignored, e.g. with 'LIBDRM_CONF_ENV += CFLAGS=-DAO_NO_SPARC_V9' in package/libdrm/libdrm.mk: > > What if you _also_ pass them in LIBDRM_NINJA_ENV ? > No difference... Regards, Peter > Regards, > Yann E. MORIN. > > > $ make libdrm V=1 > > [...] > > > > ... CFLAGS=-DAO_NO_SPARC_V9 host/bin/meson --prefix=/usr --libdir=lib --default-library=shared --buildtype=debug --cross-file=.../host/etc/meson/cross-compilation.conf -Dcairo-tests=false -Dmanpages=false -Dintel=false -Dradeon=true -Damdgpu=true -Dnouveau=true -Dvmwgfx=false -Domap=false -Detnaviv=true -Dexynos=false -Dfreedreno=false -Dtegra=false -Dvc4=false -Dudev=true -Dvalgrind=false -Dinstall-test-programs=true .../build/libdrm-2.4.93/ .../build/libdrm-2.4.93//build > > The Meson build system > > Version: 0.47.1 > > Source dir: .../build/libdrm-2.4.93 > > Build dir: .../build/libdrm-2.4.93/build > > Build type: cross build > > WARNING: Unknown options: "manpages" > > Project name: libdrm > > Project version: 2.4.93 > > Appending CFLAGS from environment: '-DAO_NO_SPARC_V9' > > Appending CFLAGS from environment: '-DAO_NO_SPARC_V9' > > Native C compiler: cc (gcc 8.1.1 "cc (SUSE Linux) 8.1.1 20180719 [gcc-8-branch revision 262874]") > > Cross C compiler: /home/seiderer/Work/Buildroot/build_libdrm_c99/host/bin/sparc-linux-gcc (gcc 6.4.0) > > > > [...] > > > > [1/104] .../host/bin/sparc-linux-gcc -Ilibkms/libkms@@kms@sha -Ilibkms -I../libkms -I. -I../ -I../include/drm -fdiagnostics-color=always -pipe -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -std=gnu99 -O0 -g -include config.h -fPIC -Wall -Wextra -Wsign-compare -Werror=undef -Werror-implicit-function-declaration -Wpointer-arith -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wnested-externs -Wpacked -Wswitch-enum -Wmissing-format-attribute -Wstrict-aliasing=2 -Winit-self -Winline -Wshadow -Wdeclaration-after-statement -Wold-style-definition -Wno-unused-parameter -Wno-attributes -Wno-long-long -Wno-missing-field-initializers -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -Os -g2 -MD -MQ 'libkms/libkms@@kms@sha/api.c.o' -MF 'libkms/libkms@@kms@sha/api.c.o.d' -o 'libkms/libkms@@kms@sha/api.c.o' -c ../libkms/api.c > > > > Only the c_args from cross-compilation.conf ('-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -Os -g2') > > are used (in contrast to the 'Appending CFLAGS from environment' message)... > > > > Regards, > > Peter > > > > > > > > Thanks! > > > > > > Thomas > > >
Hello Thomas, On Sun, 19 Aug 2018 15:22:06 +0200, Thomas Petazzoni <thomas.petazzoni@bootlin.com> wrote: > Hello, > > On Sun, 19 Aug 2018 01:15:12 +0200, Peter Seiderer wrote: > > > The CFLAGS are ignored, e.g. with 'LIBDRM_CONF_ENV += CFLAGS=-DAO_NO_SPARC_V9' in package/libdrm/libdrm.mk: > > > > $ make libdrm V=1 > > It seems weird, no? It is documented to be working, and even at runtime > it tells you "I am going to use those additional CFLAGS". Isn't this a > bug or a misuse of meson from us ? > Bug or feature of the cross-compilation.conf usage? Will take a look at the meson sources.... Regards, Peter > I would really prefer to understand what is going on here instead of > having to generate per-package .conf files. > > Thanks! > > Thomas
Hello Thomas, On Sun, 19 Aug 2018 19:15:11 +0200, Peter Seiderer <ps.report@gmx.net> wrote: > Hello Thomas, > > > On Sun, 19 Aug 2018 15:22:06 +0200, Thomas Petazzoni <thomas.petazzoni@bootlin.com> wrote: > > > Hello, > > > > On Sun, 19 Aug 2018 01:15:12 +0200, Peter Seiderer wrote: > > > > > The CFLAGS are ignored, e.g. with 'LIBDRM_CONF_ENV += CFLAGS=-DAO_NO_SPARC_V9' in package/libdrm/libdrm.mk: > > > > > > $ make libdrm V=1 > > > > It seems weird, no? It is documented to be working, and even at runtime > > it tells you "I am going to use those additional CFLAGS". Isn't this a > > bug or a misuse of meson from us ? > > > > Bug or feature of the cross-compilation.conf usage? Will take a look at > the meson sources.... Seems to be intentional, see mesonbuild/backend/backends.py#L542 ([1]): if not target.is_cross: # Compile args added from the env: CFLAGS/CXXFLAGS, etc. We want these # to override all the defaults, but not the per-target compile args. commands += self.environment.coredata.get_external_args(compiler.get_language()) With the 'if not target.is_cross' added with this commit [2] fixing [3] which suggests adding CROSS_*FLAGS... Regards, Peter [1] https://github.com/mesonbuild/meson/blob/master/mesonbuild/backend/backends.py#L542 [2] https://github.com/mesonbuild/meson/commit/b595cda4ed0ca699da3052a6bd30ba7d1dae1124 [3] https://github.com/mesonbuild/meson/issues/1772 > > Regards, > Peter > > > I would really prefer to understand what is going on here instead of > > having to generate per-package .conf files. > > > > Thanks! > > > > Thomas > > _______________________________________________ > buildroot mailing list > buildroot@busybox.net > http://lists.busybox.net/mailman/listinfo/buildroot
Hello, On Sun, 19 Aug 2018 21:49:17 +0200, Peter Seiderer wrote: > Seems to be intentional, see mesonbuild/backend/backends.py#L542 ([1]): > > if not target.is_cross: > # Compile args added from the env: CFLAGS/CXXFLAGS, etc. We want these > # to override all the defaults, but not the per-target compile args. > commands += self.environment.coredata.get_external_args(compiler.get_language()) > > With the 'if not target.is_cross' added with this commit [2] fixing [3] which > suggests adding CROSS_*FLAGS... > > Regards, > Peter > > [1] https://github.com/mesonbuild/meson/blob/master/mesonbuild/backend/backends.py#L542 > [2] https://github.com/mesonbuild/meson/commit/b595cda4ed0ca699da3052a6bd30ba7d1dae1124 > [3] https://github.com/mesonbuild/meson/issues/1772 Meh. This is plain silly, and completely inconsistent with what all other build systems do. The idea that CFLAGS should not be taken into account when cross-compiling is really stupid, as is "Cross build settings should come from the cross file and nowhere else". But well, OK, let's go with your solution then. I would still like a proper .conf file to be generated and move in usr/share/buildroot/, like the CMake file. Could you also complain in that bug report, to explain that really CFLAGS should be supported ? Thanks for the additional research! Thomas
diff --git a/package/meson/cross-compilation.conf.in b/package/meson/cross-compilation.conf.in index 0eec74087b..6af03314eb 100644 --- a/package/meson/cross-compilation.conf.in +++ b/package/meson/cross-compilation.conf.in @@ -11,10 +11,10 @@ strip = '@TARGET_CROSS@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' diff --git a/package/meson/meson.mk b/package/meson/meson.mk index d110e594f5..0f2ee2855d 100644 --- a/package/meson/meson.mk +++ b/package/meson/meson.mk @@ -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)) diff --git a/package/pkg-meson.mk b/package/pkg-meson.mk index 507e686068..565e10e8fb 100644 --- a/package/pkg-meson.mk +++ b/package/pkg-meson.mk @@ -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
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. Signed-off-by: Peter Seiderer <ps.report@gmx.net> --- Notes: - documentation change for new flags missing - use in pkg-meson.mk the same sed/printf for flags quotation mark and comma adding Changes v1 -> v2: - no changes Changes v2 -> v3: - no changes --- package/meson/cross-compilation.conf.in | 8 ++++---- package/meson/meson.mk | 6 +++--- package/pkg-meson.mk | 9 +++++++-- 3 files changed, 14 insertions(+), 9 deletions(-)