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

Support for Meson Builds #1164

Open
distler opened this issue Sep 30, 2024 · 6 comments · May be fixed by #924
Open

Support for Meson Builds #1164

distler opened this issue Sep 30, 2024 · 6 comments · May be fixed by #924

Comments

@distler
Copy link

distler commented Sep 30, 2024

I notice that a number of packages are held back at ancient versions because the upstream switched to meson as a build system.

I ran into this problem when libharfbuzz failed to compile for me (Macos 14.7). It seemed hopeless to try to fix version 2.6.8. So I decided to grab the latest version (10.0.1) and see if I could modify libharfbuzz0-shlibs.info to build using meson.

It involve commenting out a whole bunch of stuff (e.g., no patching required!). The CompileScript (without the docs, because building the docs gave me an error) was

meson build -Ddocs=disabled -Ddoc_tests=false -Dgraphite2=enabled -Dprefix=/opt/sw
meson compile -C build

and the InstallScript was

meson install -C build --no-rebuild --destdir=%d

Obviously, my attempt was rather hacky, but it seems that adding meson support is not so difficult (and would solve a lot of problems with other packages).

@sth0
Copy link
Contributor

sth0 commented Nov 2, 2024

I have a first attempt at a meson package. For some reason the package gives me an error on build.
running build_py creating /opt/sw/src/fink.build/root-meson-py310-1.0.0-2 error: could not create '/opt/sw/src/fink.build/root-meson-py310-1.0.0-2': Permission denied ... Package manager version: 0.45.99.git Distribution version: selfupdate-git Wed Oct 30 18:38:10 2024, 15.0, x86_64 Trees: local/main stable/main Xcode.app: 16.1 Xcode command-line tools: 16.1.0.0.1.1729049160 Max. Fink build jobs: 10
Not sure why this package complains when all others seem to create that equivalent folder. Just haven't gotten back to this issue. Advice/help appreciated.

meson-py.info.txt

@distler
Copy link
Author

distler commented Nov 3, 2024

--- /opt/sw/fink/13.0/local/main/finkinfo/meson-py.info.txt     2024-11-03 01:29:32
+++ /opt/sw/fink/13.0/local/main/finkinfo/meson-py.info 2024-11-03 01:50:16
@@ -23,10 +23,12 @@
 DocFiles: COPYING README.md

 CompileScript: <<
-  %p/bin/python%type_raw[python] setup.py build --build-base=%i
+  #!/bin/sh -ev
+  %p/bin/python%type_raw[python] setup.py build
 <<

 InstallScript: <<
+  #!/bin/sh -ev
   %p/bin/python%type_raw[python] setup.py install --prefix=%p --root=%d
 <<

With that minor change, it compiles and installs just fine.

@distler
Copy link
Author

distler commented Nov 4, 2024

Of course, meson 1.0.0 fails miserably to detect the linker on Macos. Installing 1.6.0 (the current version) fixes the problem (and allows to install libharfbuzz 10.0.1).

@distler
Copy link
Author

distler commented Nov 4, 2024

Building libharfbuzz-bin requires a newer version of glib2 than Fink currently offers. So here are meson-based builds for glib2-shlibs and for libharfbuzz0-shlibs

libharfbuzz0-shlibs.info.txt
glib2-shlibs.info.txt

@dhomeier dhomeier linked a pull request Nov 7, 2024 that will close this issue
@dhomeier
Copy link
Contributor

dhomeier commented Nov 7, 2024

FYI I have updated our existing meson submission in #924 to 1.6.0 as well.

Building libharfbuzz-bin requires a newer version of glib2 than Fink currently offers. So here are meson-based builds for glib2-shlibs and for libharfbuzz0-shlibs

Awesome! I was able to build those with the meson-py310 from above, too, just needed a couple changes to build in maintainer mode:

--- glib2-shlibs.info	2024-11-06 19:58:40
+++ /opt/sw2/fink/10.9-libcxx/stable/main/finkinfo/gnome/glib2-shlibs.info	2024-11-07 00:45:19
@@ -6,6 +6,7 @@
 
 Revision: 1
 BuildDepends: <<
