Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ninja/meson #10043

Merged
merged 2 commits into from Nov 1, 2019
Merged

ninja/meson #10043

merged 2 commits into from Nov 1, 2019

Conversation

dhewg
Copy link
Contributor

@dhewg dhewg commented Sep 21, 2019

This adds ninja/meson as host as well as target packages.

ninja.mk/meson.mk are provided for packages to use these tools, see the comments there how to use it.

libmpdclient/mpc are switched over from the gross autotools hack to meson. No further changes, but this should unblock updating the packages as well as sound/mpd.

Tested on boneblack and cubieboard2 (where one meson cross file is created per target in the host staging dir).

not tested:

  • c++ lib != libstdcpp done, ninja can only be built against libstdcpp
  • meson builds where native tools are built and executed during the build most likely done, added support for host packages, which uses the same config

not done:

  • ccache done, works

cc:
@br101 @ja-pa (earlier attempts openwrt/openwrt#2147 openwrt/openwrt#2312
@ynezz (handling the earlier attempts)
@diizzyy (using ninja with cmake)
@tstenner @lucize @flyn-org @neilwhelchel (building packages using meson)
@thess (libmpdclient/mpc/mpd maintainer)

@dhewg
Copy link
Contributor Author

dhewg commented Sep 21, 2019

edit: resolved, issue was related to uclibc++.mk and TARGET_CXX_NOCACHE, but as it turns out, ninja can't be built against uClibc++

I'm unsure where the build failure comes from:

Package ninja is missing dependencies for the following libraries:
libstdc++.so.6

Seems to work on my end?

define Package/ninja
  ...
  DEPENDS:=$(CXX_DEPENDS)
endef

$ opkg info ninja
Package: ninja
Version: 1.9.0-1
Depends: libc, libstdcpp6
Status: install user installed
Architecture: arm_cortex-a7_neon-vfpv4
Installed-Time: 1569016828

@dhewg dhewg force-pushed the pull/meson branch 2 times, most recently from be90516 to 893ca37 Compare September 21, 2019 10:11
@hnyman hnyman requested a review from thess September 21, 2019 14:30
@hnyman
Copy link
Contributor

hnyman commented Sep 21, 2019

cc @thess who is the maintainer of the packages you propose to switch for meson build system introduced by this PR.

devel/meson/Makefile Outdated Show resolved Hide resolved
@ja-pa
Copy link
Contributor

ja-pa commented Sep 21, 2019

I feel that a better way would be to introduce switch to meson in separate PR.

@neheb
Copy link
Contributor

neheb commented Sep 21, 2019

I doubt uClibc++ can be used here. It's a C++98 library. C++11 or later is probably what's used.

@thess
Copy link
Member

thess commented Sep 21, 2019

@ja-pa - agree. Adding/updating packages to use Ninja/Meson needs to be done separately.

@hnyman - Will be investigating mpd,etc. this week.

Any reason why Ninja/Meson devel tools shouldn't be either:
a) Host build system requirement and/or
b) Part of toolchain/SDK ala cmake.

@hnyman
Copy link
Contributor

hnyman commented Sep 21, 2019

Any reason why Ninja/Meson devel tools shouldn't be either:
a) Host build system requirement and/or
b) Part of toolchain/SDK ala cmake.

scons was just recently removed from host tools and moved to packages feed by 7087efd and openwrt/openwrt@60eb0e8 authored by @ynezz , so I think that devs have differing opinions on the approach regarding additional build tools ...

@dhewg
Copy link
Contributor Author

dhewg commented Sep 22, 2019

updated:

@neheb
Copy link
Contributor

neheb commented Sep 23, 2019

I'm fairly confused on the issue of _HOST vs. _HOSTPKG. On IRC I've been told something equivalent to "_HOST should be used by packages in the tools/ directory".

If we look at this tree, including this PR, we get

git grep STAGING_DIR_HOST\) | wc -l
15

while _HOSTPKG has this:

git grep STAGING_DIR_HOSTPKG\) | wc -l
110

edit: From looking at the packages, softethervpn, iotivity, and *odbc are most likely in the wrong. No comment on the others.

@dhewg dhewg force-pushed the pull/meson branch 2 times, most recently from dc2a06c to 4e87457 Compare September 23, 2019 07:23
@dhewg
Copy link
Contributor Author

dhewg commented Sep 23, 2019

I got the a similar response on irc.

updated:

  • switched to STAGING_DIR_HOSTPKG

@neheb
Copy link
Contributor

neheb commented Sep 27, 2019

ping @jow-

@dhewg
Copy link
Contributor Author

dhewg commented Sep 28, 2019

