The command relies on a control
file for each extension, which must be named the same as the extension
with a suffix of .control>, and must be placed in the
- installation's SHAREDIR/contrib directory. There
+ installation's SHAREDIR/extension directory. There
must also be at least one
SQL> script file, which follows the
naming pattern
extension>-version>.sql
(for example, foo-1.0.sql> for version 1.0> of
extension foo>). By default, the script file(s) are also
- placed in the SHAREDIR/contrib directory; but the
+ placed in the SHAREDIR/extension directory; but the
control file can specify a different directory for the script file(s).
The directory containing the extension's
SQL> script
file(s). Unless an absolute path is given, the name is relative to
- the SHAREDIR/contrib directory.
+ the installation's SHAREDIR directory. The
+ default behavior is equivalent to specifying
+ directory = 'extension'>.
- MODULEDIR
+ EXTENSION
- subdirectory into which EXTENSION, DATA and DOCS files should be
- installed (if not set, default is contrib)
+ extension name(s); for each name you must provide an
+ extension.control file,
+ which will be installed into
+ prefix/share/extension
- EXTENSION
+ MODULEDIR
- extension name(s); for each name you must provide an
- extension.control file,
- which will be installed into
- prefix/share/$MODULEDIR
+ subdirectory of prefix>/share
+ into which DATA and DOCS files should be installed
+ (if not set, default is extension if
+ EXTENSION is set,
+ or contrib if not)
The name of the extension to be
installed.
PostgreSQL will create the
extension using details from the file
- SHAREDIR/contrib/extension.control.
+ SHAREDIR/extension/extension_name.control.
get_share_path(my_exec_path, sharepath);
result = (char *) palloc(MAXPGPATH);
- snprintf(result, MAXPGPATH, "%s/contrib", sharepath);
+ snprintf(result, MAXPGPATH, "%s/extension", sharepath);
return result;
}
get_share_path(my_exec_path, sharepath);
result = (char *) palloc(MAXPGPATH);
- snprintf(result, MAXPGPATH, "%s/contrib/%s.control",
+ snprintf(result, MAXPGPATH, "%s/extension/%s.control",
sharepath, extname);
return result;
/*
* The directory parameter can be omitted, absolute, or relative to the
- * control-file directory.
+ * installation's share directory.
*/
if (!control->directory)
return get_extension_control_directory();
get_share_path(my_exec_path, sharepath);
result = (char *) palloc(MAXPGPATH);
- snprintf(result, MAXPGPATH, "%s/contrib/%s",
- sharepath, control->directory);
+ snprintf(result, MAXPGPATH, "%s/%s", sharepath, control->directory);
return result;
}
#
# The following variables can also be set:
#
-# MODULEDIR -- subdirectory into which EXTENSION, DATA and DOCS files
-# should be installed (if not set, default is "contrib")
# EXTENSION -- name of extension (there must be a $EXTENSION.control file)
+# MODULEDIR -- subdirectory of $PREFIX/share into which DATA and DOCS files
+# should be installed (if not set, default is "extension" if EXTENSION
+# is set, or "contrib" if not)
# DATA -- random files to install into $PREFIX/share/$MODULEDIR
# DATA_built -- random files to install into $PREFIX/share/$MODULEDIR,
# which need to be built first
endif
ifdef MODULEDIR
-datamoduledir = $(MODULEDIR)
-docmoduledir = $(MODULEDIR)
+datamoduledir := $(MODULEDIR)
+docmoduledir := $(MODULEDIR)
else
-datamoduledir = contrib
-docmoduledir = contrib
+ifdef EXTENSION
+datamoduledir := extension
+docmoduledir := extension
+else
+datamoduledir := contrib
+docmoduledir := contrib
+endif
endif
ifdef PG_CPPFLAGS
install: all installdirs
-ifneq (,$(DATA)$(DATA_built)$(EXTENSION))
- @for file in $(addprefix $(srcdir)/, $(DATA)) $(DATA_built) $(addsuffix .control, $(EXTENSION)); do \
+ifneq (,$(EXTENSION))
+ @for file in $(addprefix $(srcdir)/, $(addsuffix .control, $(EXTENSION))); do \
+ echo "$(INSTALL_DATA) $$file '$(DESTDIR)$(datadir)/extension'"; \
+ $(INSTALL_DATA) $$file '$(DESTDIR)$(datadir)/extension'; \
+ done
+endif # EXTENSION
+ifneq (,$(DATA)$(DATA_built))
+ @for file in $(addprefix $(srcdir)/, $(DATA)) $(DATA_built); do \
echo "$(INSTALL_DATA) $$file '$(DESTDIR)$(datadir)/$(datamoduledir)'"; \
$(INSTALL_DATA) $$file '$(DESTDIR)$(datadir)/$(datamoduledir)'; \
done
uninstall:
-ifneq (,$(DATA)$(DATA_built)$(EXTENSION))
- rm -f $(addprefix '$(DESTDIR)$(datadir)/$(datamoduledir)'/, $(notdir $(DATA) $(DATA_built) $(addsuffix .control, $(EXTENSION))))
+ifneq (,$(EXTENSION))
+ rm -f $(addprefix '$(DESTDIR)$(datadir)/extension'/, $(notdir $(addsuffix .control, $(EXTENSION))))
+endif
+ifneq (,$(DATA)$(DATA_built))
+ rm -f $(addprefix '$(DESTDIR)$(datadir)/$(datamoduledir)'/, $(notdir $(DATA) $(DATA_built)))
endif
ifneq (,$(DATA_TSEARCH))
rm -f $(addprefix '$(DESTDIR)$(datadir)/tsearch_data'/, $(notdir $(DATA_TSEARCH)))