PACKAGE=drakfirsttime
VERSION=2.25.4

INITLEVEL = 60
INITFILE = firstboot.xsetup
CONFFILE = firstboot.sysconf
PREFIX = /usr/local
DATADIR = $(PREFIX)/share
# xinit.d
SUBDIRS = po

all:
	for d in $(SUBDIRS); do ( cd $$d ; make $@ ) ; done

clean:
	$(MAKE) -C po $@
	rm -f core .#*[0-9]
	for d in $(SUBDIRS); do ( cd $$d ; make $@ ) ; done

install: all
	$(MAKE) -C po $@
	perl -pi -e "s/VERSION/$(VERSION)/" ftw-start-browser.sh
	install -d $(DESTDIR)/{etc/{sysconfig,X11/xsetup.d},usr/{bin,sbin,share/drakfirsttime/pixmaps,share/icons/{mini,large},share/icons/hicolor/{48x48,32x32,16x16}/apps}}
	install -m755 ftw-generate-disconnect-page.pl ftw-start-browser.sh $(RPM_BUILD_ROOT)/usr/bin
	install -m755 config/$(INITFILE) $(RPM_BUILD_ROOT)/etc/X11/xsetup.d/$(INITLEVEL)$(INITFILE)
	install -m644 config/$(CONFFILE) $(RPM_BUILD_ROOT)/etc/sysconfig/firstboot
	install -m644 pixmaps/*.png $(RPM_BUILD_ROOT)/usr/share/drakfirsttime/pixmaps
	install -d $(DATADIR)/$(PACKAGE)
	cp -a firefox $(DATADIR)/$(PACKAGE)/firefox
	cp -a data/* $(DATADIR)/$(PACKAGE)/
	perl -pi -e 's!url\(!url(/usr/share/drakfirsttime/!' $(DATADIR)/$(PACKAGE)/*.css

# rules to build a test rpm

dist: localcopy tar

localcopy:
	rm -fr $(PACKAGE)-$(VERSION)
	svn export -q -rBASE . $(PACKAGE)-$(VERSION)

tar:
	tar cfa $(PACKAGE)-$(VERSION).tar.lzma $(PACKAGE)-$(VERSION)
	rm -rf $(PACKAGE)-$(VERSION)

log: changelog

changelog: ../common/username
	svn2cl --authors ../common/username.xml --accum
	rm -f ChangeLog.bak
	svn commit -m "Generated by svn2cl the `date '+%d_%b'`" ChangeLog
