Skip to content

Commit

Permalink
Add Meson Build (#149)
Browse files Browse the repository at this point in the history
  • Loading branch information
danirabbit authored Oct 11, 2018
1 parent 4f1672f commit fd0ebe1
Show file tree
Hide file tree
Showing 23 changed files with 377 additions and 12 deletions.
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ services:
- docker

env:
- DEPENDENCY_PACKAGES="cmake libgala-dev libgee-0.8-dev libgirepository1.0-dev libglib2.0-dev libgranite-dev libgtk-3-dev valac"
- DEPENDENCY_PACKAGES="libgala-dev libgee-0.8-dev libgirepository1.0-dev libglib2.0-dev libgranite-dev libgtk-3-dev meson valac"

install:
- docker pull elementary/docker:juno-unstable
- docker run -v "$PWD":/tmp/build-dir elementary/docker:juno-unstable /bin/sh -c "apt-get update && apt-get -y install $DEPENDENCY_PACKAGES && cd /tmp/build-dir && cmake . && make"
- docker run -v "$PWD":/tmp/build-dir elementary/docker:juno-unstable /bin/sh -c "apt-get update && apt-get -y install $DEPENDENCY_PACKAGES && cd /tmp/build-dir && meson build --prefix=/usr && cd build && ninja"

script:
- echo BUILDS PASSED
25 changes: 15 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,22 @@ The extensible top panel for Pantheon. Wingpanel is an empty container that acce

## Building and Installation

It's recommended to create a clean build environment
You'll need the following dependencies:

mkdir build
cd build/

Run `cmake` to configure the build environment and then `make` to build
* libgee-0.8-dev
* libglib2.0-dev
* libgranite-dev
* libgtk-3-dev
* meson
* valac

cmake -DCMAKE_INSTALL_PREFIX=/usr ..
make

To install, use `make install`, then execute with `wingpanel`
Run `meson` to configure the build environment and then `ninja` to build

sudo make install
meson build --prefix=/usr
cd build
ninja

To install, use `ninja install` then execute with `wingpanel`

sudo ninja install
wingpanel
9 changes: 9 additions & 0 deletions data/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
install_data(
'wingpanel.desktop',
install_dir: join_paths(get_option('datadir'), 'applications')
)

install_data(
'wingpanel.svg',
install_dir: join_paths(get_option('datadir'), 'icons', 'hicolor', 'scalable', 'apps')
)
4 changes: 4 additions & 0 deletions lib/config.vapi
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[CCode (cprefix = "", lower_case_cprefix = "", cheader_filename = "config.h")]
namespace Build {
public const string INDICATORS_DIR;
}
59 changes: 59 additions & 0 deletions lib/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
config_vapi = meson.get_compiler('vala').find_library('config', dirs: meson.current_source_dir())

config_data = configuration_data()
config_data.set_quoted('INDICATORS_DIR', indicators_dir)

config_header = configure_file(
configuration: config_data,
output: 'config.h'
)

libwingpanel_deps = [
glib_dep,
gio_dep,
gio_unix_dep,
gmodule_dep,
gee_dep,
gtk_dep,
]

libwingpanel_lib = shared_library('wingpanel-2.0',
'Indicator.vala',
'IndicatorManager.vala',
'Widgets/AutomaticScrollBox.vala',
'Widgets/Button.vala',
'Widgets/Container.vala',
'Widgets/OverlayIcon.vala',
'Widgets/Separator.vala',
'Widgets/Switch.vala',
config_header,
dependencies: [libwingpanel_deps, config_vapi],
vala_header: 'wingpanel.h',
soversion: '0',
version: lib_version,
install: true,
install_dir: [true, join_paths(get_option('includedir'), 'wingpanel-2.0'), true]
)

pkg.generate(
filebase: 'wingpanel-2.0',
name: 'Wingpanel',
description: 'Wingpanel Indicators API',
version: meson.project_version(),
subdirs: 'wingpanel-2.0',
variables: ['indicators_dir=${libdir}/wingpanel'],
libraries: libwingpanel_lib,
requires: libwingpanel_deps
)

install_data(
'wingpanel-2.0.deps',
install_dir: join_paths(get_option('datadir'), 'vala', 'vapi')
)

libwingpanel_dir = include_directories('.')
libwingpanel_dep = declare_dependency(
link_with: libwingpanel_lib,
dependencies: [libwingpanel_deps, config_vapi],
include_directories: libwingpanel_dir
)
45 changes: 45 additions & 0 deletions meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
project(
'wingpanel',
'c', 'vala',
version: '2.2.0',
)

lib_version = '0.2.0'

add_project_arguments([
'--vapidir=' + join_paths(meson.source_root(), 'vapi'),
],
language: 'vala',
)

add_project_arguments([
'-DGETTEXT_PACKAGE="wingpanel"',
'-DG_LOG_DOMAIN="wingpanel"'
],
language: 'c'
)

indicators_dir = join_paths(get_option('prefix'), get_option('libdir'), 'wingpanel')

i18n = import('i18n')
pkg = import('pkgconfig')

glib_dep = dependency('glib-2.0', version: '>=2.32')
gio_dep = dependency('gio-2.0')
gio_unix_dep = dependency('gio-unix-2.0')
gmodule_dep = dependency('gmodule-2.0')
gtk_dep = dependency('gtk+-3.0', version: '>=3.10')
gee_dep = dependency('gee-0.8')
granite_dep = dependency('granite')

subdir('data')
subdir('lib')
subdir('schemas')
subdir('src')
subdir('wingpanel-interface')
if get_option('example')
subdir('sample')
endif
subdir('po')

meson.add_install_script('meson/post_install.py')
10 changes: 10 additions & 0 deletions meson/post_install.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/usr/bin/env python3

import os
import subprocess

schemadir = os.path.join(os.environ['MESON_INSTALL_PREFIX'], 'share', 'glib-2.0', 'schemas')

if not os.environ.get('DESTDIR'):
print('Compiling gsettings schemas...')
subprocess.call(['glib-compile-schemas', schemadir])
1 change: 1 addition & 0 deletions meson_options.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
option('example', type: 'boolean', value: false, description: 'Build an example that shows how it works')
69 changes: 69 additions & 0 deletions po/LINGUAS
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# please keep this list sorted alphabetically
#
af
ak
am
ar
az
be
bg
bs
ca
ckb
cs
da
de
el
en_CA
en_GB
eo
es
et
eu
fa
fi
fr
fr_CA
gl
he
hi
hr
hu
hy
id
it
ja
ka
ko
ku
ky
lb
lt
lv
ms
nb
nl
nn
pl
pt
pt_BR
ro
ru
si
sk
sl
sma
sq
sr
sr@latin
sv
ta
th
tr
ug
uk
ur
vi
zh_CN
zh_HK
zh_TW
20 changes: 20 additions & 0 deletions po/POTFILES
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
lib/Indicator.vala
lib/IndicatorManager.vala
lib/Widgets/AutomaticScrollBox.vala
lib/Widgets/Button.vala
lib/Widgets/Container.vala
lib/Widgets/OverlayIcon.vala
lib/Widgets/Separator.vala
lib/Widgets/Switch.vala
src/Wingpanelvala
src/PanelWindow.vala
src/Services/BackgroundManager.vala
src/Services/IndicatorSorter.vala
src/Services/PopoverManager.vala
src/Services/Settings.vala
src/Widgets/IndicatorEntry.vala
src/Widgets/IndicatorMenuBar.vala
src/Widgets/IndicatorPopover.vala
src/Widgets/MenuBar.vala
src/Widgets/Panel.vala
src/Widgets/StyleClass.vala
4 changes: 4 additions & 0 deletions po/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
i18n.gettext(meson.project_name(),
args: ['--directory='+meson.source_root()],
preset: 'glib',
)
6 changes: 6 additions & 0 deletions sample/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
shared_module('indicator-sample',
'SampleIndicator.vala',
dependencies: libwingpanel_dep,
install: true,
install_dir: indicators_dir
)
4 changes: 4 additions & 0 deletions schemas/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
install_data(
'io.elementary.desktop.wingpanel.gschema.xml',
install_dir: join_paths(get_option('datadir'), 'glib-2.0', 'schemas')
)
25 changes: 25 additions & 0 deletions src/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
wingpanel_files = files(
'Wingpanel.vala',
'PanelWindow.vala',
'Services/BackgroundManager.vala',
'Services/IndicatorSorter.vala',
'Services/PopoverManager.vala',
'Services/Settings.vala',
'Widgets/IndicatorEntry.vala',
'Widgets/IndicatorMenuBar.vala',
'Widgets/IndicatorPopover.vala',
'Widgets/MenuBar.vala',
'Widgets/Panel.vala',
'Widgets/StyleClass.vala',
)

wingpanel_deps = [
libwingpanel_dep,
granite_dep,
]

executable(meson.project_name(),
wingpanel_files,
dependencies: wingpanel_deps,
install: true
)
Empty file added vapi/mutter-cogl-pango-0.vapi
Empty file.
Empty file added vapi/mutter-cogl-pango-1.0.vapi
Empty file.
Empty file added vapi/mutter-cogl-pango-1.vapi
Empty file.
Empty file added vapi/mutter-cogl-pango-2.vapi
Empty file.
Empty file added vapi/mutter-cogl-path-0.vapi
Empty file.
Empty file added vapi/mutter-cogl-path-1.0.vapi
Empty file.
Empty file added vapi/mutter-cogl-path-1.vapi
Empty file.
Empty file added vapi/mutter-cogl-path-2.vapi
Empty file.
Loading

0 comments on commit fd0ebe1

Please sign in to comment.