# Make mock usable. The only standard target is mockbuild which # doesn't do what you typically want. # Somewhat superseeded by fedpkg BRANCH := $(shell fedpkg switch-branch | sed -n -e 's/ f/ /' -e 's/master/rawhide/' -e 's/^\* //p') SPEC_FILE = $(shell fedpkg gimmespec) # VERREL is very slow VERREL := $(shell fedpkg verrel) VERREL_WORDS := $(shell fedpkg verrel | sed -e 's/^\(.*\)\-\([^-]*\)\.\([^.]*\)$$/\1 \2 \3/') DIST = $(word 1, $(VERREL_WORDS)) SPEC_VERSION = $(word 2, $(VERREL_WORDS)) SPEC_RELEASE = $(word 3, $(VERREL_WORDS)) SPEC_SOURCES = $(shell awk '{print $$2}' sources) # Order that dependent libraries need to be built and installed. comma := , empty := space := $(empty) $(empty) ORDER = \ glib-java \ cairo-java \ libgtk-java \ libgconf-java \ libvte-java libgnome-java \ libglade-java \ frysk #MOCKCFG = fedora-$(BRANCH)-i386 MOCKCFG = fedora-$(BRANCH)-x86_64 MOCK_WORDS := $(subst -, , $(MOCKCFG)) MOCK_OS := $(word 1,$(MOCK_WORDS)) MOCK_RELEASE := $(word 2,$(MOCK_WORDS)) MOCK_ARCH := $(word 3,$(MOCK_WORDS)) MOCK_RESULTS := results.$(MOCKCFG) ARCH := $(if $(findstring i386,$(MOCK_ARCH)),i686,$(MOCK_ARCH)) # --offline? NO_CLEAN := --no-clean --no-cleanup-after MOCK := /usr/bin/mock $(MOCKARGS) -r $(MOCKCFG) --resultdir=$(MOCK_RESULTS) SOURCES = *.spec *.patch $(SPEC_SOURCES) SRPM = $(VERREL).src.rpm RPM = $(VERREL).$(ARCH).rpm help: @echo "targets" @echo "" @echo " init: Initialize the $(MOCKCFG) chroot (if needed)" @echo " build: Build, logs in $(MOCK_RESULTS)" @echo " deploy: Build/Deploy $(ARCH) package" @echo " useful: Install some missing applications" @echo " shell: Start a shell in the chroot" @echo "" @echo " clean: Purge the $(ARCH) chroot tree" @echo " scrub: Completely purge the chroot tree, yum, everything" @echo "" @echo " update: Run yum update in the chroot" @echo " orphanskill: Kill any stray processes from the build" @echo " installdeps: Install dependencies for this package" @echo " lint: runs lint over the rpm" @echo " install MOCKARGS=...: install ... into chroot" @echo "" @echo " scratch: Do a scratch build of the SRPM in bodhi" @echo "" @echo "Use MOCKARGS= for extra arguments" .PHONY:: help init: $(MOCK) -q --chroot pwd \ || $(MOCK) --init .PHONY:: init mock build $(MOCK_RESULTS)/$(RPM): init $(SOURCES) rm -f $(MOCK_RESULTS)/*.src.rpm $(MOCK) $(NO_CLEAN) --buildsrpm --spec $(SPEC_FILE) --sources $(PWD) $(MOCK) $(NO_CLEAN) --rebuild $(MOCK_RESULTS)/*.src.rpm .PHONY:: build # rpmspec -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}\n' $(SPEC_FILE) deploy: $(MOCK_RESULTS)/$(RPM) $(MOCK) -q --chroot 'rm -f /tmp/*.rpm' for rpm in $(MOCK_RESULTS)/*.rpm ; do \ case $$rpm in \ *.src.rpm | *-debuginfo-* ) ;; \ * ) $(MOCK) -q --copyin $$rpm /tmp ;; \ esac ; \ done $(MOCK) -q --chroot "rpm -Uvh --force /tmp/*.rpm" .PHONY:: deploy $(SPEC_SOURCES): fedpkg sources world gnome: set -e ; \ for d in $(ORDER) ; do \ pushd ../$$d ; \ $(MAKE) -f $(PWD)/Makefile deploy ; \ popd ; \ done .PHONY:: world usable: init $(MOCK) install vi less automake-docs strace .PHONY:: usable clog prep: fedpkg $@ .PHONY:: clog prep lint: fedpkg lint .PHONY:: lint scratch: $(SRPM) fedpkg scratch-build --srpm $(SRPM) .PHONY:: scratch srpm: $(SRPM) .PHONY:: srpm $(SRPM): $(SOURCES) fedpkg srpm clean: $(MOCK) --$@ $(ARGS) $(PACKAGE) rm -rf $(MOCK_RESULTS) .PHONY:: clean scrub: $(MOCK) --$@=all $(ARGS) shell install update remove orphanskill copyin copyout: $(MOCK) --$@ $(ARGS) $(PACKAGE) .PHONY:: shell install update remove orphanskill scrub copyin copyout