Add build script and instructions for fedora

This commit is contained in:
Micah Lee 2020-02-21 16:04:11 -08:00
parent d8e17cb898
commit 45f78637af
No known key found for this signature in database
GPG key ID: 403C2657CD994F73
3 changed files with 73 additions and 1 deletions

View file

@ -27,6 +27,26 @@ Create a .deb:
./install/linux/build_deb.py
```
## Fedora
Install dependencies:
```sh
sudo dnf install -y rpm-build python3 python3-qt5 python3-appdirs python3-click
```
Run from source tree:
```sh
./dev_script/dangerzone
```
Create a .rpm:
```sh
./install/linux/build_rpm.py
```
## macOS
Install Xcode from the Mac App Store. Once it's installed, run it for the first time to set it up. Also, run this to make sure command line tools are installed: `xcode-select --install`. And finally, open Xcode, go to Preferences > Locations, and make sure under Command Line Tools you select an installed version from the dropdown. (This is required for installing Qt5.)

View file

@ -68,7 +68,7 @@ class Common(object):
# If this is fedora-like, use podman
if os.path.exists("/usr/bin/dnf"):
self.container_runtime = "podman"
self.container_runtime = "/usr/bin/podman"
# Otherwise, use docker
else:
self.container_runtime = "/usr/bin/docker"

52
install/linux/build_rpm.py Executable file
View file

@ -0,0 +1,52 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import os
import sys
import inspect
import subprocess
import shutil
sys.path.insert(
0, os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
)
import dangerzone
version = dangerzone.dangerzone_version
root = os.path.dirname(
os.path.dirname(
os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))
)
)
def run(cmd):
subprocess.run(cmd, cwd=root, check=True)
def main():
build_path = os.path.join(root, "build")
dist_path = os.path.join(root, "dist")
print("* Deleting old build and dist")
if os.path.exists(build_path):
shutil.rmtree(build_path)
if os.path.exists(dist_path):
shutil.rmtree(dist_path)
print("* Building RPM package")
run(
[
"python3",
"setup.py",
"bdist_rpm",
"--requires=python3-qt5,python3-appdirs,python3-click",
]
)
print("")
print("* To install run:")
print("sudo dnf install dist/dangerzone-{}-1.noarch.rpm".format(version))
if __name__ == "__main__":
main()