Blame build.sh

Packit 2e24a8
#!/bin/sh
Packit 2e24a8
# This script parses the package name and version out of configure.ac,
Packit 2e24a8
# uses them to assemble the names of the distribution tar.gz and source rpm,
Packit 2e24a8
# then calls make to generate those files.
Packit 2e24a8
# Any arguments will be passed on to configure when building the tarball.
Packit 2e24a8
Packit 2e24a8
AC_INIT=`grep AC_INIT configure.ac`
Packit 2e24a8
PACKAGE=`echo ${AC_INIT} | awk 'BEGIN { FS="[][]" }; { print $2 };'`
Packit 2e24a8
VERSION=`echo ${AC_INIT} | awk 'BEGIN { FS="[][]" }; { print $4 };'`
Packit 2e24a8
Packit 2e24a8
tgz=${PACKAGE}-${VERSION}.tar.gz
Packit 2e24a8
srpm=${PACKAGE}-${VERSION}-1.src.rpm
Packit 2e24a8
Packit 2e24a8
rm -f ${tgz} ${srpm}
Packit 2e24a8
Packit 2e24a8
make -f - <
Packit 2e24a8
.PHONY = all
Packit 2e24a8
all: ${tgz} ${srpm}
Packit 2e24a8
Packit 2e24a8
configure: configure.ac Makefile.am
Packit 2e24a8
	autoreconf --install -s
Packit 2e24a8
Packit 2e24a8
${tgz}: configure
Packit 2e24a8
	./configure ${@}
Packit 2e24a8
	make dist
Packit 2e24a8
Packit 2e24a8
${srpm}: ${tgz} ${PACKAGE}.spec
Packit 2e24a8
	rpmbuild --eval "%undefine dist"	\
Packit 2e24a8
		--define "_sourcedir ${PWD}"	\
Packit 2e24a8
		--define "_specdir ${PWD}" 	\
Packit 2e24a8
		--define "_srcrpmdir ${PWD}"	\
Packit 2e24a8
		-bs ${PACKAGE}.spec
Packit 2e24a8
EOF
Packit 2e24a8