[pitivi] Port to meson



commit 3003b26a08e8878d30f67de158cb9253cdad8522
Author: Thibault Saunier <tsaunier gnome org>
Date:   Fri Jul 1 12:36:11 2016 -0400

    Port to meson
    
    Differential Revision: https://phabricator.freedesktop.org/D1153

 .gitignore                                         |   54 +------
 Makefile.am                                        |   49 ------
 autogen.sh                                         |   38 -----
 bin/Makefile.am                                    |    4 -
 bin/meson.build                                    |    9 +
 bin/pitivi-env                                     |    2 +-
 bin/pitivi.in                                      |    5 +-
 build/flatpak/pitivi-flatpak                       |    4 +-
 build/flatpak/pitivi.template.json                 |   20 +--
 configure                                          |   65 ++++++++
 configure.ac                                       |  160 -------------------
 data/Makefile.am                                   |   19 ---
 data/audiopresets/Makefile.am                      |    6 -
 data/gstpresets/Makefile.am                        |   10 --
 data/icons/16x16/Makefile.am                       |   10 --
 data/icons/22x22/Makefile.am                       |   10 --
 data/icons/24x24/Makefile.am                       |   10 --
 data/icons/256x256/Makefile.am                     |   10 --
 data/icons/32x32/Makefile.am                       |   10 --
 data/icons/48x48/Makefile.am                       |   10 --
 data/icons/512x512/Makefile.am                     |   10 --
 data/icons/Makefile.am                             |   13 --
 data/icons/meson.build                             |    6 +
 data/meson.build                                   |   22 +++
 data/pixmaps/Makefile.am                           |  168 --------------------
 .../{hicolor/24x24/actions => }/pitivi-align.svg   |    0
 .../{hicolor/24x24/actions => }/pitivi-gapless.svg |    0
 .../{hicolor/24x24/actions => }/pitivi-group.svg   |    0
 .../24x24/actions => }/pitivi-keyframe.svg         |    0
 .../{hicolor/24x24/actions => }/pitivi-relink.svg  |    0
 .../{hicolor/24x24/actions => }/pitivi-split.svg   |    0
 .../{hicolor/24x24/actions => }/pitivi-ungroup.svg |    0
 .../{hicolor/24x24/actions => }/pitivi-unlink.svg  |    0
 data/renderpresets/Makefile.am                     |   11 --
 data/ui/Makefile.am                                |   22 ---
 data/videopresets/Makefile.am                      |   11 --
 help/C/meson.build                                 |    7 +
 help/Makefile.am                                   |   60 -------
 help/cs/meson.build                                |   19 +++
 help/de/meson.build                                |   19 +++
 help/el/meson.build                                |   19 +++
 help/es/meson.build                                |   19 +++
 help/fr/meson.build                                |   19 +++
 help/meson.build                                   |   38 +++++
 help/sl/meson.build                                |   19 +++
 help/sv/meson.build                                |   19 +++
 help/uk/meson.build                                |   19 +++
 m4/as-ac-expand.m4                                 |   43 -----
 m4/python.m4                                       |   25 ---
 meson.build                                        |   57 +++++++
 meson_options.txt                                  |    2 +
 pitivi/Makefile.am                                 |   36 ----
 pitivi/coptimizations/Makefile.am                  |    8 -
 pitivi/dialogs/Makefile.am                         |   13 --
 pitivi/timeline/Makefile.am                        |   12 --
 pitivi/undo/Makefile.am                            |   11 --
 pitivi/utils/Makefile.am                           |   19 ---
 pitivi/viewer/Makefile.am                          |    9 -
 po/meson.build                                     |   14 ++
 pre-commit.hook                                    |    1 -
 tests/Makefile.am                                  |   49 ------
 tests/__init__.py                                  |   72 ++++++++-
 tests/meson.build                                  |   38 +++++
 tests/runtests.py                                  |   99 ------------
 64 files changed, 494 insertions(+), 1039 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index 5b1cf22..1db740b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -4,55 +4,17 @@
 # PyCharm
 .idea
 
-# Generated by autogen.sh
+# Generated by configure
+mesonbuild/
+
 Makefile
-Makefile.in
 bin/pitivi
-aclocal.m4
-autom4te.cache/
-autoregen.sh
-compile
-config.guess
-config.log
-config.status
-config.sub
-configure
 data/pitivi.desktop.in
-depcomp
-install-sh
-libtool
-ltmain.sh
-m4/libtool.m4
-m4/ltoptions.m4
-m4/ltsugar.m4
-m4/ltversion.m4
-m4/lt~obsolete.m4
-missing
 pitivi/configure.py