+	fink (>= 0.32),
 	meson,
 	ninja,
 	gettext-bin,
@@ -24,13 +25,13 @@
 	shared-mime-info (>= 1.3-1)
 <<
 Replaces: glib2 (<< 2.12.0-1)
-Source: mirror:gnome:sources/sources/glib/2.82/glib-%v.tar.xz
+Source: mirror:gnome:sources/glib/2.82/glib-%v.tar.xz
 Source-Checksum: SHA256(ab45f5a323048b1659ee0fbda5cecd94b099ab3e4b9abf26ae06aeb3e781fd63)
 SetCFLAGS: -Os
 ConfigureParams: --mandir=%p/share/man --disable-gtk-doc ac_cv_path_GTKDOC_REBASE=true --disable-dependency-tracking --disable-fam --disable-visibility PKG_CONFIG=%p/bin/ppkg-config
 CompileScript: <<
 	#!/bin/sh -ex
-	meson setup _build  -Dprefix=/opt/sw
+	meson setup _build  -Dprefix=%p
 	meson compile -C _build
 <<
 InfoTest: <<
@@ -38,7 +39,7 @@
 		desktop-file-utils (>= 0.22-1),
 		shared-mime-info (>= 1.3-1)
 	<<
-	TestScript: LANG=C make check || exit 2
+	TestScript: LANG=C meson test -C _build || exit 2
 <<
 InstallScript: <<
 	meson install -C _build --no-rebuild --destdir=%d
@@ -50,11 +51,12 @@
 	perl -p -e 's/-lintl//g' %i/lib/pkgconfig/glib-2.0.pc > %i/lib/glib-2.0/pkgconfig-strict/glib-2.0.pc
 <<
 Shlibs: <<
-	%p/lib/libgio-2.0.0.dylib 2201.0.0 %n (>= 2.22.4-1)
-	%p/lib/libglib-2.0.0.dylib 2201.0.0 %n (>= 2.22.4-1)
-	%p/lib/libgmodule-2.0.0.dylib 2201.0.0 %n (>= 2.22.4-1)
-	%p/lib/libgobject-2.0.0.dylib 2201.0.0 %n (>= 2.22.4-1)
-	%p/lib/libgthread-2.0.0.dylib 2201.0.0 %n (>= 2.22.4-1)
+	%p/lib/libgio-2.0.0.dylib 8201.0.0 %n (>= 2.82.2-1)
+	%p/lib/libgirepository-2.0.0.dylib 8201.0.0 %n (>= 2.82.2-1)
+	%p/lib/libglib-2.0.0.dylib 8201.0.0 %n (>= 2.82.2-1)
+	%p/lib/libgmodule-2.0.0.dylib 8201.0.0 %n (>= 2.82.2-1)
+	%p/lib/libgobject-2.0.0.dylib 8201.0.0 %n (>= 2.82.2-1)
+	%p/lib/libgthread-2.0.0.dylib 8201.0.0 %n (>= 2.82.2-1)
 <<
 DocFiles: <<
 	docs/reference/AUTHORS:AUTHORS.docs.reference
--- libharfbuzz0-shlibs.info	2024-11-06 23:17:53
+++ /opt/sw2/fink/10.9-libcxx/stable/main/finkinfo/text/libharfbuzz0-shlibs.info	2024-11-07 00:52:21
@@ -7,7 +7,7 @@
 Maintainer: Hanspeter Niederstrasser <nieder@users.sourceforge.net>
 Depends: <<
 	freetype219-shlibs,
-	glib2-shlibs,
+	glib2-shlibs (>= 2.30.0),
 	libgettext8-shlibs,
 	libgraphite2-shlibs,
 	libicu72-shlibs
@@ -19,7 +19,7 @@
 	ninja,
 	fontconfig2-dev,
 	freetype219,
-	glib2-dev,
+	glib2-dev (>= 2.30.0),
 	libgraphite2-dev,
 	libicu72-dev,
 	ppkg-config
@@ -28,18 +28,23 @@
 Source: https://github.com/harfbuzz/harfbuzz/releases/download/%v/harfbuzz-%v.tar.xz
 Source-Checksum: SHA256(b2cb13bd351904cb9038f907dc0dee0ae07127061242fe3556b2795c4e9748fc)
 CompileScript: <<
