-
Notifications
You must be signed in to change notification settings - Fork 480
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
Make Aegisub build with Meson on Windows #76
Make Aegisub build with Meson on Windows #76
Conversation
By the way, one thing I didn't look at is what subproject dependencies we'd want to promote to the main project. I know I saw warnings mentioning how e.g. one subproject has a fontconfig wrap available, which isn't being used at the moment since we'd have to manually promote it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks so much for doing this!
I haven't looked at the new subprojects yet (ICU, boost, ffms2) and expect I'll have thoughts on those, but I wanted to get the Aegisub bits reviewed first.
493c8a9
to
d2cd634
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mostly stylistic nits. The ffms2 and boost wrappers are straightforward and seem good, assuming the flags are right. ICU is a bit of a mess, but it passes the smell test and since you've documented how it works in the PR description I think we can check it in as-is.
I'll test all this on my MBP and see if I get anything interesting out of it.
subprojects/packagefiles/icu/source/data/generate_icupkg_inc.py
Outdated
Show resolved
Hide resolved
For my own reference: Once this is merged into meson-vs2019, the changes from here need to be rebased onto this branch before doing further work: https://github.com/TypesettingTools/Aegisub/commits/meson |
C11 breaks the LuaJIT build
iconv is not a standalone library on Linux, so find_library is pointless
this should probably be handled by the libass meson port at some point
for compatibility with bf2dca2
d2cd634
to
2691615
Compare
This PR includes a number of wraps and fixes to compile options that make it possible to build Aegisub on Windows using Meson. It should now be enough to simply install VS2019, Meson and Ninja and compile Aegisub using
This PR depends on TypesettingTools/libass/pull/7 to avoid linking issues with fribidi when building statically.
Tested on:
Summary of changes:
Known issues:
/MDd
),-Db_vscrt=mdd
is required to avoid linking issuesninja clean
doesn't remove e.g. the temporary files generated byicupkg
While the Boost and FFMS2 wraps are straightforward enough, the ICU wrap is rather ugly due to how complicated the ICU build process is.
In order to build the
icudata
library we first need to compile theicupkg
binary, which processesicudt67l.dat
and outputsicudata.lst
- this is probably where any filtering of the file goes. Afterwards, thepkgdata
binary takes theicudata.lst
file and produces theicudata
library - either a static or dynamic one depending on the arguments. The other libraries, such asicuuc
andicui18n
, can then link againsticudata
.There are two main problems here: The first is the fact that
pkgdata
itself produces the library file. It manually constructs an object file and then spawns the compiler/linker/archiver as subprocesses. In order to specify the compiler and flags to use, for non-MSVC compilerspkgdata
requires anicupkg.inc
text file that specifies a variety of parameters. Unfortunately, Meson has no easy way to get the current compiler flags, so in order to generate a text file that can be passed topkgdata
I wrote a Python script which reads the compiler flags frombuilddir/meson-info/intro-targets.json
.Another issue here is that since
pkgdata
is run as acustom_target
, Meson does not recognize the resulting binary as a library object, and if you pass it to the linker it will fail to correctly set the rpath of targets that link against it in the case of a shared library. To get around this, I always buildicudata
as a static library, and create a dummy shared library which simply wraps the static library usinglink_whole
in the case wheredefault_library
isshared
.The second main problem is the fact that while the utility libraries such as
icuuc
andicui18n
depend onicudata
,pkgdata
andicupkg
in turn depend on the utility libraries, resulting in a circular dependency. The autotools build system solves this by first building a stubstubdata
library, which is an empty library that simply declares the symbols expected by the other libraries.icuuc
,icui18n
,icuio
andicutu
are then built againststubdata
, andicupkg
andpkgdata
are in turned linked against these. From a Meson perspective, however, the question is how to make the utility libraries link against the fullicudata
library rather thanstubdata
. For shared libraries, we would have to somehow manipulate the rpath to ensure thaticudata
is prioritized, while for static libraries we have to tell Meson not to automatically pull instubdata
when linking.I couldn't figure out either one, so the solution I ended up with was to build the libraries twice, once linking against
stubdata
and then again linking againsticudata
. This is incredibly wasteful, but it's still the simplest, least hacky, and most predictable solution I could come up with. If we want to support cross compilation we would have to do something similar either way.