Skip to content

Commit

Permalink
meson: update to 0.45
Browse files Browse the repository at this point in the history
- generate cross-file per package, needed since mesonbuild/meson#1807 to use changed build-flags
  • Loading branch information
InuSasha committed Mar 21, 2018
1 parent 9da5d48 commit d38cada
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 76 deletions.
73 changes: 31 additions & 42 deletions config/functions
Original file line number Diff line number Diff line change
Expand Up @@ -79,27 +79,6 @@ setup_toolchain() {
echo "SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)" >> $CMAKE_CONF
echo "SET(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)" >> $CMAKE_CONF
fi
export MESON_CONF=$TOOLCHAIN/etc/meson-$TARGET_NAME.conf
if [ ! -f $MESON_CONF ] ; then
mkdir -p $TOOLCHAIN/etc
echo "[binaries]" >> $MESON_CONF
echo "c = '$CC'" >> $MESON_CONF
echo "cpp = '$CXX'" >> $MESON_CONF
echo "ar = '$AR'" >> $MESON_CONF
echo "strip = '$STRIP'" >> $MESON_CONF
echo "pkgconfig = '$PKG_CONFIG'" >> $MESON_CONF
echo "" >> $MESON_CONF
echo "[host_machine]" >> $MESON_CONF
echo "system = 'linux'" >> $MESON_CONF
echo "cpu_family = '$TARGET_ARCH'" >> $MESON_CONF
echo "cpu = '$TARGET_SUBARCH'" >> $MESON_CONF
echo "endian = 'little'" >> $MESON_CONF
echo "" >> $MESON_CONF
echo "[properties]" >> $MESON_CONF
echo "root = '$SYSROOT_PREFIX/usr'" >> $MESON_CONF
python -c "import os; print('c_args = {}'.format([x for x in os.getenv('CFLAGS').split()]))" >> $MESON_CONF
python -c "import os; print('c_link_args = {}'.format([x for x in os.getenv('LDFLAGS').split()]))" >> $MESON_CONF
fi
export HOST_CC="$TOOLCHAIN/bin/host-gcc"
export HOST_CXX="$TOOLCHAIN/bin/host-g++"
export HOSTCC="$HOST_CC"
Expand Down Expand Up @@ -152,27 +131,6 @@ setup_toolchain() {
echo "SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE BOTH)" >> $CMAKE_CONF
echo "SET(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE BOTH)" >> $CMAKE_CONF
fi
export MESON_CONF=$TOOLCHAIN/etc/meson-$HOST_NAME.conf
if [ ! -f $MESON_CONF ] ; then
mkdir -p $TOOLCHAIN/etc
echo "[binaries]" >> $MESON_CONF
echo "c = '$CC'" >> $MESON_CONF
echo "cpp = '$CXX'" >> $MESON_CONF
echo "ar = '$AR'" >> $MESON_CONF
echo "strip = '$STRIP'" >> $MESON_CONF
echo "pkgconfig = '$PKG_CONFIG'" >> $MESON_CONF
echo "" >> $MESON_CONF
echo "[host_machine]" >> $MESON_CONF
echo "system = 'linux'" >> $MESON_CONF
echo "cpu_family = '$TARGET_ARCH'" >> $MESON_CONF
echo "cpu = '$TARGET_SUBARCH'" >> $MESON_CONF
echo "endian = 'big'" >> $MESON_CONF
echo "" >> $MESON_CONF
echo "[properties]" >> $MESON_CONF
echo "root = '$TOOLCHAIN'" >> $MESON_CONF
python -c "import os; print('c_args = {}'.format([x for x in os.getenv('CFLAGS').split()]))" >> $MESON_CONF
python -c "import os; print('c_link_args = {}'.format([x for x in os.getenv('LDFLAGS').split()]))" >> $MESON_CONF
fi
export HOST_CC="$CC"
export HOST_CXX="$CXX"
export HOSTCC="$CC"
Expand All @@ -188,6 +146,37 @@ setup_toolchain() {
esac
}

create_meson_conf() {
local endian root conf
case "$1" in
target|init) endian="little"
root="$SYSROOT_PREFIX/usr"
;;
host|bootstrap) endian="big"

This comment has been minimized.

Copy link
@vpeter4

vpeter4 May 8, 2019

Contributor

Why is this big endian?

This comment has been minimized.

Copy link
@InuSasha

InuSasha May 8, 2019

Author Member

This comment has been minimized.

Copy link
@MilhouseVH

MilhouseVH May 9, 2019

Contributor

big endian doesn't make sense, as both x86_64 and ARM (by default) are little endian. I'll push a PR to change this. Thanks @vpeter4.

This comment has been minimized.

Copy link
@vpeter4

vpeter4 May 9, 2019

Contributor

Seems it doesn't set anything useful if with wrong value build binaries still works :-)

This comment has been minimized.

Copy link
@MilhouseVH

MilhouseVH May 9, 2019

Contributor

Yes, setting the wrong endian value probably isn't having any effect when the CPU is x86_64 - presumably meson is overriding with a sane value based on cpu_family/cpu or just ignoring the supplied value completely when the configured arch only supports little endian. It might have an effect on a bi-endian arch such as ARM, but setting big endian for x86_64 would not be valid in which case meson may do the right thing and always uses little.

I've pushed a PR which always sets endian to little as that's all we need for now (and is unlikely to change any time soon).

root="$TOOLCHAIN"
;;
esac

conf=$2
echo "[binaries]" > $conf
echo "c = '$CC'" >> $conf
echo "cpp = '$CXX'" >> $conf
echo "ar = '$AR'" >> $conf
echo "strip = '$STRIP'" >> $conf
echo "pkgconfig = '$PKG_CONFIG'" >> $conf
echo "" >> $conf
echo "[host_machine]" >> $conf
echo "system = 'linux'" >> $conf
echo "cpu_family = '$TARGET_ARCH'" >> $conf
echo "cpu = '$TARGET_SUBARCH'" >> $conf
echo "endian = '$endian'" >> $conf
echo "" >> $conf
echo "[properties]" >> $conf
echo "root = '$root'" >> $conf
python -c "import os; print('c_args = {}'.format([x for x in os.getenv('CFLAGS').split()]))" >> $conf
python -c "import os; print('c_link_args = {}'.format([x for x in os.getenv('LDFLAGS').split()]))" >> $conf
}

