diff options
author | Philip Withnall <pwithnall@gnome.org> | 2023-12-04 14:17:39 +0000 |
---|---|---|
committer | David Faure <faure@kde.org> | 2024-02-01 09:15:37 +0000 |
commit | 55353d23ec45796b689f2c482cbc048656a0ed98 (patch) | |
tree | ca0b0793c5ba0fc222c6673c6a9d46e403550d2d | |
parent | 58389952ca8d6b0011728b11ca392541cda691bf (diff) |
build: Move xdgmime to a meson subproject
This means:
- It’s always available, so the tests no longer have to be optional
- It gets bundled in release tarballs so the above is always true
- The `meson setup` and `meson build` commands will automatically
update it if needed
- It gets built using meson, rather than autotools, so the old
GNU make build system in xdgmime can be dropped (see
https://gitlab.freedesktop.org/xdg/xdgmime/-/issues/36)
- The `xdgmime-path` meson option is no longer needed and has been
dropped
Signed-off-by: Philip Withnall <pwithnall@gnome.org>
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | .gitlab-ci.yml | 5 | ||||
-rw-r--r-- | .gitmodules | 5 | ||||
-rw-r--r-- | HACKING.md | 30 | ||||
-rw-r--r-- | meson.build | 26 | ||||
-rw-r--r-- | meson_options.txt | 4 | ||||
-rw-r--r-- | subprojects/xdgmime.wrap | 8 | ||||
-rw-r--r-- | tests/meson.build | 46 | ||||
m--------- | xdgmime | 0 |
9 files changed, 59 insertions, 66 deletions
@@ -1,2 +1,3 @@ /_build/ /.python-version +/subprojects/*/
\ No newline at end of file diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 05b8cb8..b1aa762 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -70,7 +70,7 @@ variables: FDO_DISTRIBUTION_TAG: "2022-08-15.0" BUILD_OS: fedora FDO_DISTRIBUTION_VERSION: 38 - FDO_DISTRIBUTION_PACKAGES: "gcc gcc-c++ glibc-devel make libxml2-devel glib2-devel gettext git xmlto findutils gettext-devel meson" + FDO_DISTRIBUTION_PACKAGES: "gcc gcc-c++ glibc-devel libxml2-devel glib2-devel gettext git xmlto findutils gettext-devel meson" .fedora-x86_64: extends: @@ -100,9 +100,6 @@ fedora-x86_64-container_prep: .do-build: stage: "Build and test" script: - # Compile xdgmime - - make -C xdgmime - # Compile and test shared-mime-info - meson setup _build - meson compile -C _build diff --git a/.gitmodules b/.gitmodules index c13ff7a..dc83889 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,4 @@ -[submodule "xdgmime"] - path = xdgmime +[submodule "subprojects/xdgmime"] + path = subprojects/xdgmime url = https://gitlab.freedesktop.org/xdg/xdgmime.git + shallow = true @@ -35,20 +35,21 @@ more test files to be added to the test suite. Test suite ---------- -You need to have xdgmime [1] checked out and compiled before you configure -and build shared-mime-info. In the shared-mime-info git repository, getting -xdgmime is taken care of by using a git submodule; run `git submodule update ---init` after cloning the shared-mime-info repo. If you wish to keep the -submodule automatically up to date on pull, `git config submodule.recurse -true` in the shared-mime-info dir helps with that. To build xdgmime, `cd -xdgmime/src && make` (ignore the Meson build system). - -By default, the build system will expect the xdgmime directory to be in the -shared-mime-info directory. `./xdgmime/src/test-mime-data` is run against -`tests/mime-detection/list`. An alternate path to xdgmime can be passed by -using the `xdgmime-path` meson option such as `-Dxdgmime-path=/path/to/xdgmime`. - -The format of the file is: +The shared-mime-info tests depend on xdgmime [1]. This is taken care of as a +git submodule and as a meson subproject. Run `meson subprojects update` or +`git submodule update --init` after cloning the shared-mime-info repo. If you +wish to keep the submodule automatically up to date on pull, +`git config submodule.recurse true` in the shared-mime-info dir helps with that. + +xdgmime will be built automatically by the meson build system for +shared-mime-info. + +Meson’s subprojects system[2] requires the xdgmime directory to be in +`subprojects/xdgmime`. An alternate path to xdgmime can be configured by +installing a pkg-config file for xdgmime which points to the desired location. + +As part of the tests, `./xdgmime/src/test-mime-data` is run against +`tests/mime-detection/list`. The format of the file is: `<testcase filename> <expected mime-type> <expected failures>` The expected failures is whether matching the file with the mime-type would @@ -62,6 +63,7 @@ test files in the `staging-tests/` sub-directory. [1]: Repository details at: https://gitlab.freedesktop.org/xdg/xdgmime +[2]: https://mesonbuild.com/Subprojects.html Releasing --------- diff --git a/meson.build b/meson.build index 93acd40..1f067a4 100644 --- a/meson.build +++ b/meson.build @@ -26,26 +26,16 @@ xmllint = find_program('xmllint') xmlto = find_program('xmlto', required: false) ############################################################################### -# Find xdgmime +# Find xdgmime. It needs to be a native dependency (i.e. compiled for the build +# system rather than the host system) so we can run its programs as part of the +# shared-mime-info build. -xdgmime = get_option('xdgmime-path') / 'src' +subproject('xdgmime') +xdgmime_dep = dependency('xdgmime', native: true) -xdgmime_print_mime_data = find_program(xdgmime/'print-mime-data', required: false) -xdgmime_test_mime_data = find_program(xdgmime/'test-mime-data', required: false) -xdgmime_test_mime = find_program(xdgmime/'test-mime', required: false) -xdgmime_found = ( - xdgmime_print_mime_data.found() and - xdgmime_test_mime_data.found() and - xdgmime_test_mime.found() -) - -if not xdgmime_found - warning(''' -*************************************************************************** -*** xdgmime not compiled, test suite cannot run. Check HACKING for info *** -*************************************************************************** - ''') -endif +xdgmime_print_mime_data = find_program('print-mime-data') +xdgmime_test_mime_data = find_program('test-mime-data') +xdgmime_test_mime = find_program('test-mime') ############################################################################### # Check if GCC needs -lstdc++fs (before 9.1) diff --git a/meson_options.txt b/meson_options.txt index c5b7e5d..7f9c20c 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -14,7 +14,3 @@ option('build-translations', type: 'boolean', value: true, option('build-tests', type: 'boolean', value: true, description: 'Build the test suite. If not set then there will be no \'test\' build target.', ) - -option('xdgmime-path', type: 'string', value: './xdgmime', - description: 'Path to the xdgmime executable', -) diff --git a/subprojects/xdgmime.wrap b/subprojects/xdgmime.wrap new file mode 100644 index 0000000..8e3a745 --- /dev/null +++ b/subprojects/xdgmime.wrap @@ -0,0 +1,8 @@ +[wrap-git] +directory=xdgmime +url=https://gitlab.freedesktop.org/xdg/xdgmime.git +revision=master +depth=1 + +[provide] +dependency_names = xdgmime
\ No newline at end of file diff --git a/tests/meson.build b/tests/meson.build index a073abe..8f0e069 100644 --- a/tests/meson.build +++ b/tests/meson.build @@ -2,31 +2,29 @@ if meson.is_cross_build() subdir_done() endif -if xdgmime_found - test('test-staging', - find_program('test_staging.sh'), - args: [ - meson.source_root(), - meson.build_root(), - freedesktop_org_xml, - update_mime_database, - xdgmime_print_mime_data.path(), - ] - ) +test('test-staging', + find_program('test_staging.sh'), + args: [ + meson.source_root(), + meson.build_root(), + freedesktop_org_xml, + update_mime_database, + xdgmime_print_mime_data.path(), + ] +) - test('test-mime', - find_program('test_mime.sh'), - args: [ - meson.source_root(), - meson.build_root(), - freedesktop_org_xml, - update_mime_database, - xdgmime_test_mime_data.path(), - xdgmime_test_mime.path(), - test_tree_magic.full_path(), - ], - ) -endif +test('test-mime', + find_program('test_mime.sh'), + args: [ + meson.source_root(), + meson.build_root(), + freedesktop_org_xml, + update_mime_database, + xdgmime_test_mime_data.path(), + xdgmime_test_mime.path(), + test_tree_magic.full_path(), + ], +) run_target('check-generic-icons', command: [ find_program('test_generic_icons.sh'), freedesktop_org_xml ], diff --git a/xdgmime b/xdgmime deleted file mode 160000 -Subproject 179296748e92bd91bf531656632a1056307fb7b |