-	meson build -Ddocs=disabled -Ddoc_tests=false -Dgraphite2=enabled -Dprefix=/opt/sw
+	meson setup build -Ddocs=disabled -Ddoc_tests=false -Dgraphite2=enabled -Dprefix=%p
 	meson compile -C build
 	ln -s build/utilities build/bin
 <<
+InfoTest: <<
+	TestScript: meson test -C build || exit 2
+<<
 InstallScript: <<
 	meson install -C build --no-rebuild --destdir=%d
 <<
-DocFiles: COPYING
+DocFiles: AUTHORS COPYING NEWS README.md SECURITY.md THANKS
 Shlibs: <<
-	%p/lib/libharfbuzz.0.dylib 20601.0.0 %n (>= 10.0.1-1)
-	%p/lib/libharfbuzz-icu.0.dylib 20601.0.0 %n (>= 10.0.1-1)
-	%p/lib/libharfbuzz-subset.0.dylib 20601.0.0 %n (>= 10.0.1-1)
+	%p/lib/libharfbuzz.0.dylib 61001.0.0 %n (>= 10.0.1-1)
+	%p/lib/libharfbuzz-cairo.0.dylib 61001.0.0 %n (>= 10.0.1-1)
+	%p/lib/libharfbuzz-gobject.0.dylib 61001.0.0 %n (>= 10.0.1-1)
+	%p/lib/libharfbuzz-icu.0.dylib 61001.0.0 %n (>= 10.0.1-1)
+	%p/lib/libharfbuzz-subset.0.dylib 61001.0.0 %n (>= 10.0.1-1)
 <<
 SplitOff: <<
 	Package: libharfbuzz0-dev
@@ -49,19 +54,16 @@
 		lib/cmake
 		lib/pkgconfig
 		lib/libharfbuzz.dylib
+		lib/libharfbuzz-cairo.dylib
+		lib/libharfbuzz-gobject.dylib
 		lib/libharfbuzz-icu.dylib
 		lib/libharfbuzz-subset.dylib
-		lib/libharfbuzz-cairo.0.dylib
-		lib/libharfbuzz-cairo.dylib
-		lib/libharfbuzz-icu.0.dylib
-		lib/libharfbuzz-subset.0.dylib
-		lib/libharfbuzz.0.dylib
 	<<
 	Depends: %N (= %v-%r)
 	Conflicts: libharfbuzz0-dev
 	Replaces: libharfbuzz0-dev
 	BuildDependsOnly: true
-	DocFiles: AUTHORS COPYING NEWS README.md
+	DocFiles: AUTHORS COPYING NEWS README.md SECURITY.md THANKS
 <<
 SplitOff2: <<
 	Package: libharfbuzz-bin
@@ -77,7 +79,7 @@
 		libgettext8-shlibs,
 		libgraphite2-shlibs
 	<<
-	DocFiles: AUTHORS COPYING NEWS README.md
+	DocFiles: AUTHORS COPYING NEWS README.md SECURITY.md THANKS
 <<
 Homepage: https://github.com/harfbuzz/harfbuzz
 DescDetail: <<

Are you planning to open a PR for those? Note that libharfbuzz 2.6.8 has been fixed to build with Xcode 16 in 86b119c, but @nieder can probably comment if there is anything barring an update to the latest version.

@distler
Copy link
Author

distler commented Nov 7, 2024

Awesome! I was able to build those with the meson-py310 from above, too, just needed a couple changes to build in maintainer mode:

Thank! I am, obviously, rather clueless about the Fink Build System. Glad it wasn't too hard to turn my hacky efforts into something that works properly.

Are you planning to open a PR for those?

It would be better if someone who understands the Fink Build System a little better did that. There's presumably more cleaning up to do before submitting a PR.

For instance, I assume the ConfigureParams: line in glib2-shlibs.info is superfluous. Probably other bits of cruft that didn't interfere with the meson build, but could also be cleaned up.

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

Successfully merging a pull request may close this issue.

3 participants