# unset all PKG_* vars apart from those exported by setup_toolchain, then set default values
reset_pkg_vars() {
local vars var
Expand Down
4 changes: 2 additions & 2 deletions packages/python/devel/meson/package.mk
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
################################################################################

PKG_NAME="meson"
PKG_VERSION="0.44.0"
PKG_SHA256="50f9b12b77272ef6ab064d26b7e06667f07fa9f931e6a20942bba2216ba4281b"
PKG_VERSION="0.45.0"
PKG_SHA256="3455abbc30a3fbd9cc8abb6d5fcdc42ce618665b95ac2c3ad7792a4a6ba47ce4"
PKG_ARCH="any"
PKG_LICENSE="Apache"
PKG_SITE="http://mesonbuild.com"
Expand Down
4 changes: 0 additions & 4 deletions packages/sysutils/systemd/package.mk
Original file line number Diff line number Diff line change
Expand Up @@ -106,10 +106,6 @@ PKG_MESON_OPTS_TARGET="--libdir=/usr/lib \
pre_configure_target() {
export CFLAGS="$CFLAGS -fno-schedule-insns -fno-schedule-insns2"
export LC_ALL=en_US.UTF-8

# meson needs a host compiler and it's detected through the environment. meh.
export CC="$HOST_CC"
export CXX="$HOST_CXX"
}

post_makeinstall_target() {
Expand Down
50 changes: 22 additions & 28 deletions scripts/build
Original file line number Diff line number Diff line change
Expand Up @@ -174,8 +174,7 @@ TARGET_MESON_OPTS="--prefix=/usr \
--libdir=/usr/lib \
--libexecdir=/usr/lib \
--localstatedir=/var \
--buildtype=$MESON_BUILD_TYPE \
--cross-file=$MESON_CONF"
--buildtype=$MESON_BUILD_TYPE"

# configure HOST build defaults
HOST_CONFIGURE_OPTS="--host=$HOST_NAME \
Expand All @@ -200,8 +199,7 @@ HOST_MESON_OPTS="--prefix=$TOOLCHAIN \
--libdir=$TOOLCHAIN/lib \
--libexecdir=$TOOLCHAIN/lib \
--localstatedir=$TOOLCHAIN/var \
--buildtype=plain \
--cross-file=$MESON_CONF"
--buildtype=plain"

# configure INIT build defaults
INIT_CONFIGURE_OPTS="$TARGET_CONFIGURE_OPTS"
Expand Down Expand Up @@ -321,23 +319,15 @@ cd $PKG_BUILD

if [ -f "$PKG_CONFIGURE_SCRIPT" -o -f "$PKG_CMAKE_SCRIPT" -o -f "$PKG_MESON_SCRIPT" ]; then
case "$TARGET" in
"target")
mkdir -p .$TARGET_NAME
cd .$TARGET_NAME
;;
"host")
mkdir -p .$HOST_NAME
cd .$HOST_NAME
;;
"init")
mkdir -p .$TARGET_NAME-$TARGET
cd .$TARGET_NAME-$TARGET
;;
"bootstrap")
mkdir -p .$HOST_NAME-$TARGET
cd .$HOST_NAME-$TARGET
;;
"target") PKG_REAL_BUILD="$PKG_BUILD/.$TARGET_NAME" ;;
"host") PKG_REAL_BUILD="$PKG_BUILD/.$HOST_NAME" ;;
"init") PKG_REAL_BUILD="$PKG_BUILD/.$TARGET_NAME-$TARGET" ;;
"bootstrap") PKG_REAL_BUILD="$PKG_BUILD/.$HOST_NAME-$TARGET" ;;
esac
mkdir -p $PKG_REAL_BUILD
cd $PKG_REAL_BUILD