updated:

  • fix including ninja.mk from meson.mk if the package subdir depth != 2 (use MAKEFILE_LIST instead of CURDIR)
  • add support for building host packages using meson (proper uninstall from hostpkg requires this patch https://patchwork.ozlabs.org/patch/1168833/ though, but it's doesn't break without it)

host builds were tested with 0001-XXX-meson-host-test.patch.txt

@thess did you give this a try yet?

@dhewg
Copy link
Contributor Author

dhewg commented Sep 30, 2019

updated:

  • create native/cross files for each package in [Host|Build]/Configure, as they may need to modify compiler flags (as e.g. nls.mk does)

@dhewg
Copy link
Contributor Author

dhewg commented Sep 30, 2019

Here's a tree that includes #10043 #10113 and above mentioned host build test patch.
https://github.com/dhewg/packages/tree/meson

Copy link
Member

@thess thess left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm sorry I haven't paid enough attention these proposed changes. I am probably not going to have a chance to try/verify/review these packages in the near future. In fact, if someone else wants to take over maintainer-ship of MPD and friends, I have no objections. As it stands for the foreseeable future, my attention to these packages will be minimal if at all.

Dealing with packages requiring little used (at least here) build tools needs to be addressed so that packages like MPD can more forward without us having to maintain alternative builds (eg autotools). So... whatever you guys decide if fine with me.

@dhewg
Copy link
Contributor Author

dhewg commented Oct 4, 2019

Oh... well, if noone steps forward I guess I can take over mpd related packages for a while.

How to we proceed with this MR? I'm happy with it, the foundation is there and it works nicely for me for #10052. For other packages we may need more features, but that can be dealt with as issues pop up.

Another candidate to test drive this glib2, since v2.59.0 is the last version supporting autotools. @tripolar did you try this yet to build newer versions using meson?

@neheb
Copy link
Contributor

neheb commented Oct 9, 2019

AFAIK the odd glib releases are unstable ones.

@dhewg
Copy link
Contributor Author

dhewg commented Oct 10, 2019

updated:

  • meson v0.52.0

@flyn-org
Copy link
Contributor

I can update libsoup, grilo, and grilo-plugins once there exists an example of "porting" a package to use the project's Meson-based build.

@neheb, glib2 2.59 is indeed a development version, but the subsequent 2.60 and 2.62 series also use Meson.

@dhewg
Copy link
Contributor Author

dhewg commented Oct 14, 2019

@flyn-org have a look at devel/meson/meson.mk from this MR: .84d7a51#diff-398d125edadb8ea15ae979ed80f5258e
There're also a few packages I ported in this tree https://github.com/dhewg/packages/commits/meson

@neheb
Copy link
Contributor

neheb commented Oct 17, 2019

Actually...why does the target build depend on the host build?

@dhewg
Copy link
Contributor Author

dhewg commented Oct 17, 2019

Actually...why does the target build depend on the host build?

Ninja is built using itself. It has a --bootstrap option to build a minimal version of itself which then builds the final binary. This is what the host built does. The target build then uses the host binary to cross compile for the target without the bootstrap option.

@dhewg
Copy link
Contributor Author

dhewg commented Oct 17, 2019

Edit: wrong issue, idiotic github login redirected to the wrong one

@neheb neheb requested a review from yousong October 20, 2019 01:21
PKG_RELEASE:=1

PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://codeload.github.com/ninja-build/ninja/tar.gz/v$(PKG_VERSION)?
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

codeload should not be used directly. The normal release tarball listed under releases is preferred.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I switched meson to that, but the ninja releases are different it seems. The link on the github releases redirects to codeload (curl "https://github.com/ninja-build/ninja/archive/v1.9.0.tar.gz"|xxd) and that fails to download, so I kept codeload there.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That seems bizarre. Note that https://github.com/ninja-build/ninja/archive/v1.9.0/ninja-1.9.0.tar.gz works. Well, it redirects to that codeload link. I'd just leave it.

This adds a host as well as a target package.

ninja.mk is provided to execute ninja.

The two patches have been taken from upstream to fix compile issues.

Signed-off-by: Andre Heider <a.heider@gmail.com>
This adds a host as well as a target package.

meson.mk is provided to build packages using meson.

Signed-off-by: Andre Heider <a.heider@gmail.com>
@neheb
Copy link
Contributor

neheb commented Nov 1, 2019

Let's just get this in here. No point in delaying.

@neheb neheb merged commit d0f3da9 into openwrt:master Nov 1, 2019
@dhewg dhewg deleted the pull/meson branch November 2, 2019 06:27
@dhewg
Copy link
Contributor Author

dhewg commented Nov 2, 2019

Nice, thanks!

@flyn-org
Copy link
Contributor

flyn-org commented Nov 2, 2019

Fantastic! This allows us to update a number of packages in OpenWrt that have been awaiting Meson, e.g., #10433.

Thank you to everyone involved, especially @dhewg and also @br101 and @ja-pa for their earlier work. Discussion and work continued for over a year---I am grateful for the persistence displayed to get this done.

@dangowrt
Copy link
Member

dangowrt commented Nov 4, 2019

Somehow CMake is not detected by Meson when trying to build libinput-1.14.3 :(

CMake binary for MachineChoice.HOST is not cached
CMake binary missing from cross or native file, or env var undefined.
Found CMake: NO
No CMake binary for machine MachineChoice.HOST not found. Giving up.

@dhewg
Copy link
Contributor Author

dhewg commented Nov 4, 2019

What do you need cmake for? As far as I understand, it's used as a fallback if a dependency is not found via pkg-config. Does libinput have a dependency without pkg-config support?

@BKPepe
Copy link
Member

BKPepe commented Nov 18, 2019

What about to add it to openwrt-19.07 branch?

@neheb
Copy link
Contributor

neheb commented Nov 18, 2019

No opposition from me. That being said, nothing in 19.07 requires it currently.

In other news, I opened up an issue regarding uClibc++: ninja-build/ninja#1684

It's only the hash map feature that's the problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants