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

[glib] Use meson build system. #11477

Closed
wants to merge 17 commits into from
Closed

[glib] Use meson build system. #11477

wants to merge 17 commits into from

Conversation

vlj
Copy link
Contributor

@vlj vlj commented May 20, 2020

Describe the pull request

  • What does your PR fix? Fixes [glib] Upgrade glib and use meson build system. #11476

  • Which triplets are supported/not supported? Have you updated the CI baseline?
    Normally all previous triplets are supported (at least tested x64 and ported arm patches, hopefully mac works out of the box)

About the PR:
It ditches CMakeLists.txt (apparently some files like gfilemonitor were not even included by glib) and use meson instead. To preserve backward compatibility I added some targets.cmake files which are copied after installation, they allow others ports to maintain compatibility.

There is no more config.h.win32.in with meson but several .in files, I think that it's now responsible to handle arm64.

@vlj
Copy link
Contributor Author

vlj commented May 20, 2020

I'm using this PR to see if things build with all platforms.

@vlj vlj force-pushed the glib-meson branch 6 times, most recently from 4be3ed6 to bba81ce Compare May 20, 2020 21:05
@vlj
Copy link
Contributor Author

vlj commented May 20, 2020

How can I fix linux build ? It complains that meson is not installed by apt.

@vlj
Copy link
Contributor Author

vlj commented May 20, 2020

arm64 fails because cross compilation is not enabled in meson so far...
#11230

@c72578
Copy link
Contributor

c72578 commented May 22, 2020

How can I fix linux build ? It complains that meson is not installed by apt.

Meson needs to be installed on the Linux build host.

CMake Error at scripts/cmake/vcpkg_find_acquire_program.cmake:367 (message):
  Could not find meson.  Please install it via your package manager:

      sudo apt-get install meson

@JackBoosY JackBoosY added the depends:different-pr This PR or Issue depends on a PR which has been filed label May 22, 2020
@JackBoosY
Copy link
Contributor

I think we should fix meson cross compilation first.

@MVoz
Copy link
Contributor

MVoz commented May 22, 2020

sudo apt-get install meson

not latest version

@vlj
Copy link
Contributor Author

vlj commented May 22, 2020

Meson needs to be installed on the Linux build host.

But how can I do that ? Is there a script that control what is installed on azure agents ?

@vlj
Copy link
Contributor Author

vlj commented May 23, 2020

I changed include pathes, meson build added a glib-2.0/ prefix to very glib file but every packages in vcpkg expected glib includes to be in include/

@vlj
Copy link
Contributor Author

vlj commented May 23, 2020

By the way the osx64 build fails but it doesn't tell why ?

@MVoz
Copy link
Contributor

MVoz commented May 23, 2020

https://cmake.org/cmake/help/latest/variable/CMAKE_HOST_UNIX.html
https://cmake.org/cmake/help/latest/module/FindPython3.html

elseif(VAR MATCHES "MESON")

    if(CMAKE_HOST_WIN32 AND CMAKE_HOST_UNIX)
      set(SCRIPTNAME meson.py)
    else()
      set(SCRIPTNAME meson)
    endif()

...

    if(CMAKE_HOST_UNIX)
      find_package(Python3 COMPONENTS Interpreter)
      set(PYTHON3 ${PYTHON3_EXECUTABLE})
    else()

?

@Neumann-A
Copy link
Contributor

Neumann-A commented May 23, 2020

vlj force-pushed the vlj:glib-meson branch from a2d7b9f to 5254d9b 3 hours ago

ah man ..... and i was just doing that

Building package glib[core]:arm64-windows... done
Installing package glib[core]:arm64-windows...
Installing package glib[core]:arm64-windows... done
Elapsed time for package glib:arm64-windows: 2.114 min

@Neumann-A
Copy link
Contributor

Homepage: https://developer.gnome.org/glib/
Description: Portable, general-purpose utility library.
Build-Depends: zlib, pcre, libffi, gettext, libiconv
Build-Depends: zlib, pcre, libffi, gettext, libiconv, tool-meson
Copy link
Contributor

@c72578 c72578 May 24, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add dirent to Build-Depends, which removes the following error message in meson-log.txt:

testfile.c(4): fatal error C1189: #error:  "Header 'dirent.h' could not be found"
Has header "dirent.h" : NO

@Neumann-A
Copy link
Contributor

Run-time dependency libpcre found: NO (tried pkgconfig and cmake)
Library pcred found: NO
Run-time dependency libelf found: NO (tried pkgconfig and cmake)
Library elf found: NO

@c72578
Copy link
Contributor

c72578 commented May 24, 2020

How about adding the following to portfile.cmake:

if(CMAKE_HOST_WIN32)
set(MESON_COMMON_CFLAGS "${MESON_COMMON_CFLAGS} /I${CURRENT_INSTALLED_DIR}/include")
set(MESON_DEBUG_LDFLAGS "${MESON_DEBUG_LDFLAGS} /LIBPATH:${CURRENT_INSTALLED_DIR}/debug/lib")
set(MESON_RELEASE_LDFLAGS "${MESON_RELEASE_LDFLAGS} /LIBPATH:${CURRENT_INSTALLED_DIR}/lib")
endif()

This will enable e.g. the following (see meson-log.txt):

Has header "dirent.h" : YES 
Library pcre found: YES

@vlj
Copy link
Contributor Author

vlj commented May 24, 2020

Are these defines not done by vcpkg_configure_meson ?

@c72578
Copy link
Contributor

c72578 commented May 24, 2020

Are these defines not done by vcpkg_configure_meson ?

Not yet ...

@vlj
Copy link
Contributor Author

vlj commented May 25, 2020

