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

Port build to meson #243

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Port build to meson #243

wants to merge 1 commit into from

Conversation

Cogitri
Copy link

@Cogitri Cogitri commented Mar 2, 2021

Meson is a next generation buildsystem with many advantages:

  • Way faster configuration times
  • Clearer error messages
  • Easier to write
  • Less errorprone

If you like this for qalculate-gtk I wouldn't mind doing the same port for libqalculate.

A few notes:

The build with GCC10 seems to fail currently, compiling with clang 10 works just fine though so I'm not sure if this is caused by this change. The error is:

FAILED: src/qalculate-gtk.p/interface.cc.o 
c++ -Isrc/qalculate-gtk.p -Isrc -I../src -I. -I.. -Idata -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/gtk-3.0 -I/usr/include/pango-1.0 -I/usr/include/harfbuzz -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/fribidi -I/usr/include/libxml2 -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/gio-unix-2.0 -I/usr/include/atk-1.0 -I/usr/include/at-spi2-atk/2.0 -I/usr/include/dbus-1.0 -I/usr/lib64/dbus-1.0/include -I/usr/include/at-spi-2.0 -fdiagnostics-color=always -pipe -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wnon-virtual-dtor -Wextra -std=c++11 -g -DHAVE_CONFIG_H=1 -pthread -MD -MQ src/qalculate-gtk.p/interface.cc.o -MF src/qalculate-gtk.p/interface.cc.o.d -o src/qalculate-gtk.p/interface.cc.o -c ../src/interface.cc
In file included from /usr/include/c++/10/ext/hash_map:60,
                 from ../src/interface.cc:49:
/usr/include/c++/10/backward/backward_warning.h:32:2: warning: #warning This file includes at least one deprecated or antiquated header which may be removed without further notice at a future date. Please use a non-deprecated interface with equivalent functionality instead. For a listing of replacement headers and interfaces, consult the file backward_warning.h. To disable this warning use -Wno-deprecated. [-Wcpp]
   32 | #warning \
      |  ^~~~~~~
In file included from /usr/include/c++/10/ext/hash_map:64,
                 from ../src/interface.cc:49:
