Open dagle opened 1 year ago
This pr does not contain building documentation, which will be included in a future pr. My reasoning for this is that I updated the documentation to build using the new gi-docgen instead of gtk-doc.
This pr uses a 1.0 version of meson. I don't think I use anything later than 0.7 but I don't know what versions different systems ship with.
coverage works but reports false atm since I don't know if there is a portable way to check for coverage packages / support.
profiling support isn't included in this pr.
First, sorry for taking so long to get around to this, I'm just so busy these days and have multiple projects that I maintain in my limited free time.
I also have no knowledge of the meson build system or what GNOME is doing these days.
That said, I just had the most awful experience trying to build gmime on macOS (the closest thing I have to a suitable for gmime development environment) which is what made me think of this PR that I'd been meaning to get around to.
I just installed meson from brew
on my macOS machine and cloned this branch.
How do I test this?
tl;dr
# replaces ./configure
meson setup builddir/
# replaces /configure --enable-foo
meson setup builddir/ -Dfoo=enabled
# replaces ./configure --help
meson configure
# replaces make
ninja
[jestedfa@localhost gmime]$ meson setup builddir && cd builddir
The Meson build system
Version: 1.4.1
Source dir: /Users/jestedfa/src/gmime
Build dir: /Users/jestedfa/src/gmime/builddir
Build type: native build
Project name: GMime
Project version: 3.2.13
C compiler for the host machine: cc (clang 15.0.0 "Apple clang version 15.0.0 (clang-1500.3.9.4)")
C linker for the host machine: cc ld64 1053.12
Host machine cpu family: aarch64
Host machine cpu: aarch64
Run-time dependency iconv found: YES
Found pkg-config: YES (/opt/homebrew/bin/pkg-config) 0.29.2
Run-time dependency libidn2 found: YES 2.3.7
Run-time dependency gpgme found: YES 1.23.2
Run-time dependency glib-2.0 found: YES 2.80.3
Run-time dependency gobject-2.0 found: YES 2.80.3
Run-time dependency gio-2.0 found: YES 2.80.3
Run-time dependency zlib found: YES 1.2.11
Header "getopt.h" has symbol "getopt_long" : YES
Checking if "iconv-detect" runs: DID NOT COMPILE
Has header "dlfcn.h" : YES
Has header "getopt.h" : YES
Has header "inttypes.h" : YES
Has header "netdb.h" : YES
Has header "poll.h" : YES
Has header "stdint.h" : YES
Has header "stdio.h" : YES
Has header "stdlib.h" : YES
Has header "strings.h" : YES
Has header "string.h" : YES
Has header "sys/mman.h" : YES
Has header "sys/param.h" : YES
Has header "sys/stat.h" : YES
Has header "sys/types.h" : YES
Has header "time.h" : YES
Has header "unistd.h" : YES
Has header "winsock2.h" : NO
Checking whether type "struct utsname" has member "domainname" : NO
Checking for function "fsync" : YES
Checking for function "getaddrinfo" : YES
Checking for function "getdomainname" : YES
Checking for function "gethostname" : YES
Checking for function "getpagesize" : YES
Checking for function "mmap" : YES
Checking for function "msync" : YES
Checking for function "munmap" : YES
Checking for function "poll" : YES
Checking for function "select" : YES
Configuring config.h using configuration
Configuring gmime-version.h using configuration
gmime/meson.build:188:0: ERROR: File gmime-version.h does not exist.
A full log can be found at /Users/jestedfa/src/gmime/builddir/meson-logs/meson-log.txt
Looks like the meson setup logic assumes gmime-version.h exists from the onset, but it is/was autogenerated by the old configure
script.
Presumably meson needs to auto-generate it as well.
Hmmm, looks like it should be doing that...
configure_file(input: 'gmime-version_meson.h.in',
output: 'gmime-version.h',
configuration : version_data
)
Okay, I'm guessing that it's because libgmime_headers contains gmime-version.h
I wonder if maybe inc_conf needs to include the meson build directory so that gmime-version.h can be picked up from there?
Rebased this on top of the latest gmime to fix the gir errors that I was getting when trying to meson compile
Checking if "iconv-detect" runs: DID NOT COMPILE
is a bit concerning.
Logs:
Code:
#include <iconv.h>
int main() {
iconv_open("","");
}
-----------
Command line: `cc /Users/jestedfa/src/gmime/builddir/meson-private/tmp4tsmc6zs/testfile.c -o /Users/jestedfa/src/gmime/builddir/meson-private/tmp4tsmc6zs/output.exe -O0 -Werror=implicit-function-declaration` -> 1
stderr:
Undefined symbols for architecture arm64:
"_iconv_open", referenced from:
_main in testfile-4a9b3c.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
-----------
Running compile:
Working directory: /Users/jestedfa/src/gmime/builddir/meson-private/tmphax2pj_h
Code:
#ifdef __has_include
#if !__has_include("iconv.h")
#error "Header 'iconv.h' could not be found"
#endif
#else
#include <iconv.h>
#endif
-----------
Command line: `cc /Users/jestedfa/src/gmime/builddir/meson-private/tmphax2pj_h/testfile.c -E -P -P -O0 -Werror=implicit-function-declaration` -> 0
Running compile:
Working directory: /Users/jestedfa/src/gmime/builddir/meson-private/tmplrfdf0sy
Code:
int main(void) { return 0; }
-----------
Command line: `cc /Users/jestedfa/src/gmime/builddir/meson-private/tmplrfdf0sy/testfile.c -o /Users/jestedfa/src/gmime/builddir/meson-private/tmplrfdf0sy/output.exe -O0 -Werror=implicit-function-declaration -liconv -Wl,-undefined,dynamic_lookup` -> 0
Run-time dependency iconv found: YES
Okay, fixed that.
TODO:
Releases can be done with meson dist -C builddir/
(equivalent to make distcheck).
This add support for the meson build system which supports multiple operating systems among things out of the box. This requires https://github.com/jstedfast/gmime/pull/141 to be merged, because gnome.generate_gir() treats warnings as errors.