1
# This library is free software; you can redistribute it and/or
2
# modify it under the terms of the GNU Lesser General Public
3
# License as published by the Free Software Foundation; either
4
# version 2.1 of the License, or (at your option) any later version.
5
# You may obtain a copy of the Licence at
6
# http://www.gnu.org/licences/lgpl.html
8
# As a special exception this file can also be included in modules
9
# with other source code as long as that source code has been
10
# released under an Open Source Initiative certificed licence.
11
# More information about OSI certification can be found at:
12
# http://www.opensource.org
14
# This module is distributed in the hope that it will be useful,
15
# but WITHOUT ANY WARRANTY; without even the implied warranty of
16
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17
# GNU Lesser General Public Licence for more details.
19
# This module was created by members of the firebird development
20
# team. All individual contributions remain the Copyright (C) of
21
# those individuals and all rights are reserved. Contributors to
22
# this file are either listed below or can be obtained from a CVS
25
# Created by: Mark O'Donohue <mark.odonohue@ludwig.edu.au>
34
include $(ROOT)/gen/make.defaults
35
include $(ROOT)/gen/make.platform
36
include $(ROOT)/gen/make.rules
37
include $(ROOT)/gen/make.shared.variables
40
FirebirdInstallPrefix=@prefix@
44
FIREBIRD=$(FirebirdInstallPrefix)
49
.PHONY: install dist packages tarfile rpmfile
50
.PHONY: buildTarDir buildImageDir buildRoot buildDebugInfo
52
# Some of these targets are run from the root tree of the build.
53
# those need to know where the install subdirectory is kept.
54
# Others are run locally these need to know the path back to the
55
# root of the build tree.
62
FirebirdBuildPrefix=$(GEN_ROOT)
64
#export FirebirdBuildPrefix
65
#export FirebirdInstallPrefix
66
#export PackageVersion
68
BuildVersion=$(FirebirdVersion).$(BuildNum)
70
Version=$(BuildVersion)-$(PackageVersion)
74
# This means something like: FirebirdCS-2.0.0-1.i386.tar.gz
76
TarDir= Firebird$(ArchPrefix)-$(Version).$(CpuType)
77
TarFile=Firebird$(ArchPrefix)-$(Version).$(CpuType).tar.gz
78
RPMFile=Firebird$(ArchPrefix)-$(Version).$(CpuType).rpm
79
DebugDir=Firebird$(ArchPrefix)-debuginfo-$(Version).$(CpuType)
80
DebugFile=Firebird$(ArchPrefix)-debuginfo-$(Version).$(CpuType).tar.gz
83
# Determine where the packages are built. Each distribution builds them in
85
# This should be moved to configure.in file
86
RedhatPackageDir=/usr/src/redhat/RPMS/$(CpuType)
87
MandrakePackageDir=/usr/src/RPM/RPMS/$(CpuType)
88
SuSEPackageDir=/usr/src/packages/RPMS/$(CpuType)
90
PackageDir:=$(shell if [ -d $(RedhatPackageDir) ]; then echo $(RedhatPackageDir); \
91
elif [ -d $(MandrakePackageDir) ]; then echo $(MandrakePackageDir); \
92
elif [ -d $(SuSEPackageDir) ]; then echo $(SuSEPackageDir); \
97
PkgSrcDir=$(InstallRoot)/$(ArchType)
98
ScriptDir=$(GEN_ROOT)/install/scripts/
99
RPMSrcDir=$(GEN_ROOT)/install/scripts
102
TarInstallDir=$(GEN_ROOT)/install
104
#Target for required libraries detection
105
RpmRequiredVersionTarget=$(GEN_ROOT)/firebird/bin/isql
112
packages: tarfile rpmfile debugfile
116
$(TarFile) : buildTarDir
117
(cd $(GEN_ROOT); tar -czf $(TarFile) $(TarDir))
119
debugfile: $(DebugFile)
121
$(DebugFile) : buildImageDir
122
(cd $(GEN_ROOT)/$(DebugDir); tar -czf ../$(DebugFile) *)
124
# objcopy --add-gnu-debuglink fails with binutils 2.14 or older
125
# its failure affects only GDB ability to pick up external debug
126
# symbols automatically. We may use eu-strip command from elfutils
127
# instead, but it doesn't work or compile with such distros
128
# as Mandrake 9.0 not saying about older ones. New binutils
129
# seem to compile and work everywhere I tried, but we try to
130
# use eu-strip first since it is a part of default Red Hat 9
131
# install and is available in binary form for Mandrake 9.1 and newer.
133
# 28-Dec-2003. Nickolay Samofatov
135
# Do not use eu-strip any longer because version 0.89/AMD64 shipped with
136
# Mandrake 9.2 produces broken debuginfo packages and there is no easy way to
137
# detect the breakage. Binutils seem to be more reliable alternative to me.
139
# 05-Apr-2004. Nickolay Samofatov
143
(cd $(GEN_ROOT); ./install/makeInstallImage.sh)
145
buildDebugInfo: buildRoot
146
mkdir -p $(GEN_ROOT)/$(DebugDir)
147
for x in `(cd $(GEN_ROOT)/buildroot; find)`; do \
148
FIL=$(GEN_ROOT)/buildroot/$$x; \
149
D_FIL=$(GEN_ROOT)/$(DebugDir)/`dirname $${x}`/.debug/`basename $${x}`.debug; \
150
if [ ! -h $$FIL ] && readelf -h $$FIL > /dev/null 2> /dev/null; then \
151
mkdir -p $(GEN_ROOT)/$(DebugDir)/`dirname $$x`/.debug; \
152
echo Generating external debug info for $$x; \
153
cp $${FIL} $${D_FIL}; \
154
if objcopy --add-gnu-debuglink $${D_FIL} $${FIL}; > /dev/null 2> /dev/null; then \
155
echo Succeeded using objcopy from binutils; \
157
echo Failed to set debug link for $${x}; \
159
echo Stripping unneeded symbols from $${x}; \
160
objcopy --strip-debug --strip-unneeded $${FIL}; \
163
# Work around GDB 6.0 bug
164
mkdir -p $(GEN_ROOT)/$(DebugDir)@libdir@/.debug
165
for x in `ls $(GEN_ROOT)/$(DebugDir)@prefix@/lib/.debug`; do \
166
ln -f -s @prefix@/lib/.debug/`basename $$x` $(GEN_ROOT)/$(DebugDir)@libdir@/.debug; \
169
# Use this line if you don't want to use separate debug info
170
#buildImageDir: buildRoot
171
buildImageDir: buildDebugInfo
174
buildTarDir: buildImageDir
175
mkdir -p $(GEN_ROOT)/$(TarDir)
176
cp -r $(GEN_ROOT)/install/scripts $(GEN_ROOT)/$(TarDir)
177
cp -r $(GEN_ROOT)/install/scripts/tarMainInstall.sh $(GEN_ROOT)/$(TarDir)/install.sh
178
chmod a+x $(GEN_ROOT)/$(TarDir)/install.sh $(GEN_ROOT)/$(TarDir)/scripts/*sh
179
(cd $(GEN_ROOT)/$(TarDir); tar -C ../buildroot -czf buildroot.tar.gz . )
180
(cd $(GEN_ROOT)/$(TarDir); tar -tzf buildroot.tar.gz > manifest.txt )
184
(cd $(GEN_ROOT)/$(TarDir); ./install.sh)
185
cp -r $(GEN_ROOT)/$(DebugDir)/* /
190
$(RPMFile) : $(GEN_ROOT)/install/rpmscript buildImageDir
191
rpmbuild --define='_topdir @BUILD_ROOT_DIR@/gen/RPM' -bb --target @CPU_TYPE@ $(GEN_ROOT)/install/rpmscript
192
# rpmbuild -bb --buildroot `pwd`/buildroot $(GEN_ROOT)/rpmscript
193
cp @BUILD_ROOT_DIR@/gen/RPM/RPMS/@CPU_TYPE@/$(RPMFile) $(GEN_ROOT)
196
.PHONY: $(GEN_ROOT)/install/rpmscript
198
$(GEN_ROOT)/install/rpmscript :
200
awk < $(RPMSrcDir)/rpmheader.txt 'BEGIN {fl=1;} ($$1 == "Requires:") {fl=0;} (fl) {print $$0;}' > $@
201
echo -n "Requires: `ldd $(RpmRequiredVersionTarget) | grep $(TermLib) | awk '{print $$1;}'`" >> $@
202
echo ", `ldd $(RpmRequiredVersionTarget) | grep libstdc++ | awk '{print $$1;}'`" >> $@
203
awk < $(RPMSrcDir)/rpmheader.txt 'BEGIN {fl=0;} (fl) {print $$0;} ($$1 == "Requires:") {fl=1;}' >> $@
206
# cat $(ClassicSrcDir)/prepinstall.sh >> $@
209
# cat $(ScriptDir)/buildinstall.sh >> $@
211
echo "%install" >> $@
212
# cat $(ScriptDir)/install.sh >> $@
215
cat $(RPMSrcDir)/rpmfiles.txt >> $@
218
cat $(ScriptDir)/preinstall.sh >> $@
221
cat $(ScriptDir)/postinstall.sh >> $@
224
cat $(ScriptDir)/preuninstall.sh >> $@
227
cat $(ScriptDir)/postuninstall.sh >> $@