/usr/include/c++/10/backward/hashtable.h: In instantiation of ‘__gnu_cxx::hashtable<_Val, _Key, _HashFcn, _ExtractKey, _EqualKey, _Alloc>::size_type __gnu_cxx::hashtable<_Val, _Key, _HashFcn, _ExtractKey, _EqualKey, _Alloc>::_M_bkt_num_key(const key_type&, std::size_t) const [with _Val = std::pair<const std::__cxx11::basic_string<char>, _GdkPixbuf*>; _Key = std::__cxx11::basic_string<char>; _HashFcn = __gnu_cxx::hash<std::__cxx11::basic_string<char> >; _ExtractKey = std::_Select1st<std::pair<const std::__cxx11::basic_string<char>, _GdkPixbuf*> >; _EqualKey = std::equal_to<std::__cxx11::basic_string<char> >; _Alloc = std::allocator<_GdkPixbuf*>; __gnu_cxx::hashtable<_Val, _Key, _HashFcn, _ExtractKey, _EqualKey, _Alloc>::size_type = long unsigned int; __gnu_cxx::hashtable<_Val, _Key, _HashFcn, _ExtractKey, _EqualKey, _Alloc>::key_type = std::__cxx11::basic_string<char>; std::size_t = long unsigned int]’:
/usr/include/c++/10/backward/hashtable.h:596:30:   required from ‘__gnu_cxx::hashtable<_Val, _Key, _HashFcn, _ExtractKey, _EqualKey, _Alloc>::size_type __gnu_cxx::hashtable<_Val, _Key, _HashFcn, _ExtractKey, _EqualKey, _Alloc>::_M_bkt_num_key(const key_type&) const [with _Val = std::pair<const std::__cxx11::basic_string<char>, _GdkPixbuf*>; _Key = std::__cxx11::basic_string<char>; _HashFcn = __gnu_cxx::hash<std::__cxx11::basic_string<char> >; _ExtractKey = std::_Select1st<std::pair<const std::__cxx11::basic_string<char>, _GdkPixbuf*> >; _EqualKey = std::equal_to<std::__cxx11::basic_string<char> >; _Alloc = std::allocator<_GdkPixbuf*>; __gnu_cxx::hashtable<_Val, _Key, _HashFcn, _ExtractKey, _EqualKey, _Alloc>::size_type = long unsigned int; __gnu_cxx::hashtable<_Val, _Key, _HashFcn, _ExtractKey, _EqualKey, _Alloc>::key_type = std::__cxx11::basic_string<char>]’
/usr/include/c++/10/backward/hashtable.h:519:32:   required from ‘__gnu_cxx::hashtable<_Val, _Key, _HashFcn, _ExtractKey, _EqualKey, _Alloc>::iterator __gnu_cxx::hashtable<_Val, _Key, _HashFcn, _ExtractKey, _EqualKey, _Alloc>::find(const key_type&) [with _Val = std::pair<const std::__cxx11::basic_string<char>, _GdkPixbuf*>; _Key = std::__cxx11::basic_string<char>; _HashFcn = __gnu_cxx::hash<std::__cxx11::basic_string<char> >; _ExtractKey = std::_Select1st<std::pair<const std::__cxx11::basic_string<char>, _GdkPixbuf*> >; _EqualKey = std::equal_to<std::__cxx11::basic_string<char> >; _Alloc = std::allocator<_GdkPixbuf*>; __gnu_cxx::hashtable<_Val, _Key, _HashFcn, _ExtractKey, _EqualKey, _Alloc>::iterator = __gnu_cxx::hashtable<std::pair<const std::__cxx11::basic_string<char>, _GdkPixbuf*>, std::__cxx11::basic_string<char>, __gnu_cxx::hash<std::__cxx11::basic_string<char> >, std::_Select1st<std::pair<const std::__cxx11::basic_string<char>, _GdkPixbuf*> >, std::equal_to<std::__cxx11::basic_string<char> >, std::allocator<_GdkPixbuf*> >::iterator; __gnu_cxx::hashtable<_Val, _Key, _HashFcn, _ExtractKey, _EqualKey, _Alloc>::key_type = std::__cxx11::basic_string<char>]’
/usr/include/c++/10/ext/hash_map:213:26:   required from ‘__gnu_cxx::hash_map<_Key, _Tp, _HashFn, _EqualKey, _Alloc>::iterator __gnu_cxx::hash_map<_Key, _Tp, _HashFn, _EqualKey, _Alloc>::find(const key_type&) [with _Key = std::__cxx11::basic_string<char>; _Tp = _GdkPixbuf*; _HashFn = __gnu_cxx::hash<std::__cxx11::basic_string<char> >; _EqualKey = std::equal_to<std::__cxx11::basic_string<char> >; _Alloc = std::allocator<_GdkPixbuf*>; __gnu_cxx::hash_map<_Key, _Tp, _HashFn, _EqualKey, _Alloc>::iterator = __gnu_cxx::hashtable<std::pair<const std::__cxx11::basic_string<char>, _GdkPixbuf*>, std::__cxx11::basic_string<char>, __gnu_cxx::hash<std::__cxx11::basic_string<char> >, std::_Select1st<std::pair<const std::__cxx11::basic_string<char>, _GdkPixbuf*> >, std::equal_to<std::__cxx11::basic_string<char> >, std::allocator<_GdkPixbuf*> >::iterator; __gnu_cxx::hash_map<_Key, _Tp, _HashFn, _EqualKey, _Alloc>::key_type = std::__cxx11::basic_string<char>]’
../src/interface.cc:1167:3:   required from here
/usr/include/c++/10/backward/hashtable.h:604:23: error: no match for call to ‘(const hasher {aka const __gnu_cxx::hash<std::__cxx11::basic_string<char> >}) (const key_type&)’
  604 |       { return _M_hash(__key) % __n; }
      |                ~~~~~~~^~~~~~~
  • The ported build system installs qalculate-search-provider to libexec which is a more fitting dir for this IMHO. We can install it to lib too though, if you prefer that.
  • I had to do a few changes to the internationalisation (namely instead of doing intltool-style prefixing with _ meson expects variables to not have special prefixes. That change would break the current Autotools i18n setup, I suppose.

Other than that, meson should produce the same output as autotools does currently, but I can't test this on Windows (it should work just as well or even better though).
I haven't tested ninja -C build dist output yet, I can look into that in a bit.

@hanna-kn
Copy link
Contributor

The build failure is caused by incomplete porting to meson.

AC_CHECK_HEADERS([unordered_map]) defines HAVE_UNORDERED_MAP, and unordered_map will is thereby used instead of deprecated hash_map.

Meson is a next generation buildsystem with many advantages:

* Way faster configuration times
* Clearer error messages
* Easier to write
* Less errorprone
@Cogitri
Copy link
Author

Cogitri commented Mar 12, 2021

Thanks, fixed in the latest version.

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

Successfully merging this pull request may close these issues.

2 participants