cmake --> meson

This commit is contained in:
Artem Anufrij 2018-10-11 21:56:34 +02:00
parent dd5ecb38d5
commit 651e01bf69
15 changed files with 305 additions and 88 deletions

View file

@ -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)

View file

@ -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/)

View file

Before

Width:  |  Height:  |  Size: 9.7 KiB

After

Width:  |  Height:  |  Size: 9.7 KiB

30
data/meson.build Normal file
View file

@ -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')
)

3
debian/control vendored
View file

@ -2,8 +2,7 @@ Source: com.github.artemanufrij.webpin
Section: x11
Priority: optional
Maintainer: Artem Anufrij <artem.anufrij@live.de>
Build-Depends: cmake (>= 2.8),
cmake-elementary,
Build-Depends: meson,
debhelper (>= 9),
libgranite-dev,
libwebkit2gtk-4.0-dev,

22
meson.build Normal file
View file

@ -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')

24
meson/post_install.py Normal file
View file

@ -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])

View file

@ -1,6 +0,0 @@
include (Translations)
add_translations_directory(${GETTEXT_PACKAGE})
add_translations_catalog(${GETTEXT_PACKAGE}
../src/
../data
)

196
po/LINGUAS Normal file
View file

@ -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

9
po/POTFILES Normal file
View file

@ -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

6
po/meson.build Normal file
View file

@ -0,0 +1,6 @@
i18n.gettext(meson.project_name(),
args: [
'--directory=' + meson.source_root(),
'--from-code=UTF-8'
]
)

View file

@ -1,5 +0,0 @@
#
# GSettings Schema
#
include(GSettings)
add_schema(com.github.artemanufrij.webpin.gschema.xml)

4
schemas/meson.build Normal file
View file

@ -0,0 +1,4 @@
install_data(
meson.project_name() + '.gschema.xml',
install_dir: join_paths(get_option('datadir'), 'glib-2.0', 'schemas')
)

View file

@ -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})

13
src/meson.build Normal file
View file

@ -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'
)