netsrpms/Makefile

170 lines
4.7 KiB
Makefile

# Makefile for netsrpms
# Copyright (C) 2022 by Silvan Calarco <silvan.calarco@mambasoft.it>
include VERSION
WITH_DISTROMENU:=
ARCH:=`uname -m`
ifeq ($(ARCH), arm)
SRPMSVERSIONSFILE = SRPMSVERSIONS.arm
pck_srpms = b43-firmware
else
ifeq ($(ARCH), x86_64)
SRPMSVERSIONSFILE = SRPMSVERSIONS
pck_srpms = msttcorefonts skype b43-firmware virtualbox-extension-pack \
chromium-widevine
else
SRPMSVERSIONSFILE = SRPMSVERSIONS
pck_srpms = msttcorefonts skype b43-firmware virtualbox-extension-pack
endif
endif
PACKAGE = netsrpms
DISTROID = openmamba
RPM_VENDOR = openmamba
RPM_DISTRIBUTION = openmamba
RPM_DISTROEXT = mamba
SYSCONFIGFILE = netsrpminstall
DISTROid = $(shell echo $(DISTROID) | tr A-Z a-z)
DISTROICON = $(DISTROid)
DESTDIR =
prefix = /usr
exec_prefix = ${prefix}
sysconfdir = /etc
sbindir = ${exec_prefix}/sbin
bindir = ${exec_prefix}/bin
datadir = ${prefix}/share
ifeq ($(ARCH), x86_64)
libexecdir = ${prefix}/libexec64
else
libexecdir = ${prefix}/libexec
endif
mandir = ${prefix}/usr/share/man
sysconfigdir= ${sysconfdir}/sysconfig
profiledir = ${sysconfdir}/profile.d
iconsdir = ${datadir}/icons/hicolor
localesdir = ${datadir}/locale
pck_desktop = $(wildcard desktop/*.bz2)
systemlogodir = ${datadir}/pixmaps
xdg_appsdir = ${datadir}/applications
xdg_directorydir = ${datadir}/desktop-directories
xdg_menudir = ${sysconfdir}/xdg/menus
xdg_mergedmenudir = $(xdg_menudir)/applications-merged
netsrpmsdir = ${datadir}/netsrpms
srcdir = .
INSTALL = /usr/bin/install
INSTALL_PROGRAM = ${INSTALL} -m 755
INSTALL_DATA = ${INSTALL} -m 644
INSTALL_DIR = ${INSTALL} -d -m 755
INSTALL_SCRIPT = ${INSTALL_PROGRAM}
pck_infiles := $(wildcard menu/*.in \
SRPMS/*/*.in)
pck_sysconfigfile := distroutils.sysconfig
distdir = $(PACKAGE)-$(VERSION)
dist_archive = $(distdir).tar.bz2
pck_catalogs := $(wildcard po/*.po)
.SUFFIXES:
.SUFFIXES: .in .po .mo
.in:; @echo "generating $@..."; \
if [ "$(ARCH)" != "x86_64" -a "$(ARCH)" != "arm" ]; then ARCH=i386; else ARCH=$(ARCH); fi; \
sed "s,@distroID@,$(DISTROID),g;\
s,@distroid@,$(DISTROid),g;\
s,@arch@,$$ARCH,g;\
s,@distribution@,$(RPM_DISTRIBUTION),g;\
s,@distroext@,$(RPM_DISTROEXT),g;\
s,@vendor@,$(RPM_VENDOR),g;\
s,@sysconfigfile@,$(SYSCONFIGFILE),g;\
s,@datadir@,${datadir},g;\
s,@bindir@,$(bindir),g;\
s,@libexecdir@,$(libexecdir),g;\
s,@netsrpmsdir@,$(netsrpmsdir),g;\
s,@screensaver@,${SCREENSAVER},g" $< > $@
all: dist-update locales
dist-update: $(pck_infiles:.in=)
.po.mo:; msgfmt $< -o $@
locales: $(pck_catalogs:.po=.mo)
install-locales: locales
@for f in $(pck_catalogs); do\
lang=`echo $$f | sed 's,.*/\(.*\)\.po,\1,'`;\
echo "installing i18n file for language \`$$lang'...";\
dir="$(DESTDIR)$(datadir)/locale/$$lang/LC_MESSAGES";\
$(INSTALL_DIR) $$dir;\
$(INSTALL_DATA) $${f/.po/.mo} $$dir/netsrpms.mo;\
done
install-distromenu: dist-update
@if [ "$(WITH_DISTROMENU)" ]; then \
$(INSTALL_DIR) $(DESTDIR)$(xdg_directorydir); \
$(INSTALL_DATA) menu/netsrpms.directory \
$(DESTDIR)$(xdg_directorydir)/netsrpms.directory; \
$(INSTALL_DIR) $(DESTDIR)$(xdg_mergedmenudir); \
$(INSTALL_DATA) menu/netsrpms.menu \
$(DESTDIR)$(xdg_mergedmenudir)/netsrpms.menu; \
$(INSTALL_DIR) $(DESTDIR)$(xdg_appsdir); \
for pck in $(pck_srpms); do\
$(INSTALL_DATA) menu/$$pck.desktop \
$(DESTDIR)$(xdg_appsdir)/$$pck.desktop;\
done; \
$(INSTALL_DIR) $(DESTDIR)$(iconsdir); \
cp -a hicolor $(DESTDIR)$(iconsdir); \
fi
install-srpms:
@$(INSTALL_DIR) $(DESTDIR)$(netsrpmsdir)
@$(INSTALL_DIR) $(DESTDIR)$(sysconfigdir)
@cat $(SRPMSVERSIONSFILE) > $(DESTDIR)$(sysconfigdir)/$(SYSCONFIGFILE)
for pck in $(pck_srpms); do\
cp -a SRPMS/$$pck $(DESTDIR)$(netsrpmsdir); \
rm -f $(DESTDIR)$(netsrpmsdir)/$$pck/distroutils.sysconfig*; \
rm -f $(DESTDIR)$(netsrpmsdir)/$$pck/*.spec.in; \
cat SRPMS/$$pck/$(pck_sysconfigfile) >> \
$(DESTDIR)$(sysconfigdir)/$(SYSCONFIGFILE);\
done
install-netsrpms:
@$(INSTALL_DIR) $(DESTDIR)$(bindir)
$(INSTALL_SCRIPT) netsrpms $(DESTDIR)$(bindir)
install: $(pck_infiles:.in=) \
install-srpms \
install-netsrpms \
install-distromenu \
install-locales
dist: clean
@mkdir /tmp/$(distdir)
@cp -a * /tmp/$(distdir)/
@rm -f $(dist_archive);\
tar cf - -C /tmp $(distdir) | bzip2 -9 -c > $(dist_archive)
@rm -rf /tmp/$(distdir)
@echo "file \`$(dist_archive)' created"
dist-rpm: dist
@rpm_sourcedir=`rpm --eval=%{_sourcedir}`;\
mv -f $(dist_archive) $$rpm_sourcedir;\
echo "and saved as \`$$rpm_sourcedir/$(dist_archive)'"
clean:
rm -f $(dist_archive)
rm -f $(patsubst %.in,%,$(pck_infiles))
rm -f $(pck_catalogs:.po=.mo)