Skip to content

Commit

Permalink
Merge pull request #145 from afelinczak/add_meson_support
Browse files Browse the repository at this point in the history
Added meson supported
  • Loading branch information
afelinczak authored Jul 1, 2020
2 parents 0cd84e4 + db9fc81 commit e1df05e
Show file tree
Hide file tree
Showing 4 changed files with 144 additions and 8 deletions.
33 changes: 26 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,34 @@ How to compile and install clipit
#### Requirements:
* gtk+ >= 2.10.0 (>= 3.0 for gtk+3)
* xdotool - for automatic paste functionality
* intltool

#### Download the clipit source code, then:
$ tar zxvf clipit-x.y.z.tar.gz
$ cd clipit-x.y.z
$ ./autogen.sh
$ ./configure
$ make
$ sudo make install
#### On Ubuntu:
sudo apt-get install build-essential git automake xdotool autoconf intltool autopoint gtk+-3.0

#### Download the clipit source code, then:
```
tar zxvf clipit-x.y.z.tar.gz
cd clipit-x.y.z
./autogen.sh
./configure
make
sudo make install
```

#### Build using meson:
```
meson build -Dwith-gtk3=true
cd build
ninja
sudo ninja install
```

#### PPA builds
```
sudo add-apt-repository ppa:afelinczak/ppa
```

Documentation
===============================================================================

Expand Down
115 changes: 115 additions & 0 deletions meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
project('clipit', 'c', version : '1.4.5', license: 'GPL-3+')
package = meson.project_name()
sources = [
'src/daemon.c',
'src/eggaccelerators.c',
'src/history.c',
'src/keybinder.c',
'src/main.c',
'src/manage.c',
'src/preferences.c',
'src/utils.c'
]

#meson configure -Doption=newvalue
if get_option('with-gtk3')
gtk = 'gtk+-3.0'
app_ind = 'ayatana-appindicator3-0.1'
else
gtk = 'gtk+-2.0'
app_ind = 'ayatana-appindicator-0.1'
endif

dependencies = [
dependency('glib-2.0'),
dependency('x11'),
dependency(gtk),
dependency(app_ind)
]

conf = configuration_data()

if get_option('enable-appindicator')
conf.set('HAVE_APPINDICATOR', 1)
else
conf.set('HAVE_APPINDICATOR', 0)
endif

conf.set('ENABLE_NLS', 1)
conf.set_quoted('GETTEXT_PACKAGE', package)
conf.set('HAVE_BIND_TEXTDOMAIN_CODESET', 1)
conf.set('HAVE_DCGETTEXT', 1)
conf.set('HAVE_GETTEXT', 1)
conf.set('HAVE_INTTYPES_H', 1)
conf.set('HAVE_LC_MESSAGES', 1)
conf.set('HAVE_LOCALE_H', 1)
conf.set('HAVE_MEMORY_H', 1)
conf.set('HAVE_STDINT_H', 1)
conf.set('HAVE_STDLIB_H', 1)
conf.set('HAVE_STRINGS_H', 1)
conf.set('HAVE_STRING_H', 1)
conf.set('HAVE_SYS_STAT_H', 1)
conf.set('HAVE_SYS_TYPES_H', 1)
conf.set('HAVE_UNISTD_H', 1)
conf.set_quoted('PACKAGE', package)
conf.set_quoted('PACKAGE_BUGREPORT', '[email protected]')
conf.set_quoted('PACKAGE_NAME', package)
conf.set_quoted('PACKAGE_STRING', package + ' ' + meson.project_version())
conf.set_quoted('PACKAGE_TARNAME', package)
conf.set_quoted('PACKAGE_URL', '')
conf.set_quoted('PACKAGE_VERSION', meson.project_version())
conf.set('STDC_HEADERS', 'void')
conf.set('STDC_HEADERS', 1)
conf.set_quoted('VERSION', meson.project_version())

configure_file(output : 'config.h', configuration : conf)

i18n = import('i18n')
add_project_arguments('-DGETTEXT_PACKAGE="@0@"'.format(package), language:'c')
subdir('po')

# To be used later: migrate from intltools
# remove _
# https://stackoverflow.com/questions/62504873/i18n-merge-file-cant-translate-desktop-file
#
#i18n.merge_file(
# input: 'data/clipit.desktop.in',
# output: 'clipit.desktop',
# type: 'desktop',
# po_dir: join_paths(meson.source_root(), 'po'),
# install: true,
# install_dir: '/usr/share/applications'
#)

#i18n.merge_file(
# input: 'data/clipit-startup.desktop.in',
# output: 'clipit-startup.desktop',
# type: 'desktop',
# po_dir: join_paths(meson.source_root(), 'po'),
# install: true,
# install_dir: '/etc/xdg/autostart'
#)

intltool_merge = find_program('intltool-merge')

custom_target('clipit-startup.desktop',
input : 'data/clipit-startup.desktop.in',
output : 'clipit-startup.desktop',
command: [intltool_merge, '-d', '-u', join_paths(meson.source_root(), 'po'), '@INPUT@', '@OUTPUT@'],
install : true,
install_dir : '/etc/xdg/autostart')

custom_target('clipit.desktop',
input : 'data/clipit.desktop.in',
output : 'clipit.desktop',
command: [intltool_merge, '-d', '-u', join_paths(meson.source_root(), 'po'), '@INPUT@', '@OUTPUT@'],
install : true,
install_dir : get_option('datadir') / 'applications')


install_subdir('debian/icons', install_dir: get_option('datadir'))
install_data('data/clipit-trayicon.svg', install_dir: join_paths(get_option('datadir'), 'icons/hicolor/scalable/apps/'))
install_data('data/clipit-trayicon-offline.svg', install_dir: join_paths(get_option('datadir'), 'icons/hicolor/scalable/apps/'))
install_man('doc/clipit.1')

executable(package, sources, install : true, dependencies: dependencies)
2 changes: 2 additions & 0 deletions meson_options.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
option('with-gtk3', type : 'boolean', value : true)
option('enable-appindicator', type : 'boolean', value : false)
2 changes: 1 addition & 1 deletion src/main.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
G_BEGIN_DECLS

#define ACTIONS_TAB 2
#define POPUP_DELAY 100
#define POPUP_DELAY 250

#if GTK_MAJOR_VERSION == 3
#define GTK_DIALOG_NO_SEPARATOR 0
Expand Down

0 comments on commit e1df05e

Please sign in to comment.