debian-image-builder-frontend/Makefile
Gianluca Zuccarelli 7824d047db Makefile: add install target
Add a simple install target that we can reference in the specfile.
2025-01-14 12:09:59 +01:00

73 lines
2.2 KiB
Makefile

PACKAGE_NAME = image-builder-frontend
INSTALL_DIR = /share/cockpit/$(PACKAGE_NAME)
APPSTREAMFILE=org.image-builder.$(PACKAGE_NAME).metainfo.xml
VERSION := $(shell (cd "$(SRCDIR)" && grep "^Version:" cockpit/$(PACKAGE_NAME).spec | sed 's/[^[:digit:]]*\([[:digit:]]\+\).*/\1/'))
COMMIT = $(shell (cd "$(SRCDIR)" && git rev-parse HEAD))
# TODO: figure out a strategy for keeping this updated
COCKPIT_REPO_COMMIT = b0e82161b4afcb9f0a6fddd8ff94380e983b2238
COCKPIT_REPO_URL = https://github.com/cockpit-project/cockpit.git
COCKPIT_REPO_TREE = '$(strip $(COCKPIT_REPO_COMMIT))^{tree}'
# checkout common files from Cockpit repository required to build this project;
# this has no API stability guarantee, so check out a stable tag when you start
# a new project, use the latest release, and update it from time to time
COCKPIT_REPO_FILES = \
pkg/lib \
$(NULL)
help:
@cat Makefile
#
# Install target for specfile
#
.PHONY: install
install:
$(MAKE) cockpit/install
#
# Cockpit related targets
#
.PHONY: cockpit/clean
cockpit/clean:
rm -f cockpit/public/*.css
rm -f cockpit/public/*.js
.PHONY: cockpit/install
cockpit/install:
mkdir -p $(DESTDIR)$(PREFIX)$(INSTALL_DIR)
cp -a cockpit/public/* $(DESTDIR)$(PREFIX)$(INSTALL_DIR)
mkdir -p $(DESTDIR)$(PREFIX)/share/metainfo
msgfmt --xml -d po \
--template cockpit/public/$(APPSTREAMFILE) \
-o $(DESTDIR)$(PREFIX)/share/metainfo/$(APPSTREAMFILE)
.PHONY: cockpit/devel-uninstall
cockpit/devel-uninstall: PREFIX=~/.local
cockpit/devel-uninstall:
rm -rf $(PREFIX)$(INSTALL_DIR)
.PHONY: cockpit/devel-install
cockpit/devel-install: PREFIX=~/.local
cockpit/devel-install:
PREFIX="~/.local"
mkdir -p $(PREFIX)$(INSTALL_DIR)
ln -s $(shell pwd)/cockpit/public $(PREFIX)$(INSTALL_DIR)
.PHONY: cockpit/download
cockpit/download: Makefile
@git rev-list --quiet --objects $(COCKPIT_REPO_TREE) -- 2>/dev/null || \
git fetch --no-tags --no-write-fetch-head --depth=1 $(COCKPIT_REPO_URL) $(COCKPIT_REPO_COMMIT)
git archive $(COCKPIT_REPO_TREE) -- $(COCKPIT_REPO_FILES) | tar x
.PHONY: cockpit/build
cockpit/build: cockpit/download
npm ci
npm run build:cockpit
.PHONY: cockpit/devel
cockpit/devel: cockpit/devel-uninstall cockpit/build cockpit/devel-install