MESON_CONF="$PKG_REAL_BUILD/meson.conf"
fi

# configure
Expand All @@ -350,20 +340,24 @@ else
case "$PKG_TOOLCHAIN:$TARGET" in
# meson builds
"meson:target")
echo "Executing (target): meson $TARGET_MESON_OPTS $PKG_MESON_OPTS_TARGET $(dirname $PKG_MESON_SCRIPT)" | tr -s " "
CC="$HOST_CC" CXX="$HOST_CXX" meson $TARGET_MESON_OPTS $PKG_MESON_OPTS_TARGET $(dirname $PKG_MESON_SCRIPT)
create_meson_conf $TARGET $MESON_CONF
echo "Executing (target): meson $TARGET_MESON_OPTS --cross-file=$MESON_CONF $PKG_MESON_OPTS_TARGET $(dirname $PKG_MESON_SCRIPT)" | tr -s " "
CC="$HOST_CC" CXX="$HOST_CXX" meson $TARGET_MESON_OPTS --cross-file=$MESON_CONF $PKG_MESON_OPTS_TARGET $(dirname $PKG_MESON_SCRIPT)
;;
"meson:host")
echo "Executing (host): meson $HOST_MESON_OPTS $PKG_MESON_OPTS_HOST $(dirname $PKG_MESON_SCRIPT)" | tr -s " "
meson $HOST_MESON_OPTS $PKG_MESON_OPTS_HOST $(dirname $PKG_MESON_SCRIPT)
create_meson_conf $TARGET $MESON_CONF
echo "Executing (host): meson $HOST_MESON_OPTS --cross-file=$MESON_CONF $PKG_MESON_OPTS_HOST $(dirname $PKG_MESON_SCRIPT)" | tr -s " "
meson $HOST_MESON_OPTS --cross-file=$MESON_CONF $PKG_MESON_OPTS_HOST $(dirname $PKG_MESON_SCRIPT)
;;
"meson:init")
echo "Executing (init): meson $INIT_MESON_OPTS $PKG_MESON_OPTS_INIT $(dirname $PKG_MESON_SCRIPT)" | tr -s " "
meson $INIT_MESON_OPTS $PKG_MESON_OPTS_INIT $(dirname $PKG_MESON_SCRIPT)
create_meson_conf $TARGET $MESON_CONF
echo "Executing (init): meson $INIT_MESON_OPTS --cross-file=$MESON_CONF $PKG_MESON_OPTS_INIT $(dirname $PKG_MESON_SCRIPT)" | tr -s " "
meson $INIT_MESON_OPTS --cross-file=$MESON_CONF $PKG_MESON_OPTS_INIT $(dirname $PKG_MESON_SCRIPT)
;;
"meson:bootstrap")
echo "Executing (bootstrap): meson $BOOTSTRAP_MESON_OPTS $PKG_MESON_OPTS_BOOTSTRAP $(dirname $PKG_MESON_SCRIPT)" | tr -s " "
meson $BOOTSTRAP_MESON_OPTS $PKG_MESON_OPTS_BOOTSTRAP $(dirname $PKG_MESON_SCRIPT)
create_meson_conf $TARGET $MESON_CONF
echo "Executing (bootstrap): meson $BOOTSTRAP_MESON_OPTS --cross-file=$MESON_CONF $PKG_MESON_OPTS_BOOTSTRAP $(dirname $PKG_MESON_SCRIPT)" | tr -s " "
meson $BOOTSTRAP_MESON_OPTS --cross-file=$MESON_CONF $PKG_MESON_OPTS_BOOTSTRAP $(dirname $PKG_MESON_SCRIPT)
;;

# cmake builds with ninja
Expand Down

0 comments on commit d38cada

Please sign in to comment.