1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246
|
#!/usr/bin/make -f
# Luis Francisco Gonzalez
# Based on the rules file by Ian Jackson.
#
name=gdk-imlib
package=$(name)1
dev-package=$(name)-dev
nf_package=$(name)-nonfree1
nf_dev-package=$(name)-nonfree-dev
library=libgdk_imlib
version=$(shell expr `pwd` : '.*-\([0-9.]*\)')
version_major=$(shell expr `pwd` : '.*-\([0-9]*\).[0-9.]*')
INSTALL=/usr/bin/install
LN=/bin/ln
#
# To make this work I edited Makefile.in to add a flag called DEB_FLAGS
# that is defaulted to valid values so that make will work as expected
# when called from the topdir
#
build:
$(checkdir)
./configure --prefix=/usr
-mkdir shared static
#
# Build the shared libraries
#
cd shared; \
$(MAKE) -f ../Makefile VPATH=".." srcdir=".." \
DEB_FLAGS='-fPIC -D_REENTRANT -I.. -shared -pipe' \
SYS_CONFIG=/etc/im LDFLAGS="-lc -Wl,-soname,$(library).so.1"
#
# Build the static libraries
#
cd static ; \
$(MAKE) -f ../Makefile VPATH=".." srcdir=".." \
DEB_FLAGS="-D_REENTRANT -I.. -pipe" \
SYS_CONFIG=/etc/im \
LDFLAGS="-s -lc" \
`ls ../shared/*.o | sed -e 's/..\/shared\///g'` ;\
ar cr $(library).a `ls *.o` ;\
ranlib $(library).a
#
# Building the non-free versions
#
./configure --prefix=/usr --with-gif
-mkdir nf_shared nf_static
#
# Build the shared libraries
#
cd nf_shared; \
$(MAKE) -f ../Makefile VPATH=".." srcdir=".." \
DEB_FLAGS='-fPIC -D_REENTRANT -I.. -shared -pipe' \
SYS_CONFIG=/etc/im LDFLAGS="-lc -lgif -Wl,-soname,$(library).so.1"
#
# Build the static libraries
#
cd nf_static ; \
$(MAKE) -f ../Makefile VPATH=".." srcdir=".." \
DEB_FLAGS="-D_REENTRANT -I.. -pipe" \
SYS_CONFIG=/etc/im \
LDFLAGS="-s -lc -lgif" \
`ls ../nf_shared/*.o | sed -e 's/..\/nf_shared\///g'` ;\
ar cr $(library).a `ls *.o` ;\
ranlib $(library).a
touch build
clean:
$(checkdir)
-rm -f build
-make distclean
-rm -rf ./{shared,static,nf_shared,nf_static}
find . -name Makefile -exec rm {} \;
-rm -f `find . -name "*~"`
-rm -rf debian/substvars debian/$(package) debian/$(dev-package) \
debian/$(nf_package) debian/$(nf_dev-package)
binary-indep: checkroot build
$(checkdir)
# There are no binary-indep targets in this package
binary-arch: checkroot build
$(checkdir)
# Create directory structure (it assumes the package names above)
cd debian && install -d `cat dirs \
| sed "s/%package%/$(name)/g"`
#
# install free gdk-imlib
#
strip --strip-unneeded shared/$(library).so.$(version)
$(INSTALL) -m 644 shared/$(library).so.$(version) \
debian/$(package)/usr/lib
cd debian/$(package)/usr/lib && \
$(LN) -sf $(library).so.$(version) \
$(library).so.$(version_major)
cd debian/$(package)/usr/doc/ && \
$(LN) -sf imlib-base \
$(package)
# Install the control files
$(INSTALL) -d debian/$(package)/DEBIAN
$(INSTALL) -m 644 debian/control debian/$(package)/DEBIAN
$(INSTALL) -m 755 debian/postinst debian/$(package)/DEBIAN
#Build the shlib file
echo "$(library) $(version_major) $(package) (>=$(version)) | $(nf_package) (>=$(version)) " > \
debian/$(package)/DEBIAN/shlibs
#
# install non-free gdk-imlib
#
strip --strip-unneeded nf_shared/$(library).so.$(version)
$(INSTALL) -m 644 nf_shared/$(library).so.$(version) \
debian/$(nf_package)/usr/lib
cd debian/$(nf_package)/usr/lib && \
$(LN) -sf $(library).so.$(version) \
$(library).so.$(version_major)
cd debian/$(nf_package)/usr/doc/ && \
$(LN) -sf imlib-base \
$(nf_package)
# Install the control files
$(INSTALL) -d debian/$(nf_package)/DEBIAN
$(INSTALL) -m 644 debian/control debian/$(nf_package)/DEBIAN
$(INSTALL) -m 755 debian/postinst debian/$(nf_package)/DEBIAN
#Build the shlib file
echo "$(library) $(version_major) $(nf_package) (>=$(version)) | $(package) (>=$(version)) " > \
debian/$(nf_package)/DEBIAN/shlibs
#
# install free gdkimlib-dev
#
$(INSTALL) -m 644 gdk_imlib.h \
debian/$(dev-package)/usr/include/gdk_imlib.h
$(INSTALL) -m 644 gdk_imlib_private.h \
debian/$(dev-package)/usr/include/gdk_imlib_private.h
$(INSTALL) -m 644 gdk_imlib_types.h \
debian/$(dev-package)/usr/include/gdk_imlib_types.h
$(INSTALL) -m 644 static/$(library).a \
debian/$(dev-package)/usr/lib
cd debian/$(dev-package)/usr/lib && \
$(LN) -sf $(library).so.$(version_major) \
$(library).so
cd debian/$(dev-package)/usr/doc/ && \
$(LN) -sf imlib-base \
$(dev-package)
# Install the control files
$(INSTALL) -d debian/$(dev-package)/DEBIAN
$(INSTALL) -m 644 debian/control debian/$(dev-package)/DEBIAN
#
# install non-free gdkimlib-dev
#
$(INSTALL) -m 644 gdk_imlib.h \
debian/$(nf_dev-package)/usr/include/gdk_imlib.h
$(INSTALL) -m 644 gdk_imlib_private.h \
debian/$(nf_dev-package)/usr/include/gdk_imlib_private.h
$(INSTALL) -m 644 gdk_imlib_types.h \
debian/$(nf_dev-package)/usr/include/gdk_imlib_types.h
$(INSTALL) -m 644 static/$(library).a \
debian/$(nf_dev-package)/usr/lib
cd debian/$(nf_dev-package)/usr/lib && \
$(LN) -sf $(library).so.$(version_major) \
$(library).so
cd debian/$(nf_dev-package)/usr/doc/ && \
$(LN) -sf imlib-base \
$(nf_dev-package)
# Install the control files
$(INSTALL) -d debian/$(nf_dev-package)/DEBIAN
$(INSTALL) -m 644 debian/control debian/$(nf_dev-package)/DEBIAN
#
# End the package building process
# Set ownerships and rights
chown -R root.root debian/$(package) \
debian/$(dev-package) \
debian/$(nf_package) \
debian/$(nf_dev-package)
chmod -R go=rX debian/$(package) \
debian/$(dev-package) \
debian/$(nf_package) \
debian/$(nf_dev-package)
chmod -R u+w debian/$(package) \
debian/$(dev-package) \
debian/$(nf_package) \
debian/$(nf_dev-package)
#
# Build free gdk-imlib
#
# Calculate Dependencies
dpkg-shlibdeps \
debian/$(package)/usr/lib/$(library).so.$(version)
dpkg-gencontrol -p$(package) -Pdebian/$(package)
cd debian/$(package) && \
find . -type f ! -regex "./DEBIAN/.*" -print0 | \
xargs -0 md5sum | \
sed -e '/\.\//s///' > DEBIAN/md5sums && \
chmod 644 DEBIAN/md5sums
dpkg --build debian/$(package) ..
#
# Build free gdk-imlib-dev
#
dpkg-gencontrol -p$(dev-package) -Pdebian/$(dev-package)
cd debian/$(dev-package) && \
find . -type f ! -regex "./DEBIAN/.*" -print0 | \
xargs -0 md5sum | \
sed -e '/\.\//s///' > DEBIAN/md5sums && \
chmod 644 DEBIAN/md5sums
dpkg --build debian/$(dev-package) ..
#
# Build non-free gdk-imlib
#
# Calculate Dependencies
dpkg-shlibdeps \
debian/$(nf_package)/usr/lib/$(library).so.$(version)
dpkg-gencontrol -p$(nf_package) -Pdebian/$(nf_package)
cd debian/$(nf_package) && \
find . -type f ! -regex "./DEBIAN/.*" -print0 | \
xargs -0 md5sum | \
sed -e '/\.\//s///' > DEBIAN/md5sums && \
chmod 644 DEBIAN/md5sums
dpkg --build debian/$(nf_package) ..
#
# Build non-free gdk-imlib-dev
#
dpkg-gencontrol -p$(nf_dev-package) -Pdebian/$(nf_dev-package)
cd debian/$(nf_dev-package) && \
find . -type f ! -regex "./DEBIAN/.*" -print0 | \
xargs -0 md5sum | \
sed -e '/\.\//s///' > DEBIAN/md5sums && \
chmod 644 DEBIAN/md5sums
dpkg --build debian/$(nf_dev-package) ..
define checkdir
test -f debian/rules
endef
# Below here is fairly generic really
binary: binary-indep binary-arch
source diff:
@echo >&2 'source and diff are obsolete - use dpkg-source -b'; false
checkroot:
$(checkdir)
test root = "`whoami`"
.PHONY: binary binary-arch binary-indep clean checkroot
|