-
Notifications
You must be signed in to change notification settings - Fork 32
/
Makefile.flatpak
94 lines (77 loc) · 3.67 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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
APPNAME = edu.ucsf.rbvi.ChimeraX
BUILD_DIR = fp-build.tmp
RUNTIME_VER = 23.08
BRANCH = $(shell \
branch=$$(awk '$$1 == "branch:" { print $$2; exit } { exit }' last-commit 2> /dev/null) ; \
if [ -z "$$branch" ]; then branch=$$(git branch --show-current); fi ; \
if [ -z "$$branch" ]; then branch=develop; fi ; \
echo $$branch )
COMMIT=$(shell \
(awk '$$1 == "commit" { print $$2; exit } { exit 3 }' last-commit 2> /dev/null) \
|| (git show --summary --format=%H | head -1))
SRC_DIR = $(shell pwd -P)
ifeq ($(BUILD_TYPE),daily)
APPNAME := ${APPNAME}-daily
else ifeq ($(BUILD_TYPE),techpreview)
APPNAME := ${APPNAME}-techpreview
endif
all:
# by default, do nothing
preqreqs-rhel:
dnf install flatpak flatpak-builder
prereqs-ubuntu:
apt install flatpak flatpak-builder gnome-software-plugin-flatpak
build-flatpak: ${APPNAME}.yaml
flatpak-builder --force-clean ${BUILD_DIR} ${APPNAME}.yaml
flatpak-prereq:
flatpak remote-add --if-not-exists --user flathub https://dl.flathub.org/repo/flathub.flatpakrepo
flatpak install -y --user flathub org.freedesktop.Platform//${RUNTIME_VER} org.freedesktop.Sdk//${RUNTIME_VER}
prereqs:
# normally the wheels and include directories are created by the build_tools process
$(MAKE) -C prereqs install NO_PREBUILT=1 FLATPAK_DIST=${RUNTIME_VER} BUILD_TYPE=${BUILD_TYPE}
$(MAKE) -C prereqs app-install NO_PREBUILT=1 FLATPAK_DIST=${RUNTIME_VER} BUILD_TYPE=${BUILD_TYPE}
$(MAKE) -C src/apps/ChimeraX install FLATPAK_DIST=${RUNTIME_VER} BUILD_TYPE=${BUILD_TYPE}
$(MAKE) -C src/bundles install FLATPAK_DIST=${RUNTIME_VER} BUILD_TYPE=${BUILD_TYPE}
rm -rf wheels include
mv build/sync wheels
mv build/include .
${APPNAME}.yaml: flatpak-app.yaml.in
sed -e 's:APPNAME:${APPNAME}:' -e 's:RUNTIME_VER:${RUNTIME_VER}:' -e 's:BRANCH:${BRANCH}:' -e 's:COMMIT:${COMMIT}:' -e 's:BUILD_TYPE:BUILD_TYPE=${BUILD_TYPE}:' $< > $@ || 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}
# create wheels and include directories
curl https://cxtoolshed.rbvi.ucsf.edu/prereqs/linux-shared/${BUILD_TYPE}.tar.bz2 | tar jxf -
cp -rp include /app
/app/bin/python3.* -m pip install wheels/*.whl
$(MAKE) -C src/apps install FLATPAK_DIST=${RUNTIME_VER} BUILD_TYPE=${BUILD_TYPE}
$(MAKE) -C docs install FLATPAK_DIST=${RUNTIME_VER} 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