/
Makefile.flatpak
79 lines (62 loc) · 2.75 KB
/
Makefile.flatpak
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
APPNAME = edu.ucsf.rbvi.ChimeraX
BUILD_DIR = fp-build.tmp
RUNTIME_VER = 23.08
BRANCH = $(shell awk '$$1 == "branch:" { print $$2; exit } { exit 3 }' last-commit 2> /dev/null || git branch --show-current)
SRC_DIR = $(shell pwd -P)
all:
# by default, do nothing
preqreqs-rhel:
dnf install flatpak flatpak-builder
prereqs-ubuntu:
apt install flatpak flatpak-builder gnome-software-plugin-flatpak
prereqs-flatpak:
flatpak install -y org.freedesktop.Sdk//${RUNTIME_VER} org.freedesktop.Platform//${RUNTIME_VER}
build-flatpak: ${APPNAME}.yaml wheels
flatpak-builder --force-clean ${BUILD_DIR} ${APPNAME}.yaml
prereqs:
# normally the wheels and include directories are created by the build_tools process
$(MAKE) -C prereqs install NO_PREBUILT=1
$(MAKE) -C prereqs app-install NO_PREBUILT=1
$(MAKE) -C src/apps/ChimeraX install BUILD_TYPE=${BUILD_TYPE}
$(MAKE) -C src/bundles install BUILD_TYPE=${BUILD_TYPE}
rm -rf wheels include
mv build/sync wheels
mv build/include .
${APPNAME}.yaml: ${APPNAME}.yaml.in
sed -e 's:RUNTIME_VER:${RUNTIME_VER}:' -e 's:BUILD_TYPE:BUILD_TYPE=${BUILD_TYPE}:' -e 's:SRC_DIR:${SRC_DIR}:' $< > $@ || rm $@
clean:
rm -f ${APPNAME}.metainfo.xml ${APPNAME}.desktop ${APPNAME}.yaml
rm -rf ${BUILD_DIR} .flatpak-builder
install:
# this is called indirectly by flatpak-builder via yaml/json manifest
mkdir -p /app
$(MAKE) -C prereqs install NO_PREBUILT=1 FLATPAK_DIST=${RUNTIME_VER} FLATPAK_APPNAME=${APPNAME}
$(MAKE) -C prereqs app-install NO_PREBUILT=1 FLATPAK_DIST=${RUNTIME_VER} FLATPAK_APPNAME=${APPNAME}
$(MAKE) -C src/apps/ChimeraX install FLATPAK_DIST=${RUNTIME_VER} FLATPAK_APPNAME=${APPNAME} BUILD_TYPE=${BUILD_TYPE}
/app/bin/python3.* -m pip install wheels/*.whl
cp -rp include /app
$(MAKE) -C src/apps install BUILD_TYPE=${BUILD_TYPE}
$(MAKE) -C docs install BUILD_TYPE=${BUILD_TYPE}
/app/bin/ChimeraX --nogui --exit --cmd "linux flatpak-files ${APPNAME}"
install -Dm644 -t /app/share/metainfo ${APPNAME}.metainfo.xml
install -Dm644 -t /app/share/applications ${APPNAME}.desktop
user-install: ${APPNAME}.yaml
# assume it has been built already
flatpak-builder --export-only --user --install ${BUILD_DIR} ${APPNAME}.yaml
system-install: ${APPNAME}.yaml
# assume it has been built already
flatpak-builder --export-only --system --install ${BUILD_DIR} ${APPNAME}.yaml
export-flatpak:
# Create a single file, ChimeraX.flatpak, that can be installed
flatpak build-export export ${BUILD_DIR}
flatpak build-bundle export ChimeraX.flatpak ${APPNAME}
run:
flatpak run ${APPNAME}
explore:
flatpak run --command=sh ${APPNAME}
explore-dev:
flatpak run -d --command=sh ${APPNAME}
explore-sdk: ${APPNAME}.yaml
flatpak run $(shell grep ^sdk ${APPNAME}.yaml | cut -d ' ' -s -f 2)
validate-metainfo:
appstream-util validate-relax ${APPNAME}.metainfo.xml