diff --git a/Master/rpm.make b/Master/rpm.make new file mode 100644 index 00000000..f566bcc0 --- /dev/null +++ b/Master/rpm.make @@ -0,0 +1,355 @@ +# +# rpm.make +# +# Makefile rules to build a RPM spec files and RPM packages +# +# Copyright (C) 2001 Free Software Foundation, Inc. +# +# Author: Nicola Pero +# +# This file is part of the GNUstep Makefile Package. +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# You should have received a copy of the GNU General Public +# License along with this library; see the file COPYING.LIB. +# If not, write to the Free Software Foundation, +# 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +# +# FIXME: Move all this documentation into the documentation +# + +# rpm puts all tools, bundles, applications, subprojects, libraries, +# etc specified in the GNUmakefile into a single rpm. There aren't any +# provisions for putting separate apps/tools/etc in separate rpms +# (other than putting them in separate dirs). +# +# Note: we don't make development packages separated from the standard +# ones. Every package containing a library's object files will also +# contain the header files for the library . +# +# +# You can build two kind of packages: +# - normal packages +# - debugging packages +# +# First we describe normal packages. +# +# the make package generates automatically: +# * the .tgz source file to be copied into where_you_build_rpms/SOURCES/ +# +# +# * the spec file to be copied into where_you_build_rpms/SPECS/ +# +# +# at this point, to build the rpm you just do +# cd where_you_build_rpms/SPECS/ +# rpm -ba my_package.spec +# +# If you are *very* lazy, typing `make rpm' will do it all automatically +# for you. But in that case, you need to have set the shell environment +# variable `RPM_TOPDIR' to the top dir of where you build rpms (eg, +# /usr/src/redhat/). +# + +# To build the spec file for a package, you need to do two things: + +# [1] Add - after common.make - the following lines in your GNUmakefile: +# +# PACKAGE_NAME = Gomoku +# VERSION = 1.1.1 +# +# (replace them with name, version of your software). This is mainly +# needed so that when you build the .tgz and the spec file, they have +# names which are in sync. Also, you can use VERSION to keep the +# library version and the package version in sync. +# +# The other important variable you may want to set in your makefiles is +# +# GNUSTEP_INSTALLATION_DIR - Installation dir (defaults to GNUSTEP_LOCAL_ROOT) +# +# If your package is relocatable (this is true by default - see below +# for how to make it non-relocatable) the user will be able to install +# the package elsewhere by using something like `rpm -Uvh --prefix +# /home/nicola/GNUstep your_package.rpm' when installing the package. +# + +# [2] Provide a $(PACKAGE_NAME).spec.in file, which contains the RPM +# spec preamble. Here is an example: + +# Summary: A table board game +# Release: 1 +# Copyright: GPL +# Group: Amusements/Games +# Source: http://www.gnustep.it/nicola/Applications/Gomoku/%{gs_name}-%{gs_version}.tar.gz +# +# %description +# Gomoku is an extended TicTacToe game for GNUstep. You win the game if +# you are able to put 5 of your pieces in a row, column or diagonal. You +# loose if the computer does it before you. You can play the game on +# boards of different size; the default size is 8 but 10 is also nice to +# play. The game has 6 different difficulty levels. + +# Comments: +# you must not include: `Name', `Version', `BuildRoot' and `Prefix' +# entries. These are generated automatically; `Name' and `Version' +# from $(PACKAGE_NAME) and $(VERSION), and so for BuildRoot and Prefix. +# you might include all the other tags listed in the RPM doc if you want. +# The `Prefix:' entry is automatically included only if your package +# is relocatable (should be the default for all non-system packages. +# If you want your package to be non-relocatable (to be used only for +# system packages which *must* be installed in GNUSTEP_SYSTEM_ROOT), +# add the line +# +# RPM_DISABLE_RELOCATABLE=YES +# +# (FIXME improve variable name) to your GNUmakefile. This will not generate +# a `Prefix:' line in the spec file. +# +# +# You can use the following if you need: +# %{gs_name} expands to the value of the make variable PACKAGE_NAME +# %{gs_version} expands to the value of the make variable VERSION +# (make sure you use them in `Source:' as shown). +# +# + +# A special note: if you need `./configure --prefix=/usr/GNUstep' +# (/usr/GNUstep being replaced by your GNUSTEP_SYSTEM_ROOT) to be run +# before compilation (usually only needed for GNUstep core libraries +# themselves), define the following make variable: +# +# PACKAGE_NEEDS_CONFIGURE = YES +# +# in your makefile. + +# +# At this point, typing +# `make dist' will generate the .tgz (can be used outside rpm.make) +# `make specfile' will generate the (matching) specfile. +# + +# +# Debugging packages. +# + +# +# A debugging package is called $(PACKAGE_NAME)-debug-$(VERSION) rather +# than $(PACKAGE_NAME)-$(VERSION). The source .tgz have the same name +# though. The source rpm package instead has a different name because +# it contains the .spec file, which is different between debug and +# non debug version. +# +# To build the spec for the debugging package, type `make debug=yes specfile'. +# This builds a specfile as for the non-debugging package, except: +# +# It uses $(PACKAGE_NAME)-debug.spec.in rather than +# ${PACKAGE_NAME).spec.in if found. (this allows you to customize +# package description, summary, release number, group for the +# debugging case). +# +# It will compile everything with debugging enabled when building the +# debugging package. +# +# It will manage the package having a different name (eg +# Gomoku-debug-1.1.1) than the .tgz (eg Gomoku-1.1.1.tgz). +# +# Unless `standalone=yes' (ie, unless you create the specfile using +# `make debug=yes standalone=yes specfile') it will perform the following +# additional tasks: +# +# * build and install the non-debugging software before the debugging one; +# * remove from the debugging package all files already included in the +# non-debugging one (this is why it needs to build the non-debugging +# software first); +# * add a dependency of the debugging package from the non-debugging one. +# +# + +# +# As said before, if you are very lazy, typing something like +# +# make distclean +# `RPM_TOPDIR=/usr/src/redhat' make rpm +# +# will do the whole job once you have written your '.spec.in' file, +# and set the PACKAGE_NAME and VERSION variables in the makefile. +# The generated rpm will be in /usr/src/redhat/RPMS/. +# + +# prevent multiple inclusions +ifeq ($(RPM_MAKE_LOADED),) +RPM_MAKE_LOADED=yes + +# +# Internal targets +# + +# If we have been called with something like +# +# make INSTALL_ROOT_DIR=/var/tmp/package-build/ \ +# GNUSTEP_INSTALLATION_DIR=/var/tmp/package-build/usr/GNUstep/Local \ +# filelist=yes install +# +# we are being called inside the rpm installation stage, and we need +# to produce the file list from the installed files. + +ifeq ($(filelist),yes) + + # Build the file-list only at top level +# ifeq ($(MAKELEVEL),0) + + # Determine which file list to build + ifeq ($(debug),yes) + FILE_LIST = $(shell pwd)/file-list-debug + else + FILE_LIST = $(shell pwd)/file-list + endif + + # Remove the old file list before installing, and initialize the new one. + before-install:: + -rm -f $(FILE_LIST) + echo "%attr (-, root, root)" >> $(FILE_LIST) + + # install - done by other GNUmakefiles - NB: must install everything inside + # GNUSTEP_INSTALLATION_DIR, or prefix all installation dirs with + # $INSTALL_ROOT_DIR such as + # $(INSTALL_DATA) page.html $(INSTALL_ROOT_DIR)/usr/local/MySoftware/ + # instead of $(INSTALL_DATA) page.html /usr/local/MySoftware/ + + # Get the list of files inside GNUSTEP_INSTALL_BASE + internal-after-install:: + for file in `$(TAR) Pcf - $(INSTALL_ROOT_DIR) | $(TAR) t`; do \ + if [ -d "$$file" ]; then \ + echo "%dir $$file" > /dev/null; \ + else \ + echo "$$file" >> $(FILE_LIST); \ + fi; \ + done + sed -e "s|$(INSTALL_ROOT_DIR)||" $(FILE_LIST) > file-list.tmp + mv file-list.tmp $(FILE_LIST) + +# endif # MAKELEVEL + +endif # filelist == yes + + +# +# Manage debug vs non-debug +# +ifneq ($(debug), yes) + SPEC_FILE=$(PACKAGE_NAME).spec + SPEC_RULES_TEMPLATE=$(GNUSTEP_MAKEFILES)/spec-rules.template + SPEC_IN=$(PACKAGE_NAME).spec.in + SPEC_SCRIPT_IN=$(PACKAGE_NAME).script.spec.in + PACKAGE_EXTENSION="" +else + SPEC_FILE=$(PACKAGE_NAME)-debug.spec + ifeq ($(standalone),yes) + SPEC_RULES_TEMPLATE=$(GNUSTEP_MAKEFILES)/spec-debug-alone-rules.template + else + SPEC_RULES_TEMPLATE=$(GNUSTEP_MAKEFILES)/spec-debug-rules.template + endif + SPEC_IN=$(PACKAGE_NAME)-debug.spec.in + SPEC_SCRIPT_IN=$(PACKAGE_NAME)-debug.script.spec.in + PACKAGE_EXTENSION="-debug" +endif + +.PHONY: specfile rpm check-RPM_TOPDIR + +# +# The user will type `make specfile' to generate the specfile +# +specfile: $(SPEC_FILE) + +# +# Issue a warning if the $(PACKAGE_NAME)-debug.spec.in file is not found +# +$(PACKAGE_NAME)-debug.spec.in: + @echo "WARNING - $(PACKAGE_NAME)-debug.spec.in not found!" + @echo "You need to create it to build the debugging package." + @echo "If you already have a $(PACKAGE_NAME).spec.in, just take it as" + @echo "a start for the $(PACKAGE_NAME)-debug.spec.in - and make" + @echo "the little necessary changes in summary and description." + @echo "" + +# +# This is the real target - depends on having a correct .spec.in file +# +$(SPEC_FILE): $(SPEC_IN) + @echo "Generating the spec file..." + @-rm -f $@ + @echo "##" >> $@ + @echo "## Generated automatically by GNUstep make - do not edit!" >> $@ + @echo "## Edit the $(SPEC_IN) file instead" >> $@ + @echo "##" >> $@ + @echo " " >> $@ + @echo "## Code dynamically generated" >> $@ + @echo "%define gs_root $(GNUSTEP_SYSTEM_ROOT)" >> $@ + @echo "%define gs_install_dir $(GNUSTEP_INSTALLATION_DIR)" >> $@ + @echo "%define gs_name $(PACKAGE_NAME)" >> $@ + @echo "%define gs_version $(VERSION)" >> $@ +ifeq ($(PACKAGE_NEEDS_CONFIGURE),YES) + @echo "%define gs_configure YES" >> $@ +else + @echo "%define gs_configure NO" >> $@ +endif + @echo " " >> $@ + @echo "Name: %{gs_name}$(PACKAGE_EXTENSION)" >> $@ + @echo "Version: %{gs_version}" >> $@ + @echo "BuildRoot: /var/tmp/%{gs_name}-buildroot" >> $@ +ifeq ($(RPM_DISABLE_RELOCATABLE),YES) + @echo "Prefix: %{gs_install_dir}" >> $@ +endif +ifeq ($(debug),yes) +ifneq ($(standalone),yes) + @echo "requires: %{gs_name} = %{gs_version}" >> $@ +endif +endif + @echo "" >> $@ + @echo "## Code from $(SPEC_IN)" >> $@ + @cat $(SPEC_IN) >> $@ + @echo "" >> $@ + @echo "## Fixed rules from $(SPEC_RULES_TEMPLATE)" >> $@ + @cat $(SPEC_RULES_TEMPLATE) >> $@ + @ if [ -f $(SPEC_SCRIPT_IN) ]; then \ + echo "" >> $@; \ + echo "## Script rules from $(SPEC_SCRIPT_IN)" >> $@; \ + cat $(SPEC_SCRIPT_IN) >> $@; \ + fi + +check-RPM_TOPDIR: + @if [ "$(RPM_TOPDIR)" = "" ]; then \ + echo "I can't build the RPM if you do not set your RPM_TOPDIR"; \ + echo "shell variable"; \ + exit 1; \ + fi; + +rpm: check-RPM_TOPDIR dist specfile + @echo "Generating the rpm..."; +ifneq ($(RELEASE_DIR),) + @cp $(RELEASE_DIR)/$(PACKAGE_NAME)-$(VERSION).tar.gz \ + $(RPM_TOPDIR)/SOURCES/; +else + @cp ../$(PACKAGE_NAME)-$(VERSION).tar.gz $(RPM_TOPDIR)/SOURCES/; +endif + cp $(SPEC_FILE) $(RPM_TOPDIR)/SPECS/; \ + cd $(RPM_TOPDIR)/SPECS/; \ + rpm -ba $(SPEC_FILE) + +ifneq ($(PACKAGE_NAME),) +internal-distclean:: + rm -rf $(PACKAGE_NAME).spec $(PACKAGE_NAME)-debug.spec +endif + +endif +# rpm.make loaded + +## Local variables: +## mode: makefile +## End: diff --git a/Master/source-distribution.make b/Master/source-distribution.make new file mode 100644 index 00000000..742555e5 --- /dev/null +++ b/Master/source-distribution.make @@ -0,0 +1,162 @@ +# +# source-distribution.make +# +# Makefile rules to build snapshots from cvs, source .tar.gz etc +# +# Copyright (C) 2000, 2001 Free Software Foundation, Inc. +# +# Author: Adam Fedor +# Author: Nicola Pero +# +# This file is part of the GNUstep Makefile Package. +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# You should have received a copy of the GNU General Public +# License along with this library; see the file COPYING.LIB. +# If not, write to the Free Software Foundation, +# 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +# +# Interesting variables to define in your GNUmakefile: +# +# PACKAGE_NAME = gnustep-base +# VERSION = 1.0.0 +# +# For CVS exports, you may want to define something like: +# +# CVS_MODULE_NAME = base +# CVS_FLAGS = -d :pserver:anoncvs@subversions.gnu.org:/cvsroot/gnustep +# +# You can also pass/override them on the command line if you want, +# make cvs-snapshot CVS_FLAGS="-d :pserver:anoncvs@subversions.gnu.org:/cvsroot/gnustep -z9" +# +# If you set the RELEASE_DIR variable, all generated .tar.gz files will +# be automatically moved to that directory after having being created. +# RELEASE_DIR is either an absolute path, or a relative path to the +# current directory. +# + +# prevent multiple inclusions +ifeq ($(SOURCE_DISTRIBUTION_MAKE_LOADED),) +SOURCE_DISTRIBUTION_MAKE_LOADED=yes + +ifeq ($(CVS_MODULE_NAME),) + CVS_MODULE_NAME = $(PACKAGE_NAME) +endif + +ifeq ($(CVS_FLAGS),) + CVS_FLAGS = -z3 +endif + +VERSION_NAME = $(PACKAGE_NAME)-$(VERSION) + +VERTAG = `echo $(VERSION) | tr '.' '_'` + +.PHONY: dist cvs-tag cvs-dist cvs-snapshot internal-cvs-export + +# +# Build a .tgz with the whole directory tree +# +dist: distclean + @echo "Generating $(VERSION_NAME).tar.gz in the parent directory..."; \ + SNAPSHOT_DIR=`basename $$(pwd)`; \ + cd ..; \ + if [ "$$SNAPSHOT_DIR" != "$(VERSION_NAME)" ]; then \ + if [ -d "$(VERSION_NAME)" ]; then \ + echo "$(VERSION_NAME) already exists in parent directory (?):"; \ + echo "Saving old version in $(VERSION_NAME)~"; \ + mv $(VERSION_NAME) $(VERSION_NAME)~; \ + fi; \ + mv $$SNAPSHOT_DIR $(VERSION_NAME);\ + fi; \ + if [ -f ${VERSION_NAME}.tar.gz ]; then \ + echo "${VERSION_NAME}.tar.gz already exists:"; \ + echo "Saving old version in ${VERSION_NAME}.tar.gz~"; \ + mv ${VERSION_NAME}.tar.gz ${VERSION_NAME}.tar.gz~; \ + fi; \ + tar cfz $(VERSION_NAME).tar.gz $(VERSION_NAME); \ + if [ "$$SNAPSHOT_DIR" != "$(VERSION_NAME)" ]; then \ + mv $(VERSION_NAME) $$SNAPSHOT_DIR; \ + fi; \ + if [ ! -f $(VERSION_NAME).tar.gz ]; then \ + echo "*Error* creating .tar.gz"; \ + exit 1; \ + fi; +ifneq ($(RELEASE_DIR),) + @echo "Moving $(VERSION_NAME).tar.gz to $(RELEASE_DIR)..."; \ + if [ ! -d $(RELEASE_DIR) ]; then \ + $(MKDIRS) $(RELEASE_DIR); \ + fi; \ + if [ -f $(RELEASE_DIR)/$(VERSION_NAME).tar.gz ]; then \ + echo "$(RELEASE_DIR)/${VERSION_NAME}.tar.gz already exists:"; \ + echo "Saving old version in $(RELEASE_DIR)/${VERSION_NAME}.tar.gz~";\ + mv $(RELEASE_DIR)/${VERSION_NAME}.tar.gz \ + $(RELEASE_DIR)/${VERSION_NAME}.tar.gz~;\ + fi; \ + mv ../$(VERSION_NAME).tar.gz $(RELEASE_DIR) +endif + +# +# Tag the CVS source with the $(CVS_MODULE_NAME)-$(VERTAG) tag +# +cvs-tag: + cvs $(CVS_FLAGS) rtag $(CVS_MODULE_NAME)-$(VERTAG) $(CVS_MODULE_NAME) + +# +# Build a .tar.gz from the CVS sources using revision/tag +# $(CVS_MODULE_NAME)-$(VERTAG) +# +cvs-dist: EXPORT_CVS_FLAGS = -r $(CVS_MODULE_NAME)-$(VERTAG) +cvs-dist: internal-cvs-export + +# +# Build a .tar.gz from the CVS source as they are now +# +cvs-snapshot: EXPORT_CVS_FLAGS = -D now +cvs-snapshot: internal-cvs-export + +internal-cvs-export: + @echo "Exporting from module $(CVS_MODULE_NAME) on CVS..."; \ + if [ -e $(CVS_MODULE_NAME) ]; then \ + echo "*Error* cannot export: $(CVS_MODULE_NAME) already exists"; \ + exit 1; \ + fi; \ + cvs $(CVS_FLAGS) export $(EXPORT_CVS_FLAGS) $(CVS_MODULE_NAME); \ + echo "Generating $(VERSION_NAME).tar.gz"; \ + mv $(CVS_MODULE_NAME) $(VERSION_NAME); \ + if [ -f ${VERSION_NAME}.tar.gz ]; then \ + echo "${VERSION_NAME}.tar.gz already exists:"; \ + echo "Saving old version in ${VERSION_NAME}.tar.gz~"; \ + mv ${VERSION_NAME}.tar.gz ${VERSION_NAME}.tar.gz~; \ + fi; \ + tar cfz $(VERSION_NAME).tar.gz $(VERSION_NAME); \ + rm -rf $(VERSION_NAME); \ + if [ ! -f $(VERSION_NAME).tar.gz ]; then \ + echo "*Error* creating .tar.gz"; \ + exit 1; \ + fi; +ifneq ($(RELEASE_DIR),) + @echo "Moving $(VERSION_NAME).tar.gz to $(RELEASE_DIR)..."; \ + if [ ! -d $(RELEASE_DIR) ]; then \ + $(MKDIRS) $(RELEASE_DIR); \ + fi; \ + if [ -f $(RELEASE_DIR)/$(VERSION_NAME).tar.gz ]; then \ + echo "$(RELEASE_DIR)/${VERSION_NAME}.tar.gz already exists:"; \ + echo "Saving old version in $(RELEASE_DIR)/${VERSION_NAME}.tar.gz~";\ + mv $(RELEASE_DIR)/${VERSION_NAME}.tar.gz \ + $(RELEASE_DIR)/${VERSION_NAME}.tar.gz~;\ + fi; \ + mv $(VERSION_NAME).tar.gz $(RELEASE_DIR) +endif + +endif +# source-distribution.make loaded + +## Local variables: +## mode: makefile +## End: +