meson.eclass: clean up meson_src_configure
authorMike Gilbert <floppym@gentoo.org>
Wed, 8 Apr 2020 20:25:28 +0000 (16:25 -0400)
committerMike Gilbert <floppym@gentoo.org>
Sun, 12 Apr 2020 15:20:11 +0000 (11:20 -0400)
This mainly rearranges some code to make it easier to read.
Also changes the bare 'meson' call to 'meson setup'.

Signed-off-by: Mike Gilbert <floppym@gentoo.org>
eclass/meson.eclass

index 16e17dd4a384f5c7b3cd0171735f1e6e0374104b..3e3a2e2f7a2e477d9f789df1ea5dd002d94578bd 100644 (file)
@@ -219,32 +219,42 @@ meson_feature() {
 meson_src_configure() {
        debug-print-function ${FUNCNAME} "$@"
 
-       # Common args
        local mesonargs=(
+               meson setup
                --buildtype plain
                --libdir "$(get_libdir)"
                --localstatedir "${EPREFIX}/var/lib"
                --prefix "${EPREFIX}/usr"
                --sysconfdir "${EPREFIX}/etc"
                --wrap-mode nodownload
-               )
+       )
 
        if tc-is-cross-compiler || [[ ${ABI} != ${DEFAULT_ABI-${ABI}} ]]; then
                _meson_create_cross_file || die "unable to write meson cross file"
                mesonargs+=( --cross-file "${T}/meson.${CHOST}.${ABI}" )
        fi
 
+       BUILD_DIR="${BUILD_DIR:-${WORKDIR}/${P}-build}"
+
+       mesonargs+=(
+               # Arguments from ebuild
+               "${emesonargs[@]}"
+
+               # Arguments passed to this function
+               "$@"
+
+               # Source directory
+               "${EMESON_SOURCE:-${S}}"
+
+               # Build directory
+               "${BUILD_DIR}"
+       )
+
        # https://bugs.gentoo.org/625396
        python_export_utf8_locale
 
-       # Append additional arguments from ebuild
-       mesonargs+=("${emesonargs[@]}")
-
-       BUILD_DIR="${BUILD_DIR:-${WORKDIR}/${P}-build}"
-       set -- meson "${mesonargs[@]}" "$@" \
-               "${EMESON_SOURCE:-${S}}" "${BUILD_DIR}"
-       echo "$@"
-       tc-env_build "$@" || die
+       echo "${mesonargs[@]}" >&2
+       tc-env_build "${mesonargs[@]}" || die
 }
 
 # @FUNCTION: meson_src_compile