mirror of
				https://github.com/Rafostar/clapper.git
				synced 2025-10-31 18:35:38 +01:00 
			
		
		
		
	Add meson build system (#1)
Initial meson build system support. We do not create .desktop file yet, but we need an option to open media files from GUI first anyway.
This commit is contained in:
		
							
								
								
									
										4
									
								
								.gitignore
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										4
									
								
								.gitignore
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,4 @@ | ||||
| # meson/ninja | ||||
| build/ | ||||
| install/ | ||||
| builddir/ | ||||
| @@ -4,8 +4,9 @@ A GNOME media player built using [GJS](https://gitlab.gnome.org/GNOME/gjs) and p | ||||
| ### WORK IN PROGRESS | ||||
| This is still early WIP. Many features are not implemented yet and quite a few are still unstable. Right now Clapper can only play single file. So if you want to test it, start it from terminal like this: | ||||
| ```shell | ||||
| clapper video.mp4 | ||||
| com.github.rafostar.Clapper "video.mp4" | ||||
| ``` | ||||
|  | ||||
| ## Requirements | ||||
| Clapper uses `GStreamer` bindings from `GI` repository, so if your repo ships them as separate package, they must be installed first. | ||||
| Additionally Clapper requires these `GStreamer` elements: | ||||
| @@ -16,10 +17,10 @@ Other required plugins (codecs) depend on video format. | ||||
|  | ||||
| ## Installation | ||||
| Run in terminal: | ||||
| ```sh | ||||
| sudo ./install.sh | ||||
| ```shell | ||||
| meson builddir --prefix=/usr/local | ||||
| sudo meson install -C builddir | ||||
| ``` | ||||
| I know that this should be done using some sort of build system (like `meson`), but the player is still far from finished and a basic install script should be sufficient for the time being, if anyone wishes to test it. | ||||
|  | ||||
| ## Hardware acceleration | ||||
| Using hardware acceleration is highly recommended. As stated in `GStreamer` wiki: | ||||
|   | ||||
							
								
								
									
										12
									
								
								bin/clapper
									
									
									
									
									
								
							
							
						
						
									
										12
									
								
								bin/clapper
									
									
									
									
									
								
							| @@ -1,12 +0,0 @@ | ||||
| #!/usr/bin/gjs | ||||
|  | ||||
| const Package = imports.package; | ||||
|  | ||||
| Package.init({ | ||||
|   name: "clapper", | ||||
|   version: "0.0.0", | ||||
|   prefix: "/usr/local", | ||||
|   libdir: "/usr/local/lib", | ||||
|   datadir: "/usr/local/share", | ||||
| }); | ||||
| Package.run(imports.main); | ||||
							
								
								
									
										12
									
								
								bin/com.github.rafostar.Clapper.in
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										12
									
								
								bin/com.github.rafostar.Clapper.in
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,12 @@ | ||||
| #!@GJS@ | ||||
|  | ||||
| const Package = imports.package; | ||||
|  | ||||
| Package.init({ | ||||
|   name: '@PACKAGE_NAME@', | ||||
|   version: '@PACKAGE_VERSION@', | ||||
|   prefix: '@prefix@', | ||||
|   libdir: '@libdir@', | ||||
|   datadir: '@datadir@', | ||||
| }); | ||||
| Package.run(imports.main); | ||||
							
								
								
									
										16
									
								
								bin/meson.build
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										16
									
								
								bin/meson.build
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,16 @@ | ||||
| bin_conf = configuration_data() | ||||
| bin_conf.set('GJS', find_program('gjs').path()) | ||||
| bin_conf.set('PACKAGE_VERSION', meson.project_version()) | ||||
| bin_conf.set('PACKAGE_NAME', meson.project_name()) | ||||
| bin_conf.set('prefix', get_option('prefix')) | ||||
| bin_conf.set('libdir', join_paths(get_option('prefix'), get_option('libdir'))) | ||||
| bin_conf.set('datadir', join_paths(get_option('prefix'), get_option('datadir'))) | ||||
|  | ||||
| configure_file( | ||||
|   input: 'com.github.rafostar.Clapper.in', | ||||
|   output: 'com.github.rafostar.Clapper', | ||||
|   configuration: bin_conf, | ||||
|   install: true, | ||||
|   install_dir: get_option('bindir'), | ||||
|   install_mode: 'rwxr-xr-x' | ||||
| ) | ||||
							
								
								
									
										22
									
								
								build-aux/meson/postinstall.py
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										22
									
								
								build-aux/meson/postinstall.py
									
									
									
									
									
										Executable file
									
								
							| @@ -0,0 +1,22 @@ | ||||
| #!/usr/bin/env python3 | ||||
|  | ||||
| from os import environ, path | ||||
| from subprocess import call | ||||
|  | ||||
| prefix = environ.get('MESON_INSTALL_PREFIX', '/usr/local') | ||||
| datadir = path.join(prefix, 'share') | ||||
| destdir = environ.get('DESTDIR', '') | ||||
|  | ||||
| # Package managers set this so we don't need to run | ||||
| #if not destdir: | ||||
|     # NO CLAPPER ICON YET | ||||
|     #print('Updating icon cache...') | ||||
|     #call(['gtk-update-icon-cache', '-qtf', path.join(datadir, 'icons', 'hicolor')]) | ||||
|  | ||||
|     # NO CLAPPER DESKTOP FILES YET | ||||
|     #print('Updating desktop database...') | ||||
|     #call(['update-desktop-database', '-q', path.join(datadir, 'applications')]) | ||||
|  | ||||
|     # NO CLAPPER SCHEMAS YET | ||||
|     #print('Compiling GSettings schemas...') | ||||
|     #call(['glib-compile-schemas', path.join(datadir, 'glib-2.0', 'schemas')]) | ||||
| @@ -4,8 +4,9 @@ const { Interface } = imports.clapper_src.interface; | ||||
| const { Player } = imports.clapper_src.player; | ||||
| const { Window } = imports.clapper_src.window; | ||||
|  | ||||
| const APP_NAME = 'Clapper'; | ||||
| const APP_ID = `com.github.rafostar.${APP_NAME}`; | ||||
| const APP_NAME = pkg.name.substring( | ||||
|     pkg.name.lastIndexOf('.') + 1 | ||||
| ); | ||||
|  | ||||
| let { debug } = Debug; | ||||
|  | ||||
| @@ -22,7 +23,7 @@ var App = GObject.registerClass({ | ||||
|         GLib.set_prgname(APP_NAME); | ||||
|  | ||||
|         super._init({ | ||||
|             application_id: APP_ID | ||||
|             application_id: pkg.name | ||||
|         }); | ||||
|  | ||||
|         let defaults = { | ||||
|   | ||||
| @@ -1,6 +1,6 @@ | ||||
| imports.gi.versions.Gdk = '3.0'; | ||||
| imports.gi.versions.Gtk = '3.0'; | ||||
| imports.searchPath.unshift('/usr/local/share/clapper'); | ||||
| imports.searchPath.unshift('@importspath@'); | ||||
| 
 | ||||
| const ClapperSrc = imports.clapper_src; | ||||
| 
 | ||||
							
								
								
									
										14
									
								
								gjs-1.0/meson.build
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										14
									
								
								gjs-1.0/meson.build
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,14 @@ | ||||
| sharedir = join_paths(get_option('prefix'), 'share') | ||||
| gjsdir = join_paths(sharedir, 'gjs-1.0') | ||||
| importspath = join_paths(sharedir, meson.project_name()) | ||||
|  | ||||
| gjs_conf = configuration_data() | ||||
| gjs_conf.set('importspath', importspath) | ||||
|  | ||||
| configure_file( | ||||
|   input: 'clapper.js.in', | ||||
|   output: 'clapper.js', | ||||
|   configuration: gjs_conf, | ||||
|   install: true, | ||||
|   install_dir: gjsdir | ||||
| ) | ||||
							
								
								
									
										38
									
								
								install.sh
									
									
									
									
									
								
							
							
						
						
									
										38
									
								
								install.sh
									
									
									
									
									
								
							| @@ -1,38 +0,0 @@ | ||||
| #!/bin/sh | ||||
|  | ||||
| LICENSES_DIR="/usr/local/share/licenses/clapper" | ||||
| DOC_DIR="/usr/local/share/doc/clapper" | ||||
| MAIN_DIR="/usr/local/share/clapper" | ||||
| BIN_DIR="/usr/local/bin" | ||||
| GJS_DIR="/usr/local/share/gjs-1.0" | ||||
|  | ||||
| SCRIPT_ERR="Error: this script must be" | ||||
|  | ||||
| if [ ! -d "./clapper_src" ]; then | ||||
|     echo "$SCRIPT_ERR run from clapper directory!" 1>&2 | ||||
|     exit 1 | ||||
| elif [ "$EUID" -ne 0 ]; then | ||||
|     echo "$SCRIPT_ERR run as root!" 1>&2 | ||||
|     exit 1 | ||||
| fi | ||||
|  | ||||
| echo "Creating directories..." | ||||
| mkdir -p "$LICENSES_DIR" | ||||
| mkdir -p "$DOC_DIR" | ||||
| mkdir -p "$MAIN_DIR" | ||||
| mkdir -p "$GJS_DIR" | ||||
| mkdir -p "$BIN_DIR" | ||||
|  | ||||
| echo "Copying files..." | ||||
| cp -f "./COPYING" "$LICENSES_DIR/" | ||||
| cp -f "./README.md" "$DOC_DIR/" | ||||
| cp -rf "./clapper_src" "$MAIN_DIR/" | ||||
| cp -rf "./css" "$MAIN_DIR/" | ||||
| cp -f "./main.js" "$MAIN_DIR/" | ||||
| cp -f "./gjs-1.0/clapper.js" "$GJS_DIR/" | ||||
| cp -f "./bin/clapper" "$BIN_DIR/" | ||||
|  | ||||
| echo "Creating executables..." | ||||
| chmod +x "$BIN_DIR/clapper" | ||||
|  | ||||
| echo "Install finished" | ||||
							
								
								
									
										26
									
								
								meson.build
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										26
									
								
								meson.build
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,26 @@ | ||||
| project('com.github.rafostar.Clapper', | ||||
|   version: '0.0.0', | ||||
|   meson_version: '>= 0.47.0', | ||||
|   license: 'GPL3', | ||||
|   default_options: [ 'warning_level=2' ] | ||||
| ) | ||||
|  | ||||
| python = import('python3') | ||||
| python_bin = python.find_python() | ||||
|  | ||||
| if not python_bin.found() | ||||
|     error('No valid python3 binary found') | ||||
| endif | ||||
|  | ||||
| conf = configuration_data() | ||||
| conf.set('bindir', join_paths(get_option('prefix'), 'bin')) | ||||
|  | ||||
| subdir('bin') | ||||
| subdir('gjs-1.0') | ||||
|  | ||||
| installdir = join_paths(get_option('prefix'), 'share', meson.project_name()) | ||||
| install_subdir('clapper_src', install_dir : installdir) | ||||
| install_subdir('css', install_dir : installdir) | ||||
| install_data('main.js', install_dir : installdir) | ||||
|  | ||||
| meson.add_install_script('build-aux/meson/postinstall.py') | ||||
		Reference in New Issue
	
	Block a user