Well, this patch makes Makefile for contrib/rserv use the
contrib/contrib-global.mk library and _generally_ behave like Makefiles for other contrib modules. Besides it fixes Perl's interpolation of $libdir variable, which should be passed to backend instead. This patch is done against PostgreSQL 7.3b2 Besides, I want to thank Peter Eisentraut for his very friendly and helpful attitude and politely ask him to check whether contrib modules actually continue to work after he implements another major change to their build process. Alexey Borzov
This commit is contained in:
parent
33a6b67b51
commit
0215dc9b0f
@ -6,47 +6,33 @@ top_builddir = ../..
|
|||||||
include $(top_builddir)/src/Makefile.global
|
include $(top_builddir)/src/Makefile.global
|
||||||
|
|
||||||
NAME = rserv
|
NAME = rserv
|
||||||
SONAME = $(NAME)$(DLSUFFIX)
|
MODULES = rserv
|
||||||
SQLS = master.sql slave.sql
|
DATA = RServ.pm
|
||||||
TCLS = RservTest
|
DATA_built = master.sql slave.sql
|
||||||
PERLS = MasterInit MasterAddTable Replicate MasterSync CleanLog
|
SQLS = $(DATA_built)
|
||||||
PERLS += SlaveInit SlaveAddTable GetSyncID
|
DOCS = README.rserv
|
||||||
PERLS += PrepareSnapshot ApplySnapshot
|
SCRIPTS = RservTest
|
||||||
SCRIPTS = InitRservTest
|
SCRIPTS += MasterInit MasterAddTable Replicate MasterSync CleanLog
|
||||||
|
SCRIPTS += SlaveInit SlaveAddTable GetSyncID
|
||||||
|
SCRIPTS += PrepareSnapshot ApplySnapshot
|
||||||
|
SCRIPTS += InitRservTest
|
||||||
|
EXTRA_CLEAN = $(SCRIPTS)
|
||||||
|
|
||||||
override CPPFLAGS := -I$(srcdir) $(CPPFLAGS)
|
override CPPFLAGS := -I$(srcdir) $(CPPFLAGS)
|
||||||
override CFLAGS += $(CFLAGS_SL)
|
override CFLAGS += $(CFLAGS_SL)
|
||||||
SHLIB_LINK = $(BE_DLLLIBS)
|
SHLIB_LINK = $(BE_DLLLIBS)
|
||||||
|
|
||||||
|
|
||||||
all: $(SQLS) $(TCLS) $(PERLS) $(SCRIPTS) $(SONAME)
|
all: $(SCRIPTS) $(SQLS) $(addsuffix $(DLSUFFIX), $(MODULES))
|
||||||
|
|
||||||
%.sql: %.sql.in
|
$(SQLS): %.sql: %.sql.in
|
||||||
sed 's,@MODULE_FILENAME@,$$libdir/$(NAME),g' $< >$@
|
sed 's,@MODULE_FILENAME@,$$libdir/$(NAME),g' $< >$@
|
||||||
|
|
||||||
$(PERLS) $(TCLS) $(SCRIPTS): %: %.in
|
$(SCRIPTS): %: %.in
|
||||||
sed -e 's,@MODULE_FILENAME@,$$libdir/$(NAME),g' \
|
sed -e 's,@MODULE_FILENAME@,$$libdir/$(NAME),g' \
|
||||||
-e 's:@SQLDIR@:$(datadir)/contrib:g' \
|
-e 's:@SQLDIR@:$(datadir)/contrib:g' \
|
||||||
-e 's:@BINDIR@:$(bindir):g' \
|
-e 's:@BINDIR@:$(bindir):g' \
|
||||||
-e 's:@LIBDIR@:$(datadir)/contrib:g' $< >$@
|
-e 's:@LIBDIR@:$(datadir)/contrib:g' $< >$@
|
||||||
chmod a+x $@
|
chmod a+x $@
|
||||||
|
|
||||||
|
include $(top_srcdir)/contrib/contrib-global.mk
|
||||||
install: all installdirs
|
|
||||||
for file in $(SQLS); do \
|
|
||||||
$(INSTALL_DATA) $$file $(DESTDIR)$(datadir)/contrib || exit ; \
|
|
||||||
done
|
|
||||||
for file in $(TCLS) $(PERLS) $(SCRIPTS); do \
|
|
||||||
$(INSTALL_SCRIPT) $$file $(DESTDIR)$(bindir) || exit ; \
|
|
||||||
done
|
|
||||||
$(INSTALL_DATA) $(srcdir)/RServ.pm $(DESTDIR)$(datadir)/contrib
|
|
||||||
$(INSTALL_SHLIB) $(SONAME) $(DESTDIR)$(pkglibdir)
|
|
||||||
$(INSTALL_DATA) $(srcdir)/README.$(NAME) $(DESTDIR)$(docdir)/contrib
|
|
||||||
|
|
||||||
installdirs:
|
|
||||||
$(mkinstalldirs) $(DESTDIR)$(bindir) $(DESTDIR)$(datadir)/contrib \
|
|
||||||
$(DESTDIR)$(pkglibdir) $(DESTDIR)$(docdir)/contrib
|
|
||||||
|
|
||||||
|
|
||||||
clean distclean maintainer-clean:
|
|
||||||
rm -f $(SQLS) $(TCLS) $(PERLS) $(SCRIPTS) $(SONAME) $(NAME).o
|
|
||||||
|
@ -22,6 +22,8 @@ if (defined($opt_help) || (scalar(@ARGV) < 1)) {
|
|||||||
exit ((scalar(@ARGV) < 1)? 1:0);
|
exit ((scalar(@ARGV) < 1)? 1:0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
my $module_filename = '@MODULE_FILENAME@';
|
||||||
|
|
||||||
my $master = $ARGV[0] || "master";
|
my $master = $ARGV[0] || "master";
|
||||||
|
|
||||||
my $minfo = "dbname=$master";
|
my $minfo = "dbname=$master";
|
||||||
@ -90,15 +92,15 @@ $result = $conn->exec("create sequence _rserv_sync_seq_");
|
|||||||
RollbackAndQuit($conn) if ($result->resultStatus ne PGRES_COMMAND_OK);
|
RollbackAndQuit($conn) if ($result->resultStatus ne PGRES_COMMAND_OK);
|
||||||
|
|
||||||
$result = $conn->exec("CREATE FUNCTION _rserv_log_() RETURNS trigger" .
|
$result = $conn->exec("CREATE FUNCTION _rserv_log_() RETURNS trigger" .
|
||||||
" AS '@MODULE_FILENAME@' LANGUAGE 'c'");
|
" AS '$module_filename' LANGUAGE 'c'");
|
||||||
RollbackAndQuit($conn) if ($result->resultStatus ne PGRES_COMMAND_OK);
|
RollbackAndQuit($conn) if ($result->resultStatus ne PGRES_COMMAND_OK);
|
||||||
|
|
||||||
$result = $conn->exec("CREATE FUNCTION _rserv_sync_(int4) RETURNS int4" .
|
$result = $conn->exec("CREATE FUNCTION _rserv_sync_(int4) RETURNS int4" .
|
||||||
" AS '@MODULE_FILENAME@' LANGUAGE 'c'");
|
" AS '$module_filename' LANGUAGE 'c'");
|
||||||
RollbackAndQuit($conn) if ($result->resultStatus ne PGRES_COMMAND_OK);
|
RollbackAndQuit($conn) if ($result->resultStatus ne PGRES_COMMAND_OK);
|
||||||
|
|
||||||
$result = $conn->exec("CREATE FUNCTION _rserv_debug_(int4) RETURNS int4" .
|
$result = $conn->exec("CREATE FUNCTION _rserv_debug_(int4) RETURNS int4" .
|
||||||
" AS '@MODULE_FILENAME@' LANGUAGE 'c'");
|
" AS '$module_filename' LANGUAGE 'c'");
|
||||||
RollbackAndQuit($conn) if ($result->resultStatus ne PGRES_COMMAND_OK);
|
RollbackAndQuit($conn) if ($result->resultStatus ne PGRES_COMMAND_OK);
|
||||||
|
|
||||||
$result = $conn->exec("COMMIT");
|
$result = $conn->exec("COMMIT");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user