flatpak: Coding style.

- Use a script to reduce repetion in build commands.
This commit is contained in:
Andrew Hamilton 2019-08-09 14:44:18 +10:00
parent 7955d9654c
commit bf3fd5c63b

View file

@ -78,13 +78,15 @@ def make_haskell_module(package, deps):
revision_path = dep.rsplit("-", maxsplit=1)[0] + ".cabal" revision_path = dep.rsplit("-", maxsplit=1)[0] + ".cabal"
sources.append({"type": "file", "url": last_url, "sha256": sha256, sources.append({"type": "file", "url": last_url, "sha256": sha256,
"dest": dep, "dest-filename": revision_path}) "dest": dep, "dest-filename": revision_path})
commands.extend([ commands.append(f"./install-package {dep}")
f"cd {dep}; ghc -threaded --make Setup",
f"cd {dep}; ./Setup configure --disable-optimization --prefix=/app",
f"cd {dep}; ./Setup build",
f"cd {dep}; ./Setup install"])
for dep in reversed(deps): for dep in reversed(deps):
commands.append(f"cd {dep}; ./Setup unregister") commands.append(f"cd {dep}; ./Setup unregister")
sources.append({
"type": "script",
"commands": ["set -x", "cd $1", "ghc -threaded --make Setup",
"./Setup configure --disable-optimization --prefix=/app",
"./Setup build", "./Setup install"],
"dest-filename": "install-package"})
return {"name": f"haskell-{package}", "buildsystem": "simple", return {"name": f"haskell-{package}", "buildsystem": "simple",
"build-commands": commands, "builddir": True, "sources": sources, "build-commands": commands, "builddir": True, "sources": sources,
"cleanup": ["/lib/x86_64-linux-ghc-*"]} "cleanup": ["/lib/x86_64-linux-ghc-*"]}