From 8fbbf6c9af929d9551432f998de7744bc6741a55 Mon Sep 17 00:00:00 2001 From: Steve Beattie Date: Tue, 11 Apr 2006 21:19:46 +0000 Subject: [PATCH] Test import of the common/ subtree. Internal svn repo version 6381. --- common/Make-po.rules | 45 ++++++++++ common/Make.rules | 197 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 242 insertions(+) create mode 100644 common/Make-po.rules create mode 100644 common/Make.rules diff --git a/common/Make-po.rules b/common/Make-po.rules new file mode 100644 index 000000000..b6bac3364 --- /dev/null +++ b/common/Make-po.rules @@ -0,0 +1,45 @@ +# $Id: Makefile 4157 2005-03-29 23:02:21Z steve $ +# ------------------------------------------------------------------ +# +# Copyright (C) 2002-2005 Novell/SUSE +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of version 2 of the GNU General Public +# License published by the Free Software Foundation. +# +# ------------------------------------------------------------------ +# +# The including makefile needs to define LANG, which lists the lang +# files to include; e.g. LANG=en_US de_DE, where en_US.po and de_DE.po +# exist +LOCALEDIR=/usr/share/locale + +XGETTEXT_ARGS=--copyright-holder="NOVELL, Inc." --msgid-bugs-address=apparmor-general@forge.novell.com -d ${NAME} + +# When making the .pot file, it's expected that the parent Makefile will +# pass in the list of sources in the SOURCES variable +PARENT_SOURCES=$(foreach source, ${SOURCES}, ../${source}) + +TARGET_MOS=$(foreach lang, ${LANGS}, ${lang}.mo) + +.PHONY: all +all: ${TARGET_MOS} + +${NAME}.pot: ${PARENT_SOURCES} + xgettext ${XGETTEXT_ARGS} ${PARENT_SOURCES} -o $@ + +%.mo: %.po + msgfmt -c -o $@ $< + +.PHONY: install +install: ${TARGET_MOS} + mkdir -p $(DESTDIR)/${LOCALEDIR} + for lang in ${LANGS} ; do \ + mkdir -p ${DESTDIR}/${LOCALEDIR}/$${lang}/LC_MESSAGES ; \ + install -m 644 $${lang}.mo ${DESTDIR}/${LOCALEDIR}/$${lang}/LC_MESSAGES/${NAME}.mo ; \ + done + +.PHONY: clean +clean: + rm -f *.mo + diff --git a/common/Make.rules b/common/Make.rules new file mode 100644 index 000000000..0a3a24682 --- /dev/null +++ b/common/Make.rules @@ -0,0 +1,197 @@ +# $Id: Make.rules 6022 2006-01-09 22:06:34Z dominic $ +# ------------------------------------------------------------------ +# +# Copyright (C) 2002-2005 Novell/SUSE +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of version 2 of the GNU General Public +# License published by the Free Software Foundation. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, contact Novell, Inc. +# ------------------------------------------------------------------ +# Make.rules - common make targets and variables for building the SHASS +# product. +# +# NOTES: +# - must define the package NAME before including this file. +# - After checking in to cvs, you'll need to delele the hardlinked +# Make.rules files that already exist in the individual application +# directories + +DISTRIBUTION=Novell AppArmor +VERSION=2.0 + +# OVERRIDABLE variables +# Set these variables before including Make.rules to change its behavior +# SPECFILE - for packages that have a non-standard specfile name +# EXTERNAL_PACKAGE - for packages that have upstream versions that +# we're locally modifying (e.g. imnxcerttool/gnutls). +# +# use 'make BUILDIR=/some/where/else/' to override the /usr/src/redhat +# location -- it *should* pick out the right thing to do based on the +# .rpmmacros file, but you can still use BUILDDIR to override that. +TESTBUILDDIR=$(shell [ -f ${HOME}/.rpmmacros ] && awk '/^%_topdir/ {print $$2}' ${HOME}/.rpmmacros) +ifdef BUILDDIR +#BUILDDIR:=$(BUILDDIR,/=) +else +BUILDDIR=$(shell if [ -d "${TESTBUILDDIR}" ] ; then \ + echo ${TESTBUILDDIR} | sed "s^/$$^^" ; \ + elif [ -d "/usr/src/redhat" ] ; then \ + echo "/usr/src/redhat" ; \ + elif [ -d "/usr/src/packages" ] ; then \ + echo "/usr/src/packages" ; \ + else \ + echo "/tmp/${NAME}" ; \ + fi ;) +endif +RPMHOSTVENDOR=$(shell rpm --eval "%{_host_vendor}") +ifndef DISTRO +DISTRO=$(shell if [ -f /etc/slackware-version ] ; then \ + echo slackware ; \ + elif [ -f /etc/debian_version ] ; then \ + echo debian ;\ + elif [ ${RPMHOSTVENDOR} = "suse" ] ; then \ + echo suse ;\ + elif [ ${RPMHOSTVENDOR} = "redhat" ] ; then \ + echo rhel4 ;\ + else \ + echo unknown ;\ + fi) +endif +RPMARG=--define "_topdir ${BUILDDIR}" \ + --define "vendor NOVELL, Inc." \ + --define "distribution ${DISTRIBUTION}" \ + --define "debug_package %{nil}" \ + --define "immunix_version ${VERSION}" \ + $(shell [ -d ${BUILDDIR}/BUILDROOT ] && echo --define \"buildroot ${BUILDDIR}/BUILDROOT\") \ + $(shell [ -n "${DISTRO}" ] && echo --define \"distro ${DISTRO}\") + +#REPO_VERSION=$(shell if [ -x /usr/bin/svn ] ; then \ +# if ! /usr/bin/svn info -r HEAD . 2> /dev/null | grep "^Last Changed Rev:" | sed "s/^Last Changed Rev: //" ; then \ +# /usr/bin/svn info . 2> /dev/null | grep "^Last Changed Rev:" | sed "s/^Last Changed Rev: //" ; \ +# fi ; \ +# fi) +REPO_VERSION=$(shell if [ -x /usr/bin/svn ] ; then \ + /usr/bin/svn info . 2> /dev/null | grep "^Last Changed Rev:" | sed "s/^Last Changed Rev: //" ; \ + fi) + +ifdef EXTERNAL_PACKAGE +RPMARG+=--define "_sourcedir $(shell pwd)" +endif + +ifndef SPECFILE +SPECFILE = $(NAME).spec +endif +RELEASE = $(shell rpm -q --specfile --define "_sourcedir ." ${RPMARG} --qf "%{RELEASE}" ${SPECFILE}) +RELEASE_DIR = $(NAME)-$(VERSION) +TARBALL = $(NAME)-$(VERSION)-${REPO_VERSION}.tar.gz +TAR = /bin/tar czvp --exclude .svn --exclude CVS --exclude .cvsignore --exclude ${TARBALL} --exclude ${RELEASE_DIR}/${RELEASE_DIR} $(shell test -f ${NAME}.exclude && echo "-X ${NAME}.exclude") + +CVSPKG_VERSION=$(shell rpm -q --specfile --define "_sourcedir ." ${RPMARG} ${SPECFILE} | head -1 | tr "." "_") + +RPMSUBDIRS=SOURCES SPECS BUILD BUILDROOT SRPMS RPMS/i386 RPMS/i586 \ + RPMS/i686 RPMS/athlon RPMS/noarch RPMS/x86_64 +BUILDRPMSUBDIRS=$(foreach subdir, $(RPMSUBDIRS), $(BUILDDIR)/$(subdir)) + +.PHONY: cvs_tag +cvs_tag: + cvs tag IMMUNIX-${CVSPKG_VERSION} + +.PHONY: checkin +checkin: + if cvs -q up -d | grep -q "^\?" ; then echo "Hey! You have" \ + "files in the directory you have not added into cvs."; exit 1; \ + fi + cvs ci + make cvs_tag + +ifdef EXTERNAL_PACKAGE +.PHONY: rpm +rpm: clean $(BUILDRPMSUBDIRS) + rpmbuild -ba ${RPMARG} ${SPECFILE} + +else +.PHONY: rpm +rpm: clean $(TARBALL) $(BUILDRPMSUBDIRS) + cp $(TARBALL) $(BUILDDIR)/SOURCES/ + cp ${SPECFILE} $(BUILDDIR)/SPECS/ + rpmbuild -ba ${RPMARG} ${SPECFILE} + +.PHONY: ${SPECFILE} +${SPECFILE}: ${SPECFILE}.in + sed -e "s/@@immunix_version@@/${VERSION}/g" \ + -e "s/@@repo_version@@/${REPO_VERSION}/g" $< > $@ + +${TARBALL}: clean ${SPECFILE} + -rm -rf $(RELEASE_DIR) + mkdir $(RELEASE_DIR) + $(TAR) . | tar xz -C $(RELEASE_DIR) + $(TAR) -f $@ $(RELEASE_DIR) + rm -rf $(RELEASE_DIR) + +.PHONY: tarball +tarball: clean $(TARBALL) +endif + +.PHONY: version +.SILENT: version +version: + rpm -q --define "_sourcedir ." ${RPMARG} --specfile ${SPECFILE} + +.PHONY: build_dir +build_dir: $(BUILDRPMSUBDIRS) + +$(BUILDRPMSUBDIRS): + mkdir -p $(BUILDRPMSUBDIRS) + +# ===================== +# Slackware poo +# ===================== +.PHONY: slack +slack: + rm -rf ${BUILDDIR} + mkdir -p ${BUILDDIR}/install + make install DESTDIR=${BUILDDIR} DISTRO=slackware + # comment line is there so grep always has something to match + ( echo "# install script pulled from ${SPECFILE}" ; rpm -q --specfile --define "_sourcedir ." ${RPMARG} --qf "%{POSTIN}\n" ${SPECFILE}) | grep -v "^(none)$$" >> ${BUILDDIR}/install/doinst.sh + ( cd ${BUILDDIR} && makepkg -l y -c y -p ${PWD}/${NAME}-${VERSION}-${RELEASE}.tgz ) + +# ===================== +# Debian poo +# ===================== +.PHONY: deb +deb: ${TARBALL} + rm -rf ${BUILDDIR} + mkdir -p ${BUILDDIR} + tar -xvzf ${TARBALL} -C ${BUILDDIR} + ( cd ${BUILDDIR}/${RELEASE_DIR} && sh -c "DEBFULLNAME='NOVELL, Inc' dh_make -e apparmor-general@forge.novell.com --library -f ~/svn/immunix/immunix/libimmunix/libimmunix-2.0.tar.gz << EOM \ +\ +EOM" ) + make ${NAME}-deb -C ${BUILDDIR}/${RELEASE_DIR} + # ( cd ${BUILDDIR}/${RELEASE_DIR} && dpkg-buildpackage -b -sd -rfakeroot) + +DEBIAN_DISTRO=stable + +DEB_CHANGELOG_OUTPUT="${NAME} (${VERSION}-${RELEASE}) ${DEBIAN_DISTRO}; urgency=low\n\ + \n * Automatically generated by the AppArmor Build System.\n\ + \n -- AppArmor Development Team $(shell date -R)" + + +.PHONY: debian/changelog +debian/changelog: + echo -e ${DEB_CHANGELOG_OUTPUT} > $@ + +A2PS_ARGS=-Ec -g --line-numbers=1 +ENSCRIPT_ARGS=-C -2jGr -f Courier6 -E +%.c.ps: %.c + #a2ps ${A2PS_ARGS} $< -o $@ + enscript ${ENSCRIPT_ARGS} -o $@ $< + +%.pm.ps: %.pm + enscript ${ENSCRIPT_ARGS} -o $@ $<