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

feat: add meson support #21

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "submodules/cinnamon-desktop"]
path = submodules/cinnamon-desktop
url = https://github.com/linuxmint/cinnamon-desktop
14 changes: 12 additions & 2 deletions PKGBUILD
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ depends=(
)
makedepends=(
python-setuptools
meson-python
ninja
meson
git
)
optdepends=(
Expand All @@ -39,14 +42,21 @@ conflicts=(
)

source=(git+http://github.com/Fabric-Development/$reponame.git)

sha256sums=("SKIP")

prepare() {
cd "$srcdir/$reponame"
git submodule update --init
}

build() {
cd "$srcdir/$reponame"
python setup.py build
meson --prefix=/usr build
ninja -C build
}

package() {
cd "$srcdir/$reponame"
python setup.py install --root="$pkgdir/" --optimize=1
DESTDIR="$pkgdir" meson install -C build
}
37 changes: 37 additions & 0 deletions meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
project('fabric', 'c', version: '0.0.1')

if build_machine.system() == 'windows'
error('fabric is not meant for windows users, consider moving to linux.')
endif

pymod = import('python')
python = pymod.find_installation(
'python3',
modules: [
'gi',
'cairo',
'loguru',
'click',
],
)

if python.language_version().version_compare('<3.8')
error('at least Python 3.8 is required, Python 3.11 is recommended though.')
endif

dependency('cairo')
dependency('gtk+-3.0')
dependency('py3cairo')
dependency('pygobject-3.0')
dependency('cairo-gobject')
dependency('gtk-layer-shell-0')
dependency('gobject-introspection-1.0')

patch = find_program('patch', required: true)
run_command(patch, 'submodules/cinnamon-desktop/libcvc/meson.build', 'submodules/libcvc.patch')

install_subdir(
meson.project_name(),
install_dir: python.get_install_dir()
)
subdir('submodules/cinnamon-desktop/libcvc')
3 changes: 2 additions & 1 deletion scripts/install_libcvc/install_libcvc.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
# !/usr/bin/env bash

# a script to install libcvc manually

cinnamon_git="https://github.com/linuxmint/cinnamon-desktop"
cinnamon_git_name="cinnamon-desktop"
cwd="$(pwd)"

pre_check_exists() {
# check if Cvc typelibs are installed
echo "checking if libcvc is already installed..."
if ls /usr/lib/girepository-1.0/Cvc-1.0.typelib 1> /dev/null 2>&1;
then
Expand Down
1 change: 1 addition & 0 deletions submodules/cinnamon-desktop
Submodule cinnamon-desktop added at b554c4
41 changes: 41 additions & 0 deletions submodules/libcvc.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
0a1,36
> use_alsa = false
> conf = configuration_data()
> systemd = dependency('libsystemd', required: false)
> pkgconfig = import('pkgconfig')
> gnome = import('gnome')
> cc = meson.get_compiler('c')
>
> timerfd_check = cc.compiles('''
> #include <sys/timerfd.h>
> #include <unistd.h>
> int main () {
> timerfd_create (CLOCK_MONOTONIC, TFD_CLOEXEC);
> return 0;
> }
> ''')
>
> gettext_package = meson.project_name()
> conf.set_quoted('GETTEXT_PACKAGE', gettext_package)
> conf.set_quoted('GNOMELOCALEDIR', join_paths(get_option('prefix'), get_option('localedir')))
> conf.set_quoted('PACKAGE_VERSION', meson.project_version())
>
> conf.set('HAVE_BIND_TEXTDOMAIN_CODESET', cc.has_function('bind_textdomain_codeset'))
> conf.set('datadir', get_option('datadir'))
> conf.set('ENABLE_NLS', cc.has_header('libintl.h'))
> conf.set('HAVE_ALSA', use_alsa)
> conf.set('HAVE_GETTEXT', true)
> conf.set('HAVE_INTROSPECTION', true)
> conf.set('HAVE_SYSTEMD', systemd.found())
> conf.set('HAVE_TIMERFD', timerfd_check)
>
> configure_file(
> output: 'config.h',
> configuration: conf
> )
>
>
52c88
< include_directories: rootInclude,
---
> include_directories: include_directories('.'),