summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorColin Watson <cjwatson@debian.org>2014-01-14 02:08:51 +0000
committerColin Watson <cjwatson@debian.org>2014-01-14 02:08:51 +0000
commit06b1bc37b12028b5dba3635d5851639663dfc1e4 (patch)
tree96db5bb093c29515627524dc1e06cb2b26167cd0
parent38a03f9f9593a1185c8996ef1024346ae12224aa (diff)
Modify build system to work outside glibc
Forwarded: no Last-Update: 2012-06-22 Patch-Name: build-outside-glibc.patch
-rw-r--r--Makefile71
-rw-r--r--Versions9
2 files changed, 25 insertions, 55 deletions
diff --git a/Makefile b/Makefile
index ac08e78..ae4e1b5 100644
--- a/Makefile
+++ b/Makefile
@@ -20,54 +20,23 @@ libdb1-routines := bt_close bt_conv bt_debug bt_delete bt_get \
rec_close rec_delete rec_get rec_open rec_put rec_search \
rec_seq rec_utils
-db1-headers := db.h mpool.h ndbm.h
-distribute := compat.h \
- btree/btree.h btree/extern.h \
- hash/extern.h hash/hash.h hash/page.h \
- recno/extern.h recno/recno.h \
- $(db1-headers)
-
-include ../Makeconfig
-
-install-others := $(db1-headers:%=$(inst_includedir)/db1/%)
-
-ifeq (yes,$(build-shared))
-install-others += $(inst_slibdir)/libdb.so$(libdb1.so-version)
-endif
-
-$(inst_slibdir)/libdb.so$(libdb1.so-version): $(inst_slibdir)/libdb1-$(version).so $(+force)
- rm -f $@
- $(LN_S) $(<F) $@
-
-$(db1-headers:%=$(inst_includedir)/db1/%): $(inst_includedir)/db1/%: % $(+force)
- $(do-install)
-
-include ../Rules
-
-CPPFLAGS += -D__DBINTERFACE_PRIVATE -DUSE_LIBDB1
-
-# This file defines some static functions for alternative hash algorithms
-# that are not actually used.
-CFLAGS-hash_func.c := -Wno-unused
-
-# The db code outsmarts the compiler frequently.
-override CFLAGS += -Wno-uninitialized
-
-# Force the soname to be libdb.so for compatibility.
-LDFLAGS-db1.so = -Wl,-soname=lib$(libprefix)db.so$($(@F)-version)
-
-# Depend on libc.so so a DT_NEEDED is generated in the shared objects.
-# This ensures they will load libc.so for needed symbols if loaded by
-# a statically-linked program that hasn't already loaded it.
-$(objpfx)libdb1.so: $(objpfx)libdb1_pic.a $(+preinit) $(+postinit) $(+interp) \
- $(common-objpfx)libc.so
-
-#subdir_install: $(inst_libdir)/libndbm.a
-#$(inst_libdir)/libndbm.a: $(inst_libdir)/libdb1.a $(+force)
-# $(make-link)
-#
-#ifeq ($(build-shared),yes)
-#subdir_install: $(inst_libdir)/libndbm.so
-#$(inst_libdir)/libndbm.so: $(inst_libdir)/libdb1.so $(+force)
-# $(make-link)
-#endif
+CFLAGS ?= -O2
+XCPPFLAGS = -I. -D_REENTRANT -D__DBINTERFACE_PRIVATE -DUSE_LIBDB1 -D_GNU_SOURCE
+libdb.so-version=.2
+
+all: libdb1.so$(libdb.so-version)
+
+%.o: %.c
+ $(CC) $(XCPPFLAGS) $(CPPFLAGS) $(CFLAGS) -c -g -o $@ $<
+%.os: %.c
+ $(CC) $(XCPPFLAGS) $(CPPFLAGS) $(CFLAGS) -c -fPIC -o $@ $<
+
+libdb1.so$(libdb.so-version): $(patsubst %,%.os,$(libdb1-routines))
+ $(CC) -Wl,-O1 -Wl,--version-script=Versions -Wl,-z,combreloc \
+ -Wl,-soname=libdb.so$(libdb.so-version) $(LDFLAGS) \
+ -shared -o $@ $^ -lc
+
+clean:
+ rm -f $(patsubst %,%.o,$(libdb1-routines))
+ rm -f $(patsubst %,%.os,$(libdb1-routines))
+ rm -f libdb1.so$(libdb.so-version) *~
diff --git a/Versions b/Versions
index 479604e..87e34c4 100644
--- a/Versions
+++ b/Versions
@@ -1,10 +1,11 @@
-libdb1 {
- GLIBC_2.0 {
+GLIBC_2.0 {
+ global:
# the real DB entry point.
dbopen; __dbopen;
# The compatibility functions.
dbm_clearerr; dbm_close; dbm_delete; dbm_dirfno; dbm_error;
dbm_fetch; dbm_firstkey; dbm_nextkey; dbm_open; dbm_store;
- }
-}
+ local:
+ *;
+};