Skip to content

Commit

Permalink
fix flatpak cuda_llvm missing (HandBrake#4580)
Browse files Browse the repository at this point in the history
  • Loading branch information
gedoensmax authored Sep 29, 2022
1 parent 947d39f commit 8bde0be
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 8 deletions.
4 changes: 4 additions & 0 deletions pkg/linux/module.defs
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,10 @@ ifeq (1,$(FEATURE.qsv))
FPQSV = -q
endif

ifeq (1,$(FEATURE.nvenc))
FPNVENC = -e
endif

ifneq ($(FP_RUNTIME),)
FPRUNTIME = -r $(FP_RUNTIME)
endif
Expand Down
8 changes: 4 additions & 4 deletions pkg/linux/module.rules
Original file line number Diff line number Diff line change
Expand Up @@ -67,25 +67,25 @@ $(PKG.rpm.stamp): $(PKG.native.rpm.stamp)
#
$(PKG.gui.manifest.flathub):
$(MKDIR.exe) -p $(PKG.out.flatpak/)
$(SRC/)scripts/create_flatpak_manifest.py $(FPQSV) -a "$(HB_URL)" -s "$(HB_SHA256)" -t $(PKG.gui.template.flatpak) $(foreach m,$(CONTRIBS),-c "$(word 1,$($m.FETCH.url))" -s "$(word 1,$($m.FETCH.sha256))") $(FPRUNTIME) $(PKG.gui.manifest.flathub)
$(SRC/)scripts/create_flatpak_manifest.py $(FPQSV) $(FPNVENC) -a "$(HB_URL)" -s "$(HB_SHA256)" -t $(PKG.gui.template.flatpak) $(foreach m,$(CONTRIBS),-c "$(word 1,$($m.FETCH.url))" -s "$(word 1,$($m.FETCH.sha256))") $(FPRUNTIME) $(PKG.gui.manifest.flathub)

$(PKG.cli.manifest.flathub):
$(MKDIR.exe) -p $(PKG.out.flatpak/)
$(SRC/)scripts/create_flatpak_manifest.py $(FPQSV) -a "$(HB_URL)" -s "$(HB_SHA256)" -t $(PKG.cli.template.flatpak) $(foreach m,$(CONTRIBS),-c "$(word 1,$($m.FETCH.url))" -s "$(word 1,$($m.FETCH.sha256))") $(FPRUNTIME) $(PKG.cli.manifest.flathub)
$(SRC/)scripts/create_flatpak_manifest.py $(FPQSV) $(FPNVENC) -a "$(HB_URL)" -s "$(HB_SHA256)" -t $(PKG.cli.template.flatpak) $(foreach m,$(CONTRIBS),-c "$(word 1,$($m.FETCH.url))" -s "$(word 1,$($m.FETCH.sha256))") $(FPRUNTIME) $(PKG.cli.manifest.flathub)

$(PKG.gui.flatpak): GNUmakefile $(PKG.gui.template.flatpak) $(PKG.src.tar.bz2)
make contrib.fetch
$(MKDIR.exe) -p $(STAGE.out.flatpak/)
$(MKDIR.exe) -p $(PKG.out.flatpak/)
$(SRC/)scripts/create_flatpak_manifest.py $(FPQSV) -a "$(abspath $(PKG.src.tar.bz2))" -t $(PKG.gui.template.flatpak) $(foreach m,$(CONTRIBS),-c "$(abspath $(CONTRIB.download/)$($m.FETCH.basename))") $(PKG.gui.manifest.flatpak)
$(SRC/)scripts/create_flatpak_manifest.py $(FPQSV) $(FPNVENC) -a "$(abspath $(PKG.src.tar.bz2))" -t $(PKG.gui.template.flatpak) $(foreach m,$(CONTRIBS),-c "$(abspath $(CONTRIB.download/)$($m.FETCH.basename))") $(PKG.gui.manifest.flatpak)
flatpak-builder --default-branch=$(PKG.branch.flatpak) --disable-cache --force-clean $(PGPSIGN) --repo=$(PKG.repo.flatpak) $(PKG.gui.build.flatpak) $(PKG.gui.manifest.flatpak)
flatpak build-bundle $(PKG.repo.flatpak) $(PKG.gui.flatpak) $(PKG.gui.name.flatpak) $(PKG.branch.flatpak) --runtime-repo=https://flathub.org/repo/flathub.flatpakrepo

$(PKG.cli.flatpak): GNUmakefile $(PKG.cli.template.flatpak) $(PKG.src.tar.bz2)
make contrib.fetch
$(MKDIR.exe) -p $(STAGE.out.flatpak/)
$(MKDIR.exe) -p $(PKG.out.flatpak/)
$(SRC/)scripts/create_flatpak_manifest.py $(FPQSV) -a "$(abspath $(PKG.src.tar.bz2))" -t $(PKG.cli.template.flatpak) $(foreach m,$(CONTRIBS),-c "$(abspath $(CONTRIB.download/)$($m.FETCH.basename))") $(PKG.cli.manifest.flatpak)
$(SRC/)scripts/create_flatpak_manifest.py $(FPQSV) $(FPNVENC) -a "$(abspath $(PKG.src.tar.bz2))" -t $(PKG.cli.template.flatpak) $(foreach m,$(CONTRIBS),-c "$(abspath $(CONTRIB.download/)$($m.FETCH.basename))") $(PKG.cli.manifest.flatpak)
flatpak-builder --default-branch=$(PKG.branch.flatpak) --disable-cache --force-clean $(PGPSIGN) --repo=$(PKG.repo.flatpak) $(PKG.cli.build.flatpak) $(PKG.cli.manifest.flatpak)
flatpak build-bundle $(PKG.repo.flatpak) $(PKG.cli.flatpak) $(PKG.cli.name.flatpak) $(PKG.branch.flatpak) --runtime-repo=https://flathub.org/repo/flathub.flatpakrepo

Expand Down
23 changes: 19 additions & 4 deletions scripts/create_flatpak_manifest.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def __init__(self, runtime, template=None):
self.manifest["runtime-version"] = runtime

class FlatpakManifest:
def __init__(self, source_list, runtime, qsv, template=None):
def __init__(self, source_list, runtime, qsv, nvenc, template=None):
if template != None:
with open(template, 'r') as fp:
self.manifest = json.load(fp, object_pairs_hook=OrderedDict)
Expand Down Expand Up @@ -74,6 +74,12 @@ def __init__(self, source_list, runtime, qsv, template=None):

if qsv:
self.hbconfig.append("--enable-qsv");

if nvenc:
self.hbconfig.append("--enable-nvenc");
self.hbconfig.append("--enable-nvdec");
self.manifest["sdk-extensions"] = ['org.freedesktop.Sdk.Extension.llvm14'];
self.hbmodule["build-options"] = {'append-path':'/usr/lib/sdk/llvm14/bin','prepend-ld-library-path':'/usr/lib/sdk/llvm14/lib'};

handbrake_found = False
for key, value in source_list.items():
Expand Down Expand Up @@ -111,14 +117,15 @@ def usage():
print(" -t --template - Flatpak manifest template")
print(" -r --runtime - Flatpak SDK runtime version")
print(" -q --qsv - Build with Intel QSV support")
print(" -e --nvenc - Build with Nvidia HW Encoder support")
print(" -p --plugin - Manifest if for a HandBrake flatpak plugin")
print(" -h --help - Show this message")

if __name__ == "__main__":
try:
opts, args = getopt.getopt(sys.argv[1:], "a:c:s:t:r:qph",
opts, args = getopt.getopt(sys.argv[1:], "a:c:s:t:r:qeph",
["archive=", "contrib=", "sha265=",
"template=", "runtime=", "qsv", "plugin", "help"])
"template=", "runtime=", "qsv", "nvenc", "plugin", "help"])
except getopt.GetoptError:
print("Error: Invalid option")
usage()
Expand All @@ -133,6 +140,10 @@ def usage():
runtime = None
plugin = 0
qsv = 0
nvenc = 1
print("ARGS ",args)
print("OPT ",opts)
# exit()
for opt, arg in opts:
if opt in ("-h", "--help"):
usage()
Expand All @@ -158,6 +169,10 @@ def usage():
runtime = arg
elif opt in ("-q", "--qsv"):
qsv = 1;

elif opt in ("-e", "--nvenc"):
print("NVENC ON")
nvenc = 1;
elif opt in ("-p", "--plugin"):
plugin = 1;

Expand All @@ -169,7 +184,7 @@ def usage():
if plugin:
manifest = FlatpakPluginManifest(runtime, template)
else:
manifest = FlatpakManifest(source_list, runtime, qsv, template)
manifest = FlatpakManifest(source_list, runtime, qsv, nvenc, template)

if dst != None:
with open(dst, 'w') as fp:
Expand Down

0 comments on commit 8bde0be

Please sign in to comment.