~ubuntu-branches/ubuntu/karmic/firebird2.1/karmic

« back to all changes in this revision

Viewing changes to builds/install/arch-specific/linux/Makefile.in

  • Committer: Bazaar Package Importer
  • Author(s): Damyan Ivanov
  • Date: 2008-05-26 23:59:25 UTC
  • Revision ID: james.westby@ubuntu.com-20080526235925-2pnqj6nxpppoeaer
Tags: upstream-2.1.0.17798-0.ds2
ImportĀ upstreamĀ versionĀ 2.1.0.17798-0.ds2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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
 
7
 
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 
 
13
 
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.
 
18
 
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 
 
23
# history command.
 
24
#
 
25
#  Created by:  Mark O'Donohue <mark.odonohue@ludwig.edu.au>
 
26
#
 
27
#  Contributor(s):
 
28
 
29
#
 
30
ROOT=..
 
31
 
 
32
 
 
33
 
 
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
 
38
 
 
39
 
 
40
FirebirdInstallPrefix=@prefix@
 
41
 
 
42
 @SET_MAKE@
 
43
 
 
44
FIREBIRD=$(FirebirdInstallPrefix)
 
45
 
 
46
export -n FIREBIRD
 
47
export -n INTERBASE
 
48
 
 
49
.PHONY: install dist packages tarfile rpmfile 
 
50
.PHONY: buildTarDir buildImageDir buildRoot buildDebugInfo
 
51
 
 
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.
 
56
 
 
57
BuildRoot=$(GEN_ROOT)
 
58
 
 
59
InstallRoot=.
 
60
 
 
61
 
 
62
FirebirdBuildPrefix=$(GEN_ROOT)
 
63
 
 
64
#export FirebirdBuildPrefix
 
65
#export FirebirdInstallPrefix
 
66
#export PackageVersion
 
67
 
 
68
BuildVersion=$(FirebirdVersion).$(BuildNum)
 
69
 
 
70
Version=$(BuildVersion)-$(PackageVersion)
 
71
 
 
72
 
 
73
 
 
74
# This means something like: FirebirdCS-2.0.0-1.i386.tar.gz
 
75
 
 
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
 
81
 
 
82
 
 
83
# Determine where the packages are built.  Each distribution builds them in
 
84
# their own spot.
 
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)
 
89
 
 
90
PackageDir:=$(shell if [ -d $(RedhatPackageDir) ]; then echo $(RedhatPackageDir); \
 
91
                           elif [ -d $(MandrakePackageDir) ]; then echo $(MandrakePackageDir); \
 
92
                           elif [ -d $(SuSEPackageDir) ]; then echo $(SuSEPackageDir); \
 
93
                                   fi)
 
94
 
 
95
 
 
96
 
 
97
PkgSrcDir=$(InstallRoot)/$(ArchType)
 
98
ScriptDir=$(GEN_ROOT)/install/scripts/
 
99
RPMSrcDir=$(GEN_ROOT)/install/scripts
 
100
 
 
101
 
 
102
TarInstallDir=$(GEN_ROOT)/install
 
103
 
 
104
#Target for required libraries detection
 
105
RpmRequiredVersionTarget=$(GEN_ROOT)/firebird/bin/isql
 
106
#Curses library
 
107
TermLib=@TERMLIB@.so
 
108
 
 
109
 
 
110
dist : packages
 
111
 
 
112
packages: tarfile rpmfile debugfile
 
113
 
 
114
tarfile:  $(TarFile)
 
115
 
 
116
$(TarFile) :  buildTarDir
 
117
        (cd $(GEN_ROOT); tar -czf $(TarFile) $(TarDir))
 
118
 
 
119
debugfile:  $(DebugFile)
 
120
 
 
121
$(DebugFile) :  buildImageDir
 
122
        (cd $(GEN_ROOT)/$(DebugDir); tar -czf ../$(DebugFile) *)
 
123
 
 
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.
 
132
#
 
133
#     28-Dec-2003. Nickolay Samofatov
 
134
#
 
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.
 
138
#
 
139
#     05-Apr-2004. Nickolay Samofatov
 
140
#
 
141
 
 
142
buildRoot:
 
143
        (cd $(GEN_ROOT); ./install/makeInstallImage.sh)
 
144
 
 
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; \
 
156
            else \
 
157
                echo Failed to set debug link for $${x}; \
 
158
            fi; \
 
159
            echo Stripping unneeded symbols from $${x}; \
 
160
            objcopy --strip-debug --strip-unneeded $${FIL}; \
 
161
        fi; \
 
162
    done
 
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; \
 
167
    done
 
168
 
 
169
# Use this line if you don't want to use separate debug info
 
170
#buildImageDir: buildRoot
 
171
buildImageDir: buildDebugInfo
 
172
 
 
173
 
 
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 )
 
181
 
 
182
 
 
183
install: buildTarDir
 
184
        (cd $(GEN_ROOT)/$(TarDir); ./install.sh)
 
185
        cp -r $(GEN_ROOT)/$(DebugDir)/* /
 
186
 
 
187
 
 
188
rpmfile: $(RPMFile)
 
189
 
 
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)
 
194
 
 
195
 
 
196
.PHONY: $(GEN_ROOT)/install/rpmscript
 
197
 
 
198
$(GEN_ROOT)/install/rpmscript :
 
199
        echo $@
 
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;}' >> $@
 
204
        echo "" >> $@
 
205
        echo "%prep" >> $@
 
206
#       cat $(ClassicSrcDir)/prepinstall.sh >> $@
 
207
        echo "" >> $@
 
208
        echo "%build" >> $@
 
209
#       cat $(ScriptDir)/buildinstall.sh >> $@
 
210
        echo "" >> $@
 
211
        echo "%install" >> $@
 
212
#       cat $(ScriptDir)/install.sh >> $@
 
213
        echo "" >> $@
 
214
        echo "%files" >> $@
 
215
        cat $(RPMSrcDir)/rpmfiles.txt >> $@
 
216
        echo "" >> $@
 
217
        echo "%pre" >> $@
 
218
        cat $(ScriptDir)/preinstall.sh >> $@
 
219
        echo "" >> $@
 
220
        echo "%post" >> $@
 
221
        cat $(ScriptDir)/postinstall.sh >> $@
 
222
        echo "" >> $@
 
223
        echo "%preun" >> $@
 
224
        cat $(ScriptDir)/preuninstall.sh >> $@
 
225
        echo "" >> $@
 
226
        echo "%postun" >> $@
 
227
        cat $(ScriptDir)/postuninstall.sh >> $@