From caed118e7f5ef04124cbf1c20206c8b83e1cc910 Mon Sep 17 00:00:00 2001 From: Andres Freund Date: Thu, 11 Feb 2016 10:10:08 +0100 Subject: [PATCH 1/5] Fix make install for VPATH builds. copy_to_distributed_table is in the source, not the build directory. As there might be scripts in either at some point, install scripts from both. --- Makefile.global.in | 3 +++ src/backend/distributed/Makefile | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/Makefile.global.in b/Makefile.global.in index 60b3d31f0..0aff9236d 100644 --- a/Makefile.global.in +++ b/Makefile.global.in @@ -19,6 +19,9 @@ vpath_build=@vpath_build@ ifeq ($(vpath_build),yes) VPATH:=$(citus_abs_srcdir) USE_VPATH:=$(VPATH) + citus_top_srcdir:=$(citus_abs_top_srcdir) +else + citus_top_srcdir:=$(citus_top_builddir) endif # Citus is built using PostgreSQL's pgxs diff --git a/src/backend/distributed/Makefile b/src/backend/distributed/Makefile index 8f4bd899a..b01a9d01c 100644 --- a/src/backend/distributed/Makefile +++ b/src/backend/distributed/Makefile @@ -7,7 +7,8 @@ MODULE_big = citus EXTENSION = citus EXTVERSION = 5.0 DATA_built = $(EXTENSION)--$(EXTVERSION).sql -SCRIPTS = $(wildcard $(citus_top_builddir)/src/bin/scripts/*) +# Install scripts in build and/or source directory, but only once if those are the same +SCRIPTS = $(sort $(wildcard $(citus_top_builddir)/src/bin/scripts/* $(citus_top_srcdir)/src/bin/scripts/*)) # directories with source files SUBDIRS = . commands executor master planner relay test utils worker From 62b9bca96b48cc586395dd4bff6ad1aef3b4acf5 Mon Sep 17 00:00:00 2001 From: Andres Freund Date: Thu, 11 Feb 2016 12:01:27 +0100 Subject: [PATCH 2/5] Don't use autoconf's default CFLAGS. We just want PosgreSQL's defaults, not autoconf's (-g -O2). Currently, these are wrong when PostgreSQL has been compiled with e.g. -O0. --- configure | 5 ++++- configure.in | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/configure b/configure index aaf84be6a..8c418df55 100755 --- a/configure +++ b/configure @@ -1893,7 +1893,9 @@ fi # Allow to overwrite the C compiler, default to the one postgres was -# compiled with +# compiled with. We don't want autoconf's default CFLAGS though, so save +# those. +SAVE_CFLAGS="$CFLAGS" ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' @@ -2491,6 +2493,7 @@ ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu +CFLAGS="$SAVE_CFLAGS" # check for a number of CFLAGS that make development easier diff --git a/configure.in b/configure.in index 5248f36f5..7ef13e2eb 100644 --- a/configure.in +++ b/configure.in @@ -52,8 +52,11 @@ fi AC_SUBST(vpath_build) # Allow to overwrite the C compiler, default to the one postgres was -# compiled with +# compiled with. We don't want autoconf's default CFLAGS though, so save +# those. +SAVE_CFLAGS="$CFLAGS" AC_PROG_CC([$($PG_CONFIG --cc)]) +CFLAGS="$SAVE_CFLAGS" # check for a number of CFLAGS that make development easier From 2393a449278517bf2271ce37cf406398c151a019 Mon Sep 17 00:00:00 2001 From: Andres Freund Date: Tue, 16 Feb 2016 11:01:23 +0100 Subject: [PATCH 3/5] Add deps from toplevel install to build targets Otherwise a parallel 'make install' can end up trying to build the same targets twice, once via the normal build rules ('all') and once via install. --- Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 191a6e6f7..93a3ce457 100644 --- a/Makefile +++ b/Makefile @@ -15,9 +15,9 @@ all: extension csql # build extension extension: $(MAKE) -C src/backend/distributed/ all -install-extension: +install-extension: extension $(MAKE) -C src/backend/distributed/ install -install-headers: +install-headers: extension $(MKDIR_P) '$(includedir_server)/distributed/' # generated headers are located in the build directory $(INSTALL_DATA) src/include/citus_config.h '$(includedir_server)/' @@ -33,7 +33,7 @@ clean: clean-extension # build csql binary csql: $(MAKE) -C src/bin/csql/ all -install-csql: +install-csql: csql $(MAKE) -C src/bin/csql/ install clean-csql: $(MAKE) -C src/bin/csql/ clean From 0c57a1a04eef078ba5eb8d38883fbabe326f58f9 Mon Sep 17 00:00:00 2001 From: Andres Freund Date: Tue, 16 Feb 2016 12:45:59 +0100 Subject: [PATCH 4/5] Make 'all' default src/backend/distributed target Otherwise typing 'make' will just build citusdb--5.0.sql, not particularly helpful. --- src/backend/distributed/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/backend/distributed/Makefile b/src/backend/distributed/Makefile index b01a9d01c..052800bbe 100644 --- a/src/backend/distributed/Makefile +++ b/src/backend/distributed/Makefile @@ -18,13 +18,13 @@ SUBDIRS = . commands executor master planner relay test utils worker OBJS += \ $(patsubst $(citus_abs_srcdir)/%.c,%.o,$(foreach dir,$(SUBDIRS), $(wildcard $(citus_abs_srcdir)/$(dir)/*.c))) +# be explicit about the default target +all: + # define build process for latest install file $(EXTENSION)--$(EXTVERSION).sql: $(EXTENSION).sql cat $^ > $@ -# be explicit about the default target -all: - NO_PGXS = 1 SHLIB_LINK = $(libpq) From 37d5b1c1501cd6f288631b9749d512cede052bb3 Mon Sep 17 00:00:00 2001 From: Andres Freund Date: Tue, 16 Feb 2016 13:00:21 +0100 Subject: [PATCH 5/5] Fix Makefile.global/configure regeneration These dependencies previously didn't result in regeneration when using a source directory build. --- Makefile.global.in | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Makefile.global.in b/Makefile.global.in index 0aff9236d..9fc3459ab 100644 --- a/Makefile.global.in +++ b/Makefile.global.in @@ -35,17 +35,17 @@ include $(PGXS) # with some outdated Makefile.global. # Make internally restarts whenever included Makefiles are # regenerated. -$(citus_top_builddir)/Makefile.global: $(citus_top_builddir)/Makefile.global.in @top_srcdir@/configure $(citus_top_builddir)/config.status +$(citus_top_builddir)/Makefile.global: $(citus_abs_top_srcdir)/configure $(citus_top_builddir)/Makefile.global.in $(citus_top_builddir)/config.status cd @abs_top_builddir@ && ./config.status Makefile.global # Ensure configuration is generated by the most recent configure, # useful for longer existing build directories. -$(citus_top_builddir)/config.status: @top_srcdir@/configure +$(citus_top_builddir)/config.status: $(citus_abs_top_srcdir)/configure cd @abs_top_builddir@ && ./config.status --recheck # Regenerate configure if configure.in changed -@top_srcdir@/configure: $(citus_abs_srcdir)/configure.in - cd ${citus_abs_srcdir} && ./autogen.sh +$(citus_abs_top_srcdir)/configure: $(citus_abs_top_srcdir)/configure.in + cd ${citus_abs_top_srcdir} && ./autogen.sh # If specified via configure, replace the default compiler. Normally # we'll build with the one postgres was built with. But it's useful to