I reverted the include path to their original location.
There is a header in lib/glib-2.0/include/glibconfig.h, I leave it there too but I don't know if it's the right way to do. I think some others package may expect it there if they are moved to meson.

@c72578
Copy link
Contributor

c72578 commented May 26, 2020

I reverted the include path to their original location.
There is a header in lib/glib-2.0/include/glibconfig.h, I leave it there too but I don't know if it's the right way to do. I think some others package may expect it there if they are moved to meson.

I found some explanation concerning lib/glib-2.0/include/glibconfig.h here:
libvips/libvips#909 (comment)

@vlj
Copy link
Contributor Author

vlj commented May 26, 2020

I fixed most build error except for atkmm for now (it's a msbuild like ports so I need some time to figure out how to fix it)

@MVoz
Copy link
Contributor

MVoz commented May 26, 2020

if do, then the whole GNOME, under MESON

@vlj
Copy link
Contributor Author

vlj commented May 27, 2020

?

@Neumann-A
Copy link
Contributor

@vlj He is saying to also switch the other ports to meson. But that is a different PR in my opinion

@c72578
Copy link
Contributor

c72578 commented May 30, 2020

I fixed most build error except for atkmm for now (it's a msbuild like ports so I need some time to figure out how to fix it)

@vlj Here is a workaround for atkmm. Please have a look.
However, I guess in the future we will also switch to meson for atkmm and update it to a newer version ...

diff --git a/ports/atkmm/CONTROL b/ports/atkmm/CONTROL
index caf3abb43..3ffe29ba2 100644
--- a/ports/atkmm/CONTROL
+++ b/ports/atkmm/CONTROL
@@ -1,5 +1,5 @@
 Source: atkmm
-Version: 2.24.2-2
+Version: 2.24.2-3
 Homepage: https://www.gtkmm.org
 Description: atkmm is the official C++ interface for the ATK accessibility toolkit library. It may be used, for instance, by user interfaces implemented with gtkmm.
 Build-Depends: glib, gettext, atk, glibmm
diff --git a/ports/atkmm/fix_properties.patch b/ports/atkmm/fix_properties.patch
index a03924386..d1a18da91 100644
--- a/ports/atkmm/fix_properties.patch
+++ b/ports/atkmm/fix_properties.patch
@@ -16,7 +16,7 @@ index 421f5c3..0275e6e 100644
    <ItemDefinitionGroup>
      <ClCompile>
 -      <AdditionalIncludeDirectories>.\atkmm;..\atk;$(GlibEtcInstallRoot)\include\glibmm-2.4;$(GlibEtcInstallRoot)\lib\glibmm-2.4\include;$(GlibEtcInstallRoot)\include\sigc++-2.0;$(GlibEtcInstallRoot)\lib\sigc++-2.0\include;$(GlibEtcInstallRoot)\include\atk-1.0;$(GlibEtcInstallRoot)\include\glib-2.0;$(GlibEtcInstallRoot)\lib\glib-2.0\include;$(GlibEtcInstallRoot)\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-+      <AdditionalIncludeDirectories>.\atkmm;..\atk;.;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
++      <AdditionalIncludeDirectories>.\atkmm;..\atk;.;$(CurrentInstalledDir)\include\glib-2.0;$(CurrentInstalledDir)\lib\glib-2.0\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
        <ForcedIncludeFiles>msvc_recommended_pragmas.h;%(ForcedIncludeFiles)</ForcedIncludeFiles>
        <MultiProcessorCompilation>true</MultiProcessorCompilation>
        <AdditionalOptions>/d2Zi+ %(AdditionalOptions)</AdditionalOptions>
diff --git a/ports/atkmm/portfile.cmake b/ports/atkmm/portfile.cmake
index f8e9df294..6d9fc541a 100644
--- a/ports/atkmm/portfile.cmake
+++ b/ports/atkmm/portfile.cmake
@@ -1,5 +1,3 @@
-include(vcpkg_common_functions)
-
 vcpkg_check_linkage(ONLY_DYNAMIC_LIBRARY)
 
 vcpkg_download_distfile(ARCHIVE
@@ -26,6 +24,10 @@ vcpkg_build_msbuild(
     PROJECT_PATH ${SOURCE_PATH}/MSVC_Net2013/atkmm.sln
     TARGET atkmm
     PLATFORM ${VS_PLATFORM}
+    OPTIONS
+    # Remark: This is a workaround for now. When updating atkmm to a newer version, meson should be used instead
+    # CurrentInstalledDir is used by fix_properties.patch for glib-2.0 include dirs
+        /p:CurrentInstalledDir=${CURRENT_INSTALLED_DIR}
     USE_VCPKG_INTEGRATION
 )
 

atkmm_glib_2_patch.zip

@vlj
Copy link
Contributor Author

vlj commented May 30, 2020

Sorry for the delay, I added you patch thanks !

@vlj
Copy link
Contributor Author

vlj commented May 31, 2020

I needed to fix glib gdbus-codegen because it hardcoded path to package.

@vlj
Copy link
Contributor Author

vlj commented May 31, 2020

I fixed gtkmm.

@vlj
Copy link
Contributor Author

vlj commented May 31, 2020

It seems like all dependent project are fixed (at least on windows).
Can't wait to get the meson PRs and this one merged so that all project can be switched to meson.

@Neumann-A
Copy link
Contributor

mind trying out #12945?

@vlj
Copy link
Contributor Author

vlj commented Aug 27, 2020

What do you mean ?

@JackBoosY
Copy link
Contributor

Could you please solve these regressions?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
depends:different-pr This PR or Issue depends on a PR which has been filed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[glib] Upgrade glib and use meson build system.
5 participants