From 0ee4d7c16712778e43a7b194f62080f17e97e001 Mon Sep 17 00:00:00 2001 From: JFronny Date: Sat, 11 Jan 2025 16:25:15 +0100 Subject: [PATCH] Extend windows-gtk workflow to also build a package with libadwaita --- .github/libadwaita-appstream.diff | 146 ++++++++++++++++++++++++++++++ .github/workflows/windows-gtk.yml | 95 ++++++++++++++++--- 2 files changed, 229 insertions(+), 12 deletions(-) create mode 100644 .github/libadwaita-appstream.diff diff --git a/.github/libadwaita-appstream.diff b/.github/libadwaita-appstream.diff new file mode 100644 index 00000000..33080c00 --- /dev/null +++ b/.github/libadwaita-appstream.diff @@ -0,0 +1,146 @@ +diff --git a/src/adw-about-dialog.c b/src/adw-about-dialog.c +index 235f77f4..d7471036 100644 +--- a/src/adw-about-dialog.c ++++ b/src/adw-about-dialog.c +@@ -7,7 +7,6 @@ + + #include "config.h" + #include +-#include + + #include "adw-about-dialog.h" + +@@ -429,12 +428,12 @@ legal_showing_cb (AdwAboutDialog *self) + self->legal_showing_idle_id = 0; + } + +-static gboolean ++/*static gboolean + get_release_for_version (AsRelease *rel, + const char *version) + { + return !g_strcmp0 (as_release_get_version (rel), version); +-} ++}*/ + + static void + update_credits_legal_group (AdwAboutDialog *self) +@@ -2008,7 +2007,8 @@ AdwDialog * + adw_about_dialog_new_from_appdata (const char *resource_path, + const char *release_notes_version) + { +- AdwAboutDialog *self; ++ g_error("Appstream is not supported in this build"); ++ /*AdwAboutDialog* self; + GFile *appdata_file; + char *appdata_uri; + AsMetadata *metadata; +@@ -2126,7 +2126,7 @@ adw_about_dialog_new_from_appdata (const char *resource_path, + } + } + +- /* Handle deprecated SPDX IDs */ ++ /* Handle deprecated SPDX IDs *//* + for (i = 0; i < G_N_ELEMENTS (license_aliases); i++) { + if (g_strcmp0 (license_aliases[i].spdx_id, project_license) == 0) { + adw_about_dialog_set_license_type (self, license_aliases[i].license); +@@ -2152,7 +2152,7 @@ adw_about_dialog_new_from_appdata (const char *resource_path, + g_free (application_id); + g_free (appdata_uri); + +- return ADW_DIALOG (self); ++ return ADW_DIALOG (self);*/ + } + + /** +diff --git a/src/adw-about-window.c b/src/adw-about-window.c +index 2c17e129..c741283e 100644 +--- a/src/adw-about-window.c ++++ b/src/adw-about-window.c +@@ -6,7 +6,6 @@ + + #include "config.h" + #include +-#include + + #include "adw-about-window.h" + +@@ -421,12 +420,12 @@ legal_showing_cb (AdwAboutWindow *self) + g_idle_add_once ((GSourceOnceFunc) legal_showing_idle_cb, self); + } + +-static gboolean ++/*static gboolean + get_release_for_version (AsRelease *rel, + const char *version) + { + return !g_strcmp0 (as_release_get_version (rel), version); +-} ++}*/ + + static void + update_credits_legal_group (AdwAboutWindow *self) +@@ -2022,7 +2021,8 @@ GtkWidget * + adw_about_window_new_from_appdata (const char *resource_path, + const char *release_notes_version) + { +- AdwAboutWindow *self; ++ g_error("Appstream is not supported in this build"); ++ /*AdwAboutWindow* self; + GFile *appdata_file; + char *appdata_uri; + AsMetadata *metadata; +@@ -2140,7 +2140,7 @@ adw_about_window_new_from_appdata (const char *resource_path, + } + } + +- /* Handle deprecated SPDX IDs */ ++ /* Handle deprecated SPDX IDs *//* + for (i = 0; i < G_N_ELEMENTS (license_aliases); i++) { + if (g_strcmp0 (license_aliases[i].spdx_id, project_license) == 0) { + adw_about_window_set_license_type (self, license_aliases[i].license); +@@ -2166,7 +2166,7 @@ adw_about_window_new_from_appdata (const char *resource_path, + g_free (application_id); + g_free (appdata_uri); + +- return GTK_WIDGET (self); ++ return GTK_WIDGET (self);*/ + } + + /** +diff --git a/src/meson.build b/src/meson.build +index 03b6c248..b8ceeec2 100644 +--- a/src/meson.build ++++ b/src/meson.build +@@ -313,20 +313,12 @@ gtk_min_version = '>= 4.15.2' + + gio_dep = dependency('gio-2.0', version: glib_min_version) + gtk_dep = dependency('gtk4', version: gtk_min_version) +-appstream_dep = dependency('appstream', +- fallback : ['appstream', 'appstream_dep'], +- default_options : [ +- 'systemd=false', 'apidocs=false', 'install-docs=false', +- 'stemming=false', 'svg-support=false', 'gir=false', +- ], +-) + + libadwaita_deps = [ + dependency('glib-2.0', version: glib_min_version), + dependency('fribidi'), + gio_dep, + gtk_dep, +- appstream_dep, + cc.find_library('m', required: false), + ] + +diff --git a/subprojects/appstream.wrap b/subprojects/appstream.wrap +deleted file mode 100644 +index 4262a04b..00000000 +--- a/subprojects/appstream.wrap ++++ /dev/null +@@ -1,5 +0,0 @@ +-[wrap-git] +-directory = appstream +-url = https://github.com/ximion/appstream.git +-revision = main +-depth = 1 diff --git a/.github/workflows/windows-gtk.yml b/.github/workflows/windows-gtk.yml index 78072f8e..b6b00311 100644 --- a/.github/workflows/windows-gtk.yml +++ b/.github/workflows/windows-gtk.yml @@ -7,8 +7,11 @@ on: description: 'Upload artifacts as release' required: true type: boolean - tag: - description: 'The tag to clone' + gtktag: + description: 'The GTK tag to clone' + required: true + libadwaitatag: + description: 'The libadwaita tag to clone' required: true jobs: @@ -16,25 +19,88 @@ jobs: runs-on: windows-latest steps: + - name: Clone + uses: actions/checkout@v4 + with: + submodules: recursive + path: scripts + sparse-checkout: | + .github - name: Install Dependencies run: | choco uninstall -y mingw strawberryperl cmake.install llvm pip install meson ninja + - name: Clone pkgconf + uses: actions/checkout@v4 + with: + repository: 'pkgconf/pkgconf' + submodules: recursive + path: pkgconf + - name: Build pkgconf + run: | + meson setup pkgconf\build pkgconf --prefix ${{ github.workspace }}\pkgdist -Dtests=disabled --vsenv + meson compile -C pkgconf\build + meson install -C pkgconf\build + cp pkgdist\bin\pkgconf.exe pkgdist\bin\pkg-config.exe + echo "${{ github.workspace }}\pkgdist\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append + - name: Download winflexbison and gettext + run: | + curl -L https://github.com/lexxmark/winflexbison/releases/download/v2.5.25/win_flex_bison-2.5.25.zip -o win_flex_bison.zip + 7z x win_flex_bison.zip -owin_flex_bison + echo "${{ github.workspace }}\win_flex_bison" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append + curl -L https://github.com/mlocati/gettext-iconv-windows/releases/download/v0.23-v1.17/gettext0.23-iconv1.17-static-64.zip -o gettext.zip + 7z x gettext.zip -ogettext + echo "${{ github.workspace }}\gettext\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append - name: Clone GTK tree uses: actions/checkout@v4 with: - ref: ${{ inputs.tag }} + ref: ${{ inputs.gtktag }} repository: 'GNOME/gtk' submodules: recursive - - name: Perform Build + path: gtk + - name: Build GTK run: | - meson setup build --prefix ${{ github.workspace }}\dist --buildtype release -Db_pie=true -Dbuild-tests=false -Dmedia-gstreamer=disabled -Dvulkan=disabled --vsenv - meson compile -C build - meson install -C build + meson setup gtk\build gtk --pkg-config-path ${{ github.workspace }}\dist\lib\pkgconfig --build.pkg-config-path ${{ github.workspace }}\dist\lib\pkgconfig --prefix ${{ github.workspace }}\dist --buildtype release --vsenv -Db_pie=true -Dbuild-tests=false -Dmedia-gstreamer=disabled -Dvulkan=disabled + meson compile -C gtk\build + meson install -C gtk\build cd dist\bin 7z a ..\..\natives.zip *.dll 7z a ..\..\executable.zip *.exe cd ..\.. + cp natives.zip natives-gtk.zip + cp executable.zip executable-gtk.zip + echo "${{ github.workspace }}\dist\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append + - name: Clone gobject-introspection + uses: actions/checkout@v4 + with: + repository: 'GNOME/gobject-introspection' + submodules: recursive + path: gobject-introspection + - name: Build gobject-introspection + run: | + meson setup gobject-introspection\build gobject-introspection --prefix ${{ github.workspace }}\dist --buildtype release --vsenv -Db_pie=true -Dglib2:introspection=enabled + meson compile -C gobject-introspection\build + meson install -C gobject-introspection\build + - name: Clone libadwaita tree + uses: actions/checkout@v4 + with: + ref: ${{ inputs.libadwaitatag }} + repository: 'GNOME/libadwaita' + submodules: recursive + path: libadwaita + - name: Build libadwaita + run: | + git -C libadwaita apply ${{ github.workspace }}/scripts/.github/libadwaita-appstream.diff + meson setup libadwaita\build libadwaita --pkg-config-path ${{ github.workspace }}\dist\lib\pkgconfig --build.pkg-config-path ${{ github.workspace }}\dist\lib\pkgconfig --prefix ${{ github.workspace }}\dist --buildtype release --vsenv -Db_pie=true -Dvapi=false -Dexamples=false -Dtests=false -Dintrospection=disabled + meson compile -C libadwaita\build + meson install -C libadwaita\build + cd dist\bin + 7z a ..\..\natives-adw.zip *.dll + 7z a ..\..\executable-adw.zip *.exe + cd ..\.. + - name: Finish up + run: | + cp pkgdist\bin\pkg-config.exe pkg-config.exe - name: Library artifact uses: actions/upload-artifact@v4 with: @@ -47,14 +113,19 @@ jobs: name: applications path: | dist\bin\*.exe + pkg-config.exe - name: Generate Release - uses: "marvinpinto/action-automatic-releases@latest" + uses: softprops/action-gh-release@v2 if: ${{ inputs.release }} with: - repo_token: "${{ secrets.GITHUB_TOKEN }}" - automatic_release_tag: "libraries" - prerelease: false - title: "GTK Natives for ${{ inputs.tag }}" + token: "${{ secrets.GITHUB_TOKEN }}" + tag_name: "libraries" + name: "Natives for GTK ${{ inputs.gtktag }} and libadwaita ${{ inputs.libadwaitatag }}" files: | natives.zip executable.zip + natives-gtk.zip + executable-gtk.zip + natives-adw.zip + executable-adw.zip + pkg-config.exe \ No newline at end of file