From 651e01bf699c0fa31ef4771f6150a44c65778746 Mon Sep 17 00:00:00 2001 From: Artem Anufrij Date: Thu, 11 Oct 2018 21:56:34 +0200 Subject: [PATCH] cmake --> meson --- CMakeLists.txt | 39 ---- data/CMakeLists.txt | 8 - .../com.github.artemanufrij.webpin.svg | 0 data/meson.build | 30 +++ debian/control | 3 +- meson.build | 22 ++ meson/post_install.py | 24 +++ po/CMakeLists.txt | 6 - po/LINGUAS | 196 ++++++++++++++++++ po/POTFILES | 9 + po/meson.build | 6 + schemas/CMakeLists.txt | 5 - schemas/meson.build | 4 + src/CMakeLists.txt | 28 --- src/meson.build | 13 ++ 15 files changed, 305 insertions(+), 88 deletions(-) delete mode 100644 CMakeLists.txt delete mode 100644 data/CMakeLists.txt rename data/icons/{ => 64}/com.github.artemanufrij.webpin.svg (100%) create mode 100644 data/meson.build create mode 100644 meson.build create mode 100644 meson/post_install.py delete mode 100644 po/CMakeLists.txt create mode 100644 po/LINGUAS create mode 100644 po/POTFILES create mode 100644 po/meson.build delete mode 100644 schemas/CMakeLists.txt create mode 100644 schemas/meson.build delete mode 100644 src/CMakeLists.txt create mode 100644 src/meson.build diff --git a/CMakeLists.txt b/CMakeLists.txt deleted file mode 100644 index e1ea2f8..0000000 --- a/CMakeLists.txt +++ /dev/null @@ -1,39 +0,0 @@ -cmake_minimum_required (VERSION 2.8) -cmake_policy (VERSION 2.8) - -project (com.github.artemanufrij.webpin) -include (GNUInstallDirs) -set (DATADIR "${CMAKE_INSTALL_FULL_DATAROOTDIR}") -set (PKGDATADIR "${DATADIR}/${CMAKE_PROJECT_NAME}") -set (GETTEXT_PACKAGE ${CMAKE_PROJECT_NAME}) -add_definitions ("-DGETTEXT_PACKAGE=\"${GETTEXT_PACKAGE}\"") - -list (APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake) - -find_package(PkgConfig) -pkg_check_modules(DEPS REQUIRED - gtk+-3.0>=3.12 - granite - webkit2gtk-4.0 -) - -add_definitions (-w) - - -add_definitions(${DEPS_CFLAGS}) -link_libraries(${DEPS_LIBRARIES}) -link_directories(${DEPS_LIBRARY_DIRS}) - -include(ValaPrecompile) -find_package(Vala REQUIRED) -include(ValaVersion) -ensure_vala_version("0.26.0" MINIMUM) - -add_subdirectory (src) -# Translation files -set (GETTEXT_PACKAGE "${CMAKE_PROJECT_NAME}") -add_definitions (-DGETTEXT_PACKAGE=\"${GETTEXT_PACKAGE}\") -add_subdirectory (po) -add_subdirectory (data) -add_subdirectory (schemas) - diff --git a/data/CMakeLists.txt b/data/CMakeLists.txt deleted file mode 100644 index b91ec4e..0000000 --- a/data/CMakeLists.txt +++ /dev/null @@ -1,8 +0,0 @@ -install (FILES com.github.artemanufrij.webpin.desktop DESTINATION ${CMAKE_INSTALL_FULL_DATAROOTDIR}/applications) -install (FILES com.github.artemanufrij.webpin.appdata.xml DESTINATION ${CMAKE_INSTALL_FULL_DATAROOTDIR}/metainfo) - -install (FILES icons/com.github.artemanufrij.webpin.svg DESTINATION ${CMAKE_INSTALL_FULL_DATAROOTDIR}/icons/hicolor/) -install (FILES icons/32/com.github.artemanufrij.webpin.svg DESTINATION ${CMAKE_INSTALL_FULL_DATAROOTDIR}/icons/hicolor/32x32/apps/) -install (FILES icons/48/com.github.artemanufrij.webpin.svg DESTINATION ${CMAKE_INSTALL_FULL_DATAROOTDIR}/icons/hicolor/48x48/apps/) -install (FILES icons/com.github.artemanufrij.webpin.svg DESTINATION ${CMAKE_INSTALL_FULL_DATAROOTDIR}/icons/hicolor/64x64/apps/) -install (FILES icons/com.github.artemanufrij.webpin.svg DESTINATION ${CMAKE_INSTALL_FULL_DATAROOTDIR}/icons/hicolor/128x128/apps/) diff --git a/data/icons/com.github.artemanufrij.webpin.svg b/data/icons/64/com.github.artemanufrij.webpin.svg similarity index 100% rename from data/icons/com.github.artemanufrij.webpin.svg rename to data/icons/64/com.github.artemanufrij.webpin.svg diff --git a/data/meson.build b/data/meson.build new file mode 100644 index 0000000..c18df94 --- /dev/null +++ b/data/meson.build @@ -0,0 +1,30 @@ +icon_sizes = ['32', '48', '64'] + +foreach i : icon_sizes + install_data( + join_paths('icons/', i, meson.project_name() + '.svg'), + install_dir: join_paths(get_option('datadir'), 'icons', 'hicolor', i + 'x' + i, 'apps') + ) +endforeach + +foreach i : icon_sizes + install_data( + join_paths('icons/', i, meson.project_name() + '.svg'), + install_dir: join_paths(get_option('datadir'), 'icons/hicolor', i + 'x' + i, 'mimetypes') + ) +endforeach + +install_data( + 'icons/64/' + meson.project_name() + '.svg', + install_dir: join_paths(get_option('datadir'), 'icons/hicolor/scalable/apps') +) + +install_data( + meson.project_name() + '.desktop', + install_dir: join_paths(get_option('datadir'), 'applications') +) + +install_data( + meson.project_name() + '.appdata.xml', + install_dir: join_paths(get_option('datadir'), 'metainfo') +) \ No newline at end of file diff --git a/debian/control b/debian/control index 172b2f1..8363695 100644 --- a/debian/control +++ b/debian/control @@ -2,8 +2,7 @@ Source: com.github.artemanufrij.webpin Section: x11 Priority: optional Maintainer: Artem Anufrij -Build-Depends: cmake (>= 2.8), - cmake-elementary, +Build-Depends: meson, debhelper (>= 9), libgranite-dev, libwebkit2gtk-4.0-dev, diff --git a/meson.build b/meson.build new file mode 100644 index 0000000..a8dcd90 --- /dev/null +++ b/meson.build @@ -0,0 +1,22 @@ +project('com.github.artemanufrij.webpin','vala', 'c') + +i18n = import('i18n') +add_global_arguments('-DGETTEXT_PACKAGE="@0@"'.format (meson.project_name()), language:'c') + +subdir('src') +subdir('po') +subdir('data') +subdir('schemas') + +executable( + meson.project_name(), + sources, + dependencies: [ + dependency('gtk+-3.0'), + dependency('granite'), + dependency('webkit2gtk-4.0') + ], + install: true +) + +meson.add_install_script('meson/post_install.py') \ No newline at end of file diff --git a/meson/post_install.py b/meson/post_install.py new file mode 100644 index 0000000..47bea16 --- /dev/null +++ b/meson/post_install.py @@ -0,0 +1,24 @@ +#!/usr/bin/env python3 + +import os +import subprocess + +prefix = os.environ.get('MESON_INSTALL_PREFIX', '/usr') +datadir = os.path.join(prefix, 'share') + +# Packaging tools define DESTDIR and this isn't needed for them +if 'DESTDIR' not in os.environ: + + + print('Compiling gsettings schemas...') + schema_dir = os.path.join(datadir, 'glib-2.0/schemas') + subprocess.call(['glib-compile-schemas', schema_dir]) + + print('Updating icon cache...') + icon_cache_dir = os.path.join(datadir, 'icons', 'hicolor') + + subprocess.call(['gtk-update-icon-cache', '-qtf', icon_cache_dir]) + + print('Updating desktop database...') + desktop_database_dir = os.path.join(datadir, 'applications') + subprocess.call(['update-desktop-database', '-q', desktop_database_dir]) diff --git a/po/CMakeLists.txt b/po/CMakeLists.txt deleted file mode 100644 index b18630c..0000000 --- a/po/CMakeLists.txt +++ /dev/null @@ -1,6 +0,0 @@ -include (Translations) - add_translations_directory(${GETTEXT_PACKAGE}) - add_translations_catalog(${GETTEXT_PACKAGE} - ../src/ - ../data -) diff --git a/po/LINGUAS b/po/LINGUAS new file mode 100644 index 0000000..32f9ece --- /dev/null +++ b/po/LINGUAS @@ -0,0 +1,196 @@ +aa +ab +ae +af +ak +am +an +ar +as +ast +av +ay +az +ba +be +bg +bh +bi +bm +bn +bo +br +bs +ca +ce +ch +ckb +co +cr +cs +cu +cv +cy +da +de +dv +dz +ee +el +en_AU +en_CA +en_GB +eo +es +et +eu +fa +ff +fi +fj +fo +fr_CA +fr +fy +ga +gd +gl +gn +gu +gv +ha +he +hi +ho +hr +ht +hu +hy +hz +ia +id +ie +ig +ii +ik +io +is +it +iu +ja +jv +ka +kg +ki +kj +kk +kl +km +kn +ko +kr +ks +ku +kv +kw +ky +la +lb +lg +li +ln +lo +lt +lu +lv +mg +mh +mi +mk +ml +mn +mo +mr +ms +mt +my +na +nb +nd +ne +ng +nl +nn +no +nr +nv +ny +oc +oj +om +or +os +pa +pi +pl +ps +pt_BR +pt +qu +rm +rn +ro +rue +ru +rw +sa +sc +sd +se +sg +si +sk +sl +sma +sm +sn +so +sq +sr +ss +st +su +sv +sw +ta +te +tg +th +ti +tk +tl +tn +to +tr +ts +tt +tw +ty +ug +uk +ur +uz +ve +vi +vo +wa +wo +xh +yi +yo +za +zh_CN +zh_HK +zh +zh_TW +zu diff --git a/po/POTFILES b/po/POTFILES new file mode 100644 index 0000000..e16ac81 --- /dev/null +++ b/po/POTFILES @@ -0,0 +1,9 @@ +src/Widgets/WebItem.vala +src/Widgets/Views/WebItemsView.vala +src/Widgets/Views/Editor.vala +src/Widgets/Browser.vala +src/Windows/WebApp.vala +src/Objects/DesktopFile.vala +src/Dialogs/Preferences.vala +src/Services/DesktopFilesManager.vala +src/MainWindow.vala \ No newline at end of file diff --git a/po/meson.build b/po/meson.build new file mode 100644 index 0000000..50da237 --- /dev/null +++ b/po/meson.build @@ -0,0 +1,6 @@ +i18n.gettext(meson.project_name(), + args: [ + '--directory=' + meson.source_root(), + '--from-code=UTF-8' + ] +) \ No newline at end of file diff --git a/schemas/CMakeLists.txt b/schemas/CMakeLists.txt deleted file mode 100644 index 90282d4..0000000 --- a/schemas/CMakeLists.txt +++ /dev/null @@ -1,5 +0,0 @@ -# -# GSettings Schema -# -include(GSettings) -add_schema(com.github.artemanufrij.webpin.gschema.xml) diff --git a/schemas/meson.build b/schemas/meson.build new file mode 100644 index 0000000..6147542 --- /dev/null +++ b/schemas/meson.build @@ -0,0 +1,4 @@ +install_data( + meson.project_name() + '.gschema.xml', + install_dir: join_paths(get_option('datadir'), 'glib-2.0', 'schemas') +) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt deleted file mode 100644 index b26fde2..0000000 --- a/src/CMakeLists.txt +++ /dev/null @@ -1,28 +0,0 @@ -vala_precompile(VALA_C ${CMAKE_PROJECT_NAME} - Widgets/WebItem.vala - Widgets/Views/WebItemsView.vala - Widgets/Views/Editor.vala - Widgets/Browser.vala - Windows/WebApp.vala - Objects/DesktopFile.vala - Dialogs/Preferences.vala - Services/DesktopFilesManager.vala - Settings.vala - MainWindow.vala - Application.vala -PACKAGES - gtk+-3.0 - granite - webkit2gtk-4.0 - -OPTIONS - --vapidir=${CMAKE_SOURCE_DIR}/vapi - --thread - --target-glib=2.32 -) - -add_executable (${CMAKE_PROJECT_NAME} ${VALA_C}) -target_link_libraries (${CMAKE_PROJECT_NAME} ${DEPS_LIBRARIES}) - -# Installation -install (TARGETS ${CMAKE_PROJECT_NAME} RUNTIME DESTINATION ${CMAKE_INSTALL_FULL_BINDIR}) diff --git a/src/meson.build b/src/meson.build new file mode 100644 index 0000000..599f371 --- /dev/null +++ b/src/meson.build @@ -0,0 +1,13 @@ +sources = files( + 'Widgets/WebItem.vala', + 'Widgets/Views/WebItemsView.vala', + 'Widgets/Views/Editor.vala', + 'Widgets/Browser.vala', + 'Windows/WebApp.vala', + 'Objects/DesktopFile.vala', + 'Dialogs/Preferences.vala', + 'Services/DesktopFilesManager.vala', + 'Settings.vala', + 'MainWindow.vala', + 'Application.vala' +) \ No newline at end of file