-pitivi/coptimizations/.deps/
-po/POTFILES
-po/stamp-it
-py-compile
 *__pycache__*
-
-# Generated by make
-*.la
-*.lo
-*.o
-data/pitivi.appdata.xml
-data/pitivi.desktop
-help/*/*.mo
-help/*/*.page
-# Don't ignore the English manual.
-!help/C/*.page
-help/*/*.stamp
-locale/
-pitivi/coptimizations/.libs/
-po/*.gmo
-po/.intltool-merge-cache
+subprojects/gst-transcoder/
 
 # Generated by make check
-po/pitivi.pot
 tests/samples/*.proxy.mkv
 
 # Generated by make html
@@ -62,13 +24,6 @@ help/index.cache
 # Generated when running the project
 *.pyc
 
-# libpitivi
-pitivi/libpitivi/.deps/*
-pitivi/libpitivi/.libs/*
-*.gir
-*.typelib
-prebuilt/
-
 # xdg-app/flatpak
 .bashrc
 build/flatpak/.flatpak-builder
@@ -76,4 +31,3 @@ build/flatpak/pitivi*.json
 build/xdg-app/.xdg-app-builder/
 build/xdg-app/pitivi-*.json
 build/devel/
-
diff --git a/bin/meson.build b/bin/meson.build
new file mode 100644
index 0000000..b7c163f
--- /dev/null
+++ b/bin/meson.build
@@ -0,0 +1,9 @@
+configure_file(input: 'pitivi.in',
+               output: 'pitivi',
+               configuration: cdata)
+
+pitivi_bin = '@0@/pitivi'.format(meson.current_build_dir())
+install_data(pitivi_bin, install_dir: get_option('bindir'))
+
+# FIXME Work around to be able to run uninstalled
+run_command('cp', pitivi_bin, meson.current_source_dir())
diff --git a/bin/pitivi-env b/bin/pitivi-env
index 04bd6f5..0777e11 100755
--- a/bin/pitivi-env
+++ b/bin/pitivi-env
@@ -16,7 +16,7 @@ export make="$FLATPAK_ENVPATH/pitivi/build/flatpak/pitivi-flatpak -b make"
 export check="$FLATPAK_ENVPATH/pitivi/build/flatpak/pitivi-flatpak -b make check"
 export minstall="$FLATPAK_ENVPATH/pitivi/build/flatpak/pitivi-flatpak -b make install"
 export autogen="$FLATPAK_ENVPATH/pitivi/build/flatpak/pitivi-flatpak -b ./autogen.sh --prefix=/app 
--disable-gtk-doc"
-export configure="$FLATPAK_ENVPATH/pitivi/build/flatpak/pitivi-flatpak -b ./configure --prefix=/app 
--disable-gtk-doc"
+export configure="$FLATPAK_ENVPATH/pitivi/build/flatpak/pitivi-flatpak -b ./configure --prefix=/app"
 
 alias make=$make
 alias check=$check
diff --git a/bin/pitivi.in b/bin/pitivi.in
old mode 100644
new mode 100755
index a46225b..ef510e6
--- a/bin/pitivi.in
+++ b/bin/pitivi.in
@@ -38,6 +38,7 @@ CONFIGURED_LD_LIBRARY_PATH = '@CONFIGURED_LD_LIBRARY_PATH@'
 CONFIGURED_GST_PLUGIN_PATH = '@CONFIGURED_GST_PLUGIN_PATH@'
 LIBDIR = '@LIBDIR@'
 DATADIR = '@DATADIR@'
+BUILDDIR = '@BUILDDIR@'
 
 
 def _prepend_env_path(name, value):
@@ -59,8 +60,8 @@ def _add_pitivi_path():
     dir = os.path.dirname(os.path.abspath(__file__))
     if _in_devel():
         root = os.path.split(dir)[0]
-        sys.path.append(os.path.join(root, "pitivi", "coptimizations", ".libs"))
-        localedir = os.path.join(os.path.split(dir)[0], 'locale')
+        sys.path.append(BUILDDIR)
+        localedir = os.path.join(BUILDDIR, 'po')
     else:
         root = os.path.join(LIBDIR, 'pitivi', 'python')
         localedir = os.path.join(DATADIR, "locale")
diff --git a/build/flatpak/pitivi-flatpak b/build/flatpak/pitivi-flatpak
index 25d635f..f8af79b 100755
--- a/build/flatpak/pitivi-flatpak
+++ b/build/flatpak/pitivi-flatpak
@@ -373,7 +373,7 @@ then
     if [ -z "$APP_INSTALLED" ] && [ -z "$USE_REMOTE" ]
     then
       cd $APPLICATION_REPOSITORY
-      $FLATPAK run --branch=$BRANCH -d --command="./autogen.sh" $APPLICATION_REF_NAME
+      $FLATPAK run --branch=$BRANCH -d --command="./configure" $APPLICATION_REF_NAME
       $FLATPAK run --branch=$BRANCH -d --command="make" $APPLICATION_REF_NAME
     fi
 
@@ -414,7 +414,7 @@ then
     if [ -z $BUNDLE ] || [ -n "$CHECK" ]
     then
       echo "-> Building $APPLICATION_NAME from current repository"
-      cd $APPLICATION_REPOSITORY && $FLATPAK build --env=PYTHON=python3 $PREFIX ./autogen.sh --prefix=/app 
|| exit 1
+      cd $APPLICATION_REPOSITORY && $FLATPAK build --env=PYTHON=python3 $PREFIX ./configure --prefix=/app 
--libdir=lib || exit 1
       $FLATPAK build --env=PYTHON=python3 $PREFIX make || exit 1
     fi
   fi
diff --git a/build/flatpak/pitivi.template.json b/build/flatpak/pitivi.template.json
index 3a7b5de..3df1f6d 100644
--- a/build/flatpak/pitivi.template.json
+++ b/build/flatpak/pitivi.template.json
@@ -219,7 +219,7 @@
             "build-options" : {
               "build-args": ["--share=network"]
             },
-            "config-opts": ["--module=meson==0.29"],
+            "config-opts": ["--module=meson==0.32"],
             "sources": [
                 {
                     "type": "file",
@@ -334,22 +334,10 @@
             ]
         },
         {
-            "name": "gst-transcoder",
-            "config-opts": ["--libdir=lib"],
-            "sources": [
-                {
-                    "type": "git",
-                    "url": "https://github.com/pitivi/gst-transcoder.git";
-                },
-                {
-                    "type": "file",
-                    "path": "gst-transcoder-configure",
-                    "dest-filename": "configure"
-                }
-            ]
-        },
-        {
             "name": "pitivi",
+            "build-options" : {
+              "build-args": ["--share=network"]
+            },
             "sources": [
                 {
                     "type": "git",
diff --git a/configure b/configure
new file mode 100755
index 0000000..fa984a2
--- /dev/null
+++ b/configure
@@ -0,0 +1,65 @@
+#!/bin/sh
+
+DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
+
+MESON=meson
+command -v $MESON > /dev/null 2>&1
+if [ $? != 0 ]
+then
+    MESON=meson.py
+    command -v $MESON > /dev/null 2>&1
+    if [ $? != 0 ]
+    then
+        echo "You should install mesonbuild to build Pitivi: http://mesonbuild.com/";
+        echo "You can simply install it with:"
+        echo "    $ sudo pip3 install meson"
+
+        exit 1
+    fi
+fi
+
+NINJA=ninja
+command -v $NINJA > /dev/null 2>&1
+if [ $? != 0 ]
+then
+    NINJA=ninja-build
+    command -v $NINJA > /dev/null 2>&1
+    if [ $? != 0 ]
+    then
+      echo "You should install ninja-build to build pitivi: https://ninja-build.org/";
+      exit 1
+    fi
+fi
+
+# install pre-commit hook for doing clean commits
+rm -f .git/hooks/pre-commit
+ln -s ../../pre-commit.hook .git/hooks/pre-commit
+echo ""
+which pre-commit > /dev/null
+if [ $? -eq 0  ]; then
+  pre-commit install
+else
+  echo "Please install pre-commit from http://pre-commit.com/ before proposing patches"
+  echo ""
+fi
+
+BUILDDIR=mesonbuild
+rm -Rf $BUILDDIR > /dev/null 2>&1
+mkdir $BUILDDIR/ && cd $BUILDDIR && $MESON ../ $@
+
+cat <<EOF > $DIR/Makefile
+all:
+       cd $BUILDDIR && $NINJA
+
+install:
+       cd $BUILDDIR && DESTDIR="\${DESTDIR}" $NINJA install
+
+check:
+       cd $BUILDDIR && $NINJA test
+
+clean:
+       rm -Rf $BUILDDIR
+       rm Makefile
+
+EOF
+
diff --git a/data/icons/meson.build b/data/icons/meson.build
new file mode 100644
index 0000000..c3b479e
--- /dev/null
+++ b/data/icons/meson.build
@@ -0,0 +1,6 @@
+sizes = ['16x16', '24x24', '32x32', '512x512', '22x22', '256x256', '48x48']
+themedir = get_option('datadir') + '/icons/hicolor/'
+
+foreach size: sizes
+    install_data(size + '/pitivi.png', install_dir: themedir + size + '/apps/')
+endforeach
diff --git a/data/meson.build b/data/meson.build
new file mode 100644
index 0000000..4a50211
--- /dev/null
+++ b/data/meson.build
@@ -0,0 +1,22 @@
+subdir('icons')
+
+install_subdir('pixmaps', install_dir: pkgdatadir)
+install_subdir('ui', install_dir: pkgdatadir)
+install_subdir('renderpresets', install_dir: pkgdatadir)
+install_subdir('audiopresets', install_dir: pkgdatadir)
+install_subdir('videopresets', install_dir: pkgdatadir)
+install_subdir('gstpresets', install_dir: pkgdatadir)
+
+custom_target('pitivi.desktop',
+    output : 'pitivi.desktop',
+    input : 'pitivi.desktop.in.in',
+    command : [intltool_merge, '--desktop-style', podir, '@INPUT@', '@OUTPUT@'],
+    install : true,
+    install_dir : get_option('datadir') + '/applications')
+
+custom_target('pitivi.appdata.xml',
+    output : 'pitivi.appdata.xml',
+    input : 'pitivi.appdata.xml.in',
+    command : [intltool_merge, '--desktop-style', podir, '@INPUT@', '@OUTPUT@'],
+    install : true,
+    install_dir : get_option('datadir') + '/appdata')
diff --git a/data/pixmaps/hicolor/24x24/actions/pitivi-align.svg b/data/pixmaps/pitivi-align.svg
similarity index 100%
rename from data/pixmaps/hicolor/24x24/actions/pitivi-align.svg
rename to data/pixmaps/pitivi-align.svg
diff --git a/data/pixmaps/hicolor/24x24/actions/pitivi-gapless.svg b/data/pixmaps/pitivi-gapless.svg
similarity index 100%
rename from data/pixmaps/hicolor/24x24/actions/pitivi-gapless.svg
rename to data/pixmaps/pitivi-gapless.svg
diff --git a/data/pixmaps/hicolor/24x24/actions/pitivi-group.svg b/data/pixmaps/pitivi-group.svg
similarity index 100%
rename from data/pixmaps/hicolor/24x24/actions/pitivi-group.svg
rename to data/pixmaps/pitivi-group.svg
diff --git a/data/pixmaps/hicolor/24x24/actions/pitivi-keyframe.svg b/data/pixmaps/pitivi-keyframe.svg
similarity index 100%
rename from data/pixmaps/hicolor/24x24/actions/pitivi-keyframe.svg
rename to data/pixmaps/pitivi-keyframe.svg
diff --git a/data/pixmaps/hicolor/24x24/actions/pitivi-relink.svg b/data/pixmaps/pitivi-relink.svg
similarity index 100%
rename from data/pixmaps/hicolor/24x24/actions/pitivi-relink.svg
rename to data/pixmaps/pitivi-relink.svg
diff --git a/data/pixmaps/hicolor/24x24/actions/pitivi-split.svg b/data/pixmaps/pitivi-split.svg
similarity index 100%
rename from data/pixmaps/hicolor/24x24/actions/pitivi-split.svg
rename to data/pixmaps/pitivi-split.svg
diff --git a/data/pixmaps/hicolor/24x24/actions/pitivi-ungroup.svg b/data/pixmaps/pitivi-ungroup.svg
similarity index 100%
rename from data/pixmaps/hicolor/24x24/actions/pitivi-ungroup.svg
rename to data/pixmaps/pitivi-ungroup.svg
diff --git a/data/pixmaps/hicolor/24x24/actions/pitivi-unlink.svg b/data/pixmaps/pitivi-unlink.svg
similarity index 100%
rename from data/pixmaps/hicolor/24x24/actions/pitivi-unlink.svg
rename to data/pixmaps/pitivi-unlink.svg
diff --git a/help/C/meson.build b/help/C/meson.build
new file mode 100644
index 0000000..a1c0731
--- /dev/null
+++ b/help/C/meson.build
@@ -0,0 +1,7 @@
+_help_installdir = get_option('datadir') + '/help/C/pitivi'
+install_subdir('figures', install_dir: _help_installdir)
+
+foreach help_page: help_pages
+    install_data(help_page, install_dir: _help_installdir)
+endforeach
+
diff --git a/help/cs/meson.build b/help/cs/meson.build
new file mode 100644
index 0000000..176fa97
--- /dev/null
+++ b/help/cs/meson.build
@@ -0,0 +1,19 @@
+lang = 'cs'
+
+_help_installdir = get_option('datadir') + '/help/' + lang + '/pitivi/'
+install_subdir('figures', install_dir: _help_installdir)
+
+mo = custom_target(lang + '.mo',
+    output : lang + '.mo',
+    input : lang + '.po',
+    command : [msgfmt, '@INPUT@', '--output-file', '@OUTPUT@'])
+
+foreach help_page: help_pages
+    custom_target(lang + '.' + help_page + '.page',
+        output : help_page,
+        input : '../C/' + help_page,
+        command : [itstool, '-m', mo,'@INPUT@', '--output', '@OUTPUT@'],
+        install: true,
+        install_dir: get_option('datadir') + '/help/' + lang + '/pitivi/')
+endforeach
+
diff --git a/help/de/meson.build b/help/de/meson.build
new file mode 100644
index 0000000..0be9e1c
--- /dev/null
+++ b/help/de/meson.build
@@ -0,0 +1,19 @@
+lang = 'de'
+
+_help_installdir = get_option('datadir') + '/help/' + lang + '/pitivi/'
+install_subdir('figures', install_dir: _help_installdir)
+
+mo = custom_target(lang + '.mo',
+    output : lang + '.mo',
+    input : lang + '.po',
+    command : [msgfmt, '@INPUT@', '--output-file', '@OUTPUT@'])
+
+foreach help_page: help_pages
+    custom_target(lang + '.' + help_page + '.page',
+        output : help_page,
+        input : '../C/' + help_page,
+        command : [itstool, '-m', mo,'@INPUT@', '--output', '@OUTPUT@'],
+        install: true,
+        install_dir: get_option('datadir') + '/help/' + lang + '/pitivi/')
+endforeach
+
diff --git a/help/el/meson.build b/help/el/meson.build
new file mode 100644
index 0000000..a7c5889
--- /dev/null
+++ b/help/el/meson.build
@@ -0,0 +1,19 @@
+lang = 'el'
+
+_help_installdir = get_option('datadir') + '/help/' + lang + '/pitivi/'
+install_subdir('figures', install_dir: _help_installdir)
+
+mo = custom_target(lang + '.mo',
+    output : lang + '.mo',
+    input : lang + '.po',
+    command : [msgfmt, '@INPUT@', '--output-file', '@OUTPUT@'])
+
+foreach help_page: help_pages
+    custom_target(lang + '.' + help_page + '.page',
+        output : help_page,
+        input : '../C/' + help_page,
+        command : [itstool, '-m', mo,'@INPUT@', '--output', '@OUTPUT@'],
+        install: true,
+        install_dir: get_option('datadir') + '/help/' + lang + '/pitivi/')
+endforeach
+
diff --git a/help/es/meson.build b/help/es/meson.build
new file mode 100644
index 0000000..3d6f498
--- /dev/null
+++ b/help/es/meson.build
@@ -0,0 +1,19 @@
+lang = 'es'
+
+_help_installdir = get_option('datadir') + '/help/' + lang + '/pitivi/'
+install_subdir('figures', install_dir: _help_installdir)
+
+mo = custom_target(lang + '.mo',
+    output : lang + '.mo',
+    input : lang + '.po',
+    command : [msgfmt, '@INPUT@', '--output-file', '@OUTPUT@'])
+
+foreach help_page: help_pages
+    custom_target(lang + '.' + help_page + '.page',
+        output : help_page,
+        input : '../C/' + help_page,
+        command : [itstool, '-m', mo,'@INPUT@', '--output', '@OUTPUT@'],
+        install: true,
+        install_dir: get_option('datadir') + '/help/' + lang + '/pitivi/')
+endforeach
+
diff --git a/help/fr/meson.build b/help/fr/meson.build
new file mode 100644
index 0000000..6c1ab01
--- /dev/null
+++ b/help/fr/meson.build
@@ -0,0 +1,19 @@
+lang = 'fr'
+
+_help_installdir = get_option('datadir') + '/help/' + lang + '/pitivi/'
+install_subdir('figures', install_dir: _help_installdir)
+
+mo = custom_target(lang + '.mo',
+    output : lang + '.mo',
+    input : lang + '.po',
+    command : [msgfmt, '@INPUT@', '--output-file', '@OUTPUT@'])
+
+foreach help_page: help_pages
+    custom_target(lang + '.' + help_page + '.page',
+        output : help_page,
+        input : '../C/' + help_page,
+        command : [itstool, '-m', mo,'@INPUT@', '--output', '@OUTPUT@'],
+        install: true,
+        install_dir: get_option('datadir') + '/help/' + lang + '/pitivi/')
+endforeach
+
diff --git a/help/meson.build b/help/meson.build
new file mode 100644
index 0000000..7bf7bce
--- /dev/null
+++ b/help/meson.build
@@ -0,0 +1,38 @@
+help_pages = [
+    'about.page',
+    'cheatsheet.page',
+    'codecscontainers.page',
+    'effects.page',
+    'gstreamer.page',
+    'importingmpegts.page',
+    'importing.page',
+    'index.page',
+    'keyframecurves.page',
+    'layers.page',
+    'license.page',
+    'mainwindow.page',
+    'medialibrary.page',
+    'movearoundtimeline.page',
+    'presets.page',
+    'rendering.page',
+    'savescreenshot.page',
+    'selectiongrouping.page',
+    'splitting.page',
+    'sysreq.page',
+    'transitions.page',
+    'trimming.page',
+    'usingclips.page',
+    'usingeffects.page',
+    'welcomedialog.page',
+    'workwithprojects.page'
+]
+
+subdir('C')
+subdir('cs')
+subdir('de')
+subdir('el')
+subdir('es')
+subdir('fr')
+subdir('sl')
+subdir('sv')
+subdir('uk')
diff --git a/help/sl/meson.build b/help/sl/meson.build
new file mode 100644
index 0000000..8924d59
--- /dev/null
+++ b/help/sl/meson.build
@@ -0,0 +1,19 @@
+lang = 'sl'
+
+_help_installdir = get_option('datadir') + '/help/' + lang + '/pitivi/'
+install_subdir('figures', install_dir: _help_installdir)
+
+mo = custom_target(lang + '.mo',
+    output : lang + '.mo',
+    input : lang + '.po',
+    command : [msgfmt, '@INPUT@', '--output-file', '@OUTPUT@'])
+
+foreach help_page: help_pages
+    custom_target(lang + '.' + help_page + '.page',
+        output : help_page,
+        input : '../C/' + help_page,
+        command : [itstool, '-m', mo,'@INPUT@', '--output', '@OUTPUT@'],
+        install: true,
+        install_dir: get_option('datadir') + '/help/' + lang + '/pitivi/')
+endforeach
+
diff --git a/help/sv/meson.build b/help/sv/meson.build
new file mode 100644
index 0000000..e66457c
--- /dev/null
+++ b/help/sv/meson.build
@@ -0,0 +1,19 @@
+lang = 'sv'
+
+_help_installdir = get_option('datadir') + '/help/' + lang + '/pitivi/'
+install_subdir('figures', install_dir: _help_installdir)
+
+mo = custom_target(lang + '.mo',
+    output : lang + '.mo',
+    input : lang + '.po',
+    command : [msgfmt, '@INPUT@', '--output-file', '@OUTPUT@'])
+
+foreach help_page: help_pages
+    custom_target(lang + '.' + help_page + '.page',
+        output : help_page,
+        input : '../C/' + help_page,
+        command : [itstool, '-m', mo,'@INPUT@', '--output', '@OUTPUT@'],
+        install: true,
+        install_dir: get_option('datadir') + '/help/' + lang + '/pitivi/')
+endforeach
+
diff --git a/help/uk/meson.build b/help/uk/meson.build
new file mode 100644
index 0000000..beda592
--- /dev/null
+++ b/help/uk/meson.build
@@ -0,0 +1,19 @@
+lang = 'uk'
+
+_help_installdir = get_option('datadir') + '/help/' + lang + '/pitivi/'
+install_subdir('figures', install_dir: _help_installdir)
+
+mo = custom_target(lang + '.mo',
+    output : lang + '.mo',
+    input : lang + '.po',
+    command : [msgfmt, '@INPUT@', '--output-file', '@OUTPUT@'])
+
+foreach help_page: help_pages
+    custom_target(lang + '.' + help_page + '.page',
+        output : help_page,
+        input : '../C/' + help_page,
+        command : [itstool, '-m', mo,'@INPUT@', '--output', '@OUTPUT@'],
+        install: true,
+        install_dir: get_option('datadir') + '/help/' + lang + '/pitivi/')
+endforeach
+
diff --git a/meson.build b/meson.build
new file mode 100644
index 0000000..c415e53
--- /dev/null
+++ b/meson.build
@@ -0,0 +1,57 @@
+project('pitivi', 'c', version: '0.96.0.1')
+
+python = find_program('python3', required : true)
+intltool_merge = find_program('intltool-merge', required : true)
+itstool = find_program('itstool', required : true)
+msgfmt = find_program('msgfmt', required : true)
+
+python_dep = dependency('python3', version : '>= 3.3')
+gst_dep = dependency('gstreamer-1.0', version : '>= 1.8.2')
+cairo_dep = dependency('cairo')
+pycairo_dep = dependency('py3cairo')
+
+pkgdatadir = get_option('datadir') + '/pitivi'
+
+GITVERSION = run_command('git', 'describe', '--always').stdout().strip()
+cdata = configuration_data()
+cdata.set('CONFIGURED_PYTHONPATH', '')
+cdata.set('CONFIGURED_GI_TYPELIB_PATH', '')
+cdata.set('CONFIGURED_LD_LIBRARY_PATH', '')
+cdata.set('CONFIGURED_GST_PLUGIN_PATH', '')
+cdata.set('LIBDIR', get_option('prefix') + '/' + get_option('libdir'))
+cdata.set('DATADIR', get_option('prefix') + '/' + get_option('datadir'))
+cdata.set('PACKAGE_NAME', 'Pitivi')
+cdata.set('PACKAGE', 'pitivi')
+cdata.set('GITVERSION', GITVERSION)
+cdata.set('VERSION', meson.project_version())
+cdata.set('BUILDDIR', meson.current_build_dir())
+
+coptimizations = shared_library('renderer',
+    'pitivi/coptimizations/renderer.c',
+    dependencies: [gst_dep, python_dep, pycairo_dep, cairo_dep],
+    name_prefix : '',
+    install: true,
+    install_dir: get_option('libdir') + '/pitivi/python/pitivi/timeline')
+
+pitivi_install_dir = get_option('libdir') + '/pitivi/python/'
+
+run_command(python, '-m', 'compileall', meson.current_source_dir() + '/pitivi')
+install_subdir('pitivi', install_dir: pitivi_install_dir)
+
+configure_file(input: 'pitivi/configure.py.in',
+               output: 'configure.py',
+               configuration: cdata)
+
+configure_file = '@0@/configure.py'.format(meson.current_build_dir())
+install_data(configure_file, install_dir: pitivi_install_dir + 'pitivi')
+
+# FIXME work around to get testsuite working
+run_command('cp', configure_file, meson.current_source_dir() + '/pitivi')
+
+subdir('bin')
+subdir('po')
+subdir('data')
+if not get_option('disable-help')
+    subdir('help')
+endif
+subdir('tests')
diff --git a/meson_options.txt b/meson_options.txt
new file mode 100644
index 0000000..51b34bd
--- /dev/null
+++ b/meson_options.txt
@@ -0,0 +1,2 @@
+option('enable-xunit', type : 'boolean', value : false)
+option('disable-help', type : 'boolean', value : false)
diff --git a/po/meson.build b/po/meson.build
new file mode 100644
index 0000000..9577a10
--- /dev/null
+++ b/po/meson.build
@@ -0,0 +1,14 @@
+langs = [
+    'ar', 'ast', 'bg', 'bs', 'ca', 'ca@valencia', 'cs',
+    'da', 'de', 'dz', 'el', 'en_GB', 'eo', 'es', 'et',
+    'eu', 'fi', 'fr', 'gl', 'gu', 'he', 'hu', 'it',
+    'ja', 'ko', 'ku', 'lt', 'lv', 'mr', 'nb', 'nds',
+    'nl', 'oc', 'pa', 'pl', 'pt_BR', 'pt', 'ro', 'ru',
+    'sk', 'sl', 'sr@latin', 'sr', 'sv', 'te', 'tr', 'uk',
+    'vi', 'zh_CN', 'zh_HK', 'zh_TW'
+]
+
+# Used for .desktop and .appdata translation
+podir = '@0@'.format(meson.current_source_dir())
+i18n = import('i18n')
+i18n.gettext('pitivi', languages : langs)
diff --git a/pre-commit.hook b/pre-commit.hook
index 5dcd46f..312d340 100755
--- a/pre-commit.hook
+++ b/pre-commit.hook
@@ -48,7 +48,6 @@ pitivi/viewer/overlay_stack.py
 pitivi/viewer/title_overlay.py
 pitivi/viewer/viewer.py
 tests/common.py
-tests/runtests.py
 tests/test_application.py
 tests/test_check.py
 tests/test_clipproperties.py
diff --git a/tests/__init__.py b/tests/__init__.py
index 1d6be27..a014377 100644
--- a/tests/__init__.py
+++ b/tests/__init__.py
@@ -1,4 +1,72 @@
 #!/usr/bin/env python3
-from . import runtests
-if not runtests.setup():
+"""
+Pitivi unit tests
+"""
+import glob
+import os
+import sys
+import unittest
+
+
+def get_pitivi_dir():
+    """Gets the pitivi root directory."""
+    tests_dir = os.path.dirname(os.path.abspath(__file__))
+    pitivi_dir = os.path.join(tests_dir, os.path.pardir)
+    return os.path.abspath(pitivi_dir)
+
+
+def get_build_dir():
+    """Gets the build directory."""
+    from pitivi.configure import in_devel
+    if in_devel():
+        # It's the same.
+        build_dir = get_pitivi_dir()
+    else:
+        # Probably running make distcheck. The path to the test files
+        # is different than the build path, so we must use the current
+        # dir which is build_path/tests.
+        build_dir = os.path.join(
+            os.path.abspath(os.path.curdir), os.path.pardir)
+    return os.path.abspath(build_dir)
+
+
+def _prepend_env_path(name, value):
+    """Prepends one or more paths to an environment variable."""
+    os.environ[name] = os.pathsep.join(value +
+                                       os.environ.get(name, "").split(
+                                           os.pathsep))
+
+
+def setup():
+    """Sets paths and initializes modules, to be able to run the tests."""
+    res = True
+    # Make available to configure.py the top level dir.
+    pitivi_dir = get_pitivi_dir()
+    sys.path.insert(0, pitivi_dir)
+
+    os.environ.setdefault('PITIVI_TOP_LEVEL_DIR', pitivi_dir)
+
+    _prepend_env_path("GST_PRESET_PATH", [
+        os.path.join(pitivi_dir, "data", "videopresets"),
+        os.path.join(pitivi_dir, "data", "audiopresets")])
+
+    _prepend_env_path("GST_ENCODING_TARGET_PATH", [
+        os.path.join(pitivi_dir, "data", "encoding-profiles")])
+
+    # Make available the compiled C code.
+    build_dir = get_build_dir()
+    libs_dir = os.path.join(build_dir, "pitivi/coptimizations/.libs")
+    sys.path.append(libs_dir)
+
+    # Make sure the modules are initialized correctly.
+    from pitivi import check
+    check.initialize_modules()
+    res = check.check_requirements()
+
+    from pitivi.utils import loggable as log
+    log.init('PITIVI_DEBUG')
+
+    return res
+
+if not setup():
     raise ImportError("Could not setup testsuite")
diff --git a/tests/meson.build b/tests/meson.build
new file mode 100644
index 0000000..6788144
--- /dev/null
+++ b/tests/meson.build
@@ -0,0 +1,38 @@
+runtests = find_program('nosetests')
+
+testdir = '@0@'.format(meson.current_source_dir())
+
+tests = [
+    ['Test application module', 'test_application.py'],
+    ['Test check module', 'test_check.py'],
+    ['Test clipproperties', 'test_clipproperties.py'],
+    ['Test common utilities', 'test_common.py'],
+    ['Test logging subsystem', 'test_log.py'],
+    ['Test the main window', 'test_mainwindow.py'],
+    ['Test the media library', 'test_media_library.py'],
+    ['Test the misc utilities', 'test_misc.py'],
+    ['Test the pipeline', 'test_pipeline.py'],
+    ['Test the preference dialog', 'test_prefs.py'],
+    ['Test presets', 'test_preset.py'],
+    ['Test the previewer', 'test_previewers.py'],
+    ['Test the project', 'test_project.py'],
+    ['Test system integration', 'test_system.py'],
+    ['Test graphical timeline elements', 'test_timeline_elements.py'],
+    ['Test graphical layers', 'test_timeline_layer.py'],
+    ['Test the graphical timeline', 'test_timeline_timeline.py'],
+    ['Test undo/redo for the project', 'test_undo_project.py'],
+    ['Test the undo subsystem', 'test_undo.py'],
+    ['Test undo/redo in the timeline', 'test_undo_timeline.py'],
+    ['Test utilities', 'test_utils.py'],
+    ['Test the timeline utilities', 'test_utils_timeline.py'],
+    ['Test our compound widget', 'test_widgets.py']
+]
+
+foreach i: tests
+    args = []
+    if get_option('enable-xunit')
+        args = ['--with-xunit', '--xunit-file=' + i.get(0).underscorify() + '.xunit']
+    endif
+
+    test(i.get(0), runtests, args: args + [testdir + '/' + i.get(1)])
+endforeach


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]