Commit 05b3aee5 authored by Alexandru Băluț's avatar Alexandru Băluț

Get rid of the Makefile

Reviewed-by: Thibault Saunier's avatarThibault Saunier <tsaunier@gnome.org>
Differential Revision: https://phabricator.freedesktop.org/D1826
parent 5d505b3c
......@@ -227,7 +227,7 @@ class FlatpakRepos(FlatpakObject):
for name, tmprepo in self.repos.items():
if repo.url == tmprepo.url:
return tmprepo
elif repo.name == name:
if repo.name == name:
same_name = tmprepo
if same_name:
......@@ -446,7 +446,7 @@ class PitiviFlatpak: # pylint: disable=too-many-instance-attributes
self.update_all()
if self.devel:
self.setup_dev_env()
self.setup_sandbox()
if self.check:
self.run_in_sandbox("gst-validate-launcher",
......@@ -464,7 +464,7 @@ class PitiviFlatpak: # pylint: disable=too-many-instance-attributes
def update_bundle(self):
if not os.path.exists(self.prefix):
self.setup_dev_env()
self.setup_sandbox()
if not os.path.exists(self.repodir):
os.mkdir(self.repodir)
......@@ -501,7 +501,8 @@ class PitiviFlatpak: # pylint: disable=too-many-instance-attributes
except subprocess.CalledProcessError:
self.exit(1)
def setup_dev_env(self):
def setup_sandbox(self):
"""Creates the sandbox."""
if not os.path.exists(self.prefix) or self.update:
self.install_all()
Console.message("Building Pitivi %s and dependencies in %s",
......@@ -526,10 +527,13 @@ class PitiviFlatpak: # pylint: disable=too-many-instance-attributes
self.exit(1)
subprocess.check_call(builder_args, cwd=self.scriptdir)
configure_args = ["./configure", "--prefix=/app", "--libdir=lib"]
self.run_in_sandbox(*configure_args, exit_on_failure=True,
meson_args = ["meson", "mesonbuild/", "--prefix=/app",
"--libdir=lib", "-Ddisable_gtkdoc=true",
"-Ddisable_doc=true"]
self.run_in_sandbox(*meson_args, exit_on_failure=True,
cwd=self.topdir)
self.run_in_sandbox("make", exit_on_failure=True,
ninja_args = ["ninja", "-C", "mesonbuild/"]
self.run_in_sandbox(*ninja_args, exit_on_failure=True,
cwd=self.topdir)
else:
Console.message("Using Pitivi prefix in %s", self.prefix)
......
#!/usr/bin/env python3
"""Script for generating the Makefiles."""
import os
import sys
import shutil
import subprocess
PROJECTNAME = "Pitivi"
ROOTDIR = os.path.abspath(os.path.dirname(__file__))
MAKEFILE_TMPL = """all:
\tcd %(build_dir)s && %(ninja)s
install:
\tcd %(build_dir)s && DESTDIR="${DESTDIR}" %(ninja)s install
check:
\tcd %(build_dir)s && %(ninja)s test
validate:
\tcd %(build_dir)s && %(ninja)s validate
dist:
\tcd %(build_dir)s && %(ninja)s dist
clean:
\trm -Rf %(build_dir)s
\trm Makefile
"""
def accept_command(commands):
"""Checks if @command --version works."""
for command in commands:
try:
subprocess.check_output([command, "--version"])
return command
except FileNotFoundError:
pass
return None
def install_pre_commit_hook():
"""Installs the pre commit hook."""
os.chdir(ROOTDIR)
try:
os.remove(os.path.join(ROOTDIR, ".git", "pre-commit"))
except FileNotFoundError:
pass
os.symlink(os.path.join(os.path.pardir, os.path.pardir, "pre-commit.hook"),
os.path.join(ROOTDIR, ".git", "pre-commit"))
try:
subprocess.check_call(["pre-commit", "install"])
except (FileNotFoundError, subprocess.CalledProcessError):
print("Please install pre-commit from http://pre-commit.com/ before"
" proposing patches")
def configure_meson():
"""Configures meson and generate the Makefile."""
meson = accept_command(["meson", "meson.py"])
if not meson:
print("Install mesonbuild to build %s: http://mesonbuild.com/\n"
"You can simply install it with:\n"
" $ sudo pip3 install meson" % PROJECTNAME)
exit(1)
ninja = accept_command(["ninja", "ninja-build"])
if not ninja:
print("Install ninja-build to build %s: https://ninja-build.org/"
% PROJECTNAME)
exit(1)
build_dir = os.path.join(ROOTDIR, "mesonbuild")
shutil.rmtree(build_dir, True)
os.mkdir(build_dir)
os.chdir(build_dir)
try:
subprocess.check_call([meson, "../"] + sys.argv[1:])
except subprocess.CalledProcessError:
exit(1)
with open(os.path.join(ROOTDIR, "Makefile"), "w") as makefile:
makefile.write(MAKEFILE_TMPL %
{"build_dir": build_dir,
"ninja": ninja})
if __name__ == "__main__":
configure_meson()
if os.path.exists(os.path.join(ROOTDIR, ".git")):
install_pre_commit_hook()
......@@ -25,7 +25,6 @@ Most of the steps below should be done in the [development environment](HACKING.
3. Check your local repository:
* Make sure your sandbox is using the latest GStreamer release: `$ ptvenv --update --gst-version=<gst-version>`
* Check `$ git status` does not show any change
* Check `$ ptvenv ./configure` is all green
4. Make sure the tests pass:
```
......@@ -57,7 +56,7 @@ If there are new maintainers.
$ cd /tmp
$ asp checkout pitivi
$ cd /tmp/pitivi/repos/community-x86_64/
$ rm -rf .git # Without this, ./configure is confused re version number.
$ rm -rf .git # Required to get the version number correctly.
$ cp .../pitivi-X.YY.Z.tar.gz .
$ vim PKGBUILD
... Update "pkgver",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment