-
Notifications
You must be signed in to change notification settings - Fork 463
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
[WIP] Build with Meson #3073
base: master
Are you sure you want to change the base?
[WIP] Build with Meson #3073
Conversation
Are you aware of lazka@f6fe573? |
I was not, thanks for the pointer. It seems their version is older and differs from mine; I'll merge his work with mine. |
I manually merged his work with my branch here, keeping what I think is the most "meson-idiomatic" way (i.e. keeping the library dependency as |
libsass build is so simple that probably we could get rid of autoconf and generate ninja file easily :) |
Well, that's what Meson does, generating Ninja files ;) |
Hey @SolarLiner Thanks for the contribution. I personally have nothing against supporting more build chains, but they tend to add additional maintenance burden. I already have this issue with the MSVC build files. Most other build systems I use (e.g. perl-libsass) already consume https://github.com/sass/libsass/blob/master/Makefile.conf, which I consider the master. I plan to also add all headers and includes to it in the future (see https://github.com/mgreter/libsass/blob/libsass-refactor-snapshot/Makefile.conf). For my upcoming refactoring I currently have a hackish perl script to generate the MSVC files from a template and the Makefile.conf settings, as it was just to tedious to keep them manually in sync. I can try to backport this to current LibSass so you/we could generate the necessary inputs for such a meson build? I doubt meson can directly consume Makefile.conf? Without such an automated generation method I would honestly be very reluctant to merge another build system into LibSass, since I know we would miss to update it at some point. |
Given that the current build system is Autotools the possible end goal here would be to make Meson the primary build system of the project. It supports generating Visual Studio and XCode projects on top of Ninja files (which solves the issue of keeping the MSVC projects in sync), and has an API to query the build project itself (with Meson is also built to bridge (supported) languages together, meaning that integrating this with the python bindings would be as simple as adding this project as a subproject in And, as I said before, By having Meson in here mean we can directly plug this project with Of course, this requires making Meson the primary build system of the project, which means learning and working with a new build system for those who don't know about the project, so I do understand not wanting to make the change. However I do think the value Meson adds is well worth the effort of switching to it. |
I'm sorry, but I'm not willing to switch the main build system! The Makefiles work OOTB on windows and linux for me for multiple chains without any additional dependency. I don't mind to support another build system, but the main setup will stay as it is until somebody else takes on the full burden to support and develop LibSass. |
Sorry if that might was a bit rude, but until a build system has proven to be very well and stable, I'm reluctant to even consider switching the main build system, that has been tweaked and tested for years now. We had similar approaches with CMAKE (#292). So please, if you want to get LibSass to build with meson, first try to derive from said Makefile.conf. If meson turns out to be superior to all other approaches, I'm happy to consider a switch. What I meant by "deriving" from Makefile.conf via the mentioned perl script would be to generate the file you have at https://github.com/sass/libsass/pull/3073/files#diff-9fbb37ad64805c2da3889d419806cd51. If you checkout https://github.com/sass/libsass/blob/master/win/libsass.targets you see what the perl-script is actually generating that from https://github.com/sass/libsass/blob/master/Makefile.conf => https://github.com/mgreter/libsass/blob/libsass-refactor-snapshot/utils/build-skeletons/libsass.targets. This script only needs to be run once whenever we add new compilation units, headers etc. Autotools can directly consume this Makefile.conf, so it doesn't need any "fancy translation" done by the perl script. I know that a lot of build tools are out there to solve this, but I want to keep this as dependency free as possible, but I don't mind adding more options ;) |
It's okay, I completely understand, I just wanted to state the goal with this PR and my vision. In the meantime Meson can sit with other build systems, but I am confident that it will prove itself worthy of switching. :) I guess As for dependencies, I'm not so sure I agree with "minimal dependencies". Autotools a few of them, so it's just a matter of opinion. With Meson, you just have to In any case, this probably means also not touching any CI files. I'll remove that from the PR and complete the |
I have made the PR ready for review, however the Perl script to generate |
Thanks @SolarLiner, I made a PR for the generator script at #3093. |
@SolarLiner can you add a few additional CI jobs that utilize the meson build? Ideally at least one for each OS. We probably will disable most of them again once this is merged to keep regular CI fast, but for this PR I would like to see at least a few combinations with green light on CI using meson :) |
I just tested this shortly locally, and so far it seems to work. Please also incorporate some documentation into docs/build.md.
I understand that probably not all of these can be answered for a first version. |
All of this points, bar the "getting version from git" are supported natively by Meson. I'll write about those in the docs, but I believe the Meson docs are a very good centralized source of documentation. Wrt. the git versinoning issue, it's because Meson wants to be the ground truth about the project's metadata. As such, you specify the version in the Anyway, should I write extensively about Meson in the docs or do links to the relevant parts of the Meson docs suffice? I think the latter would help reduce maintenance as the links would always point to the updated docs. On the other hands it feels like redirecting the user around... |
I havent't tested this yet, but is there a possibility for Meson to build a static (.a) library but with PIC symbols included? I have a quick and dirty workaround for this in my BSD makefiles: I think it is possible with autotools somehow.... it would be nice to have it out of the box. The reason for this is to slurp libsass statically into another shared module (node-sass binding). |
I have changed the build script a little to more easily select from the 3 build systems supported by the project now, I'm testing only on Linux now, and will expand to OSX next, and then dive into the AppVeyor docs to do the same on that platform... |
According to the docs, simply configure the build with Tl;DR: |
This reverts commit ae4d352.
I'll answer those questions from @mgreter here as a placeholder for when I'll write the docs fully (though I need directions on whether to write docs self-contained at the risk of them becoming outdated, or if links to the Meson docs are allowed (which would require the user to navigate back and forth)).
By default Meson generates debug builds. There's the You can also explicitely pass the
Libraries declared with The switch is
You can choose the compiler with the
Meson has a Visual Studio backend (as well as an XCode backend), selectable with
I have not included any tests to be run by meson yet, but it is definitely possible. Meson even has TAP support for more granular reporting of errors (source).
Meson has the
There doesn't seem to be an implemented feature of Meson, but we can pass the
Configure the build with
The build file generates and installs a |
This is a direct copy of https://github.com/lazka/libsass/tree/meson which I've created for gtk back in the days. There is an open PR for adding meson support upstream in sass/libsass#3073 but the project is considered deprecated and hasn't seen a commit in over a year, so there is not much hope for progress there. There is a newer 3.6.5 release out, but I wanted to copy things as is from my fork first and look at updating it later.
This is a direct copy of https://github.com/lazka/libsass/tree/meson which I've created for gtk back in the days. There is an open PR for adding meson support upstream in sass/libsass#3073 but the project is considered deprecated and hasn't seen a commit in over a year, so there is not much hope for progress there. There is a newer 3.6.5 release out, but I wanted to copy things as is from my fork first and look at updating it later.
This is a direct copy of https://github.com/lazka/libsass/tree/meson which I've created for gtk back in the days. There is an open PR for adding meson support upstream in sass/libsass#3073 but the project is considered deprecated and hasn't seen a commit in over a year, so there is not much hope for progress there. There is a newer 3.6.5 release out, but I wanted to copy things as is from my fork first and look at updating it later.
This is a direct copy of https://github.com/lazka/libsass/tree/meson which I've created for gtk back in the days. There is an open PR for adding meson support upstream in sass/libsass#3073 but the project is considered deprecated and hasn't seen a commit in over a year, so there is not much hope for progress there. There is a newer 3.6.5 release out, but I wanted to copy things as is from my fork first and look at updating it later.
Admin edit: Needs sass/sass-spec#1529 to pass CI.
The Meson build system is a build system designed as a Ninja front-end. It is significantly faster than Autotools and (IMHO) much easier to work with.
Meson also natively supports dependencies either as system dependencies (using pkg-config) or subprojects (where Meson will build another Meson-based (or more recently CMake-based) project to use with the current project). This I use in sass/sassc#269 to conditionally build
libsass
if it hasn't been found on the system.Usage:
The conversion hasn't been done by transcribing the Automake script - furthermore not all "build features" have been translated yet:
SASS_CUSTOM_ALLOCATOR
configuration variableChanges to CI to use Meson(Meson will not become primary, no need to change CI)