postgresql_server: WIP recipe for version 9.3.4

* used the gentoo name, instead of postgresql.
* build stops because shared memory support still missing in Haiku
This commit is contained in:
Jerome Duval
2014-05-07 21:26:10 +00:00
parent 9418e7ce3a
commit 0fdc6b128c
3 changed files with 392 additions and 0 deletions

View File

@@ -0,0 +1,23 @@
PostgreSQL Database Management System
(formerly known as Postgres, then as Postgres95)
Portions Copyright (c) 1996-2010, PostgreSQL Global Development Group
Portions Copyright (c) 1994, The Regents of the University of California
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose, without fee, and without a written agreement
is hereby granted, provided that the above copyright notice and this
paragraph and the following two paragraphs appear in all copies.
IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING
LOST PROFITS, ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS
DOCUMENTATION, EVEN IF THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATIONS TO
PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.

View File

@@ -0,0 +1,290 @@
From 69b627758b0c5e78cfa982861fab45b871b73b37 Mon Sep 17 00:00:00 2001
From: Jerome Duval <jerome.duval@gmail.com>
Date: Wed, 7 May 2014 15:52:41 +0000
Subject: autoconf version
diff --git a/configure.in b/configure.in
index 61484df..66e501c 100644
--- a/configure.in
+++ b/configure.in
@@ -19,10 +19,10 @@ m4_pattern_forbid(^PGAC_)dnl to catch undefined macros
AC_INIT([PostgreSQL], [9.3.4], [pgsql-bugs@postgresql.org])
-m4_if(m4_defn([m4_PACKAGE_VERSION]), [2.63], [], [m4_fatal([Autoconf version 2.63 is required.
-Untested combinations of 'autoconf' and PostgreSQL versions are not
-recommended. You can remove the check from 'configure.in' but it is then
-your responsibility whether the result works or not.])])
+dnl m4_if(m4_defn([m4_PACKAGE_VERSION]), [2.63], [], [m4_fatal([Autoconf version 2.63 is required.
+dnl Untested combinations of 'autoconf' and PostgreSQL versions are not
+dnl recommended. You can remove the check from 'configure.in' but it is then
+dnl your responsibility whether the result works or not.])])
AC_COPYRIGHT([Copyright (c) 1996-2013, PostgreSQL Global Development Group])
AC_CONFIG_SRCDIR([src/backend/access/common/heaptuple.c])
AC_CONFIG_AUX_DIR(config)
--
1.8.3.4
From a2440b0d15d9da3359c0bfba6bdf9160a35a2ab7 Mon Sep 17 00:00:00 2001
From: Jerome Duval <jerome.duval@gmail.com>
Date: Wed, 7 May 2014 16:03:31 +0000
Subject: haiku support
diff --git a/configure.in b/configure.in
index 66e501c..3072dbc 100644
--- a/configure.in
+++ b/configure.in
@@ -59,6 +59,7 @@ case $host_os in
darwin*) template=darwin ;;
dragonfly*) template=netbsd ;;
freebsd*) template=freebsd ;;
+ haiku*) template=haiku ;;
hpux*) template=hpux ;;
irix*) template=irix ;;
linux*|gnu*|k*bsd*-gnu)
@@ -873,7 +874,7 @@ fi
AC_CHECK_LIB(m, main)
AC_SEARCH_LIBS(setproctitle, util)
AC_SEARCH_LIBS(dlopen, dl)
-AC_SEARCH_LIBS(socket, [socket wsock32])
+AC_SEARCH_LIBS(socket, [socket wsock32 network])
AC_SEARCH_LIBS(shl_load, dld)
# We only use libld in port/dynloader/aix.c
case $host_os in
@@ -887,7 +888,7 @@ AC_SEARCH_LIBS(crypt, crypt)
AC_SEARCH_LIBS(fdatasync, [rt posix4])
# Required for thread_test.c on Solaris 2.5:
# Other ports use it too (HP-UX) so test unconditionally
-AC_SEARCH_LIBS(gethostbyname_r, nsl)
+AC_SEARCH_LIBS(gethostbyname_r, [nsl network])
# Cygwin:
AC_SEARCH_LIBS(shmget, cygipc)
diff --git a/src/backend/port/dynloader/haiku.c b/src/backend/port/dynloader/haiku.c
new file mode 100644
index 0000000..c99b717
--- /dev/null
+++ b/src/backend/port/dynloader/haiku.c
@@ -0,0 +1,133 @@
+/*-------------------------------------------------------------------------
+ *
+ * linux.c
+ * Dynamic Loader for Postgres for Linux, generated from those for
+ * Ultrix.
+ *
+ * You need to install the dld library on your Linux system!
+ *
+ * Portions Copyright (c) 1996-2013, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ *
+ * IDENTIFICATION
+ * src/backend/port/dynloader/haiku.c
+ *
+ *-------------------------------------------------------------------------
+ */
+
+#include "postgres.h"
+
+#ifdef HAVE_DLD_H
+#include <dld.h>
+#endif
+
+#include "dynloader.h"
+#include "miscadmin.h"
+
+
+#ifndef HAVE_DLOPEN
+
+void *
+pg_dlopen(char *filename)
+{
+#ifndef HAVE_DLD_H
+ elog(ERROR, "dynamic load not supported");
+ return NULL;
+#else
+ static int dl_initialized = 0;
+
+ /*
+ * initializes the dynamic loader with the executable's pathname. (only
+ * needs to do this the first time pg_dlopen is called.)
+ */
+ if (!dl_initialized)
+ {
+ if (dld_init(dld_find_executable(my_exec_path)))
+ return NULL;
+
+ /*
+ * if there are undefined symbols, we want dl to search from the
+ * following libraries also.
+ */
+ dl_initialized = 1;
+ }
+
+ /*
+ * link the file, then check for undefined symbols!
+ */
+ if (dld_link(filename))
+ return NULL;
+
+ /*
+ * If undefined symbols: try to link with the C and math libraries! This
+ * could be smarter, if the dynamic linker was able to handle shared libs!
+ */
+ if (dld_undefined_sym_count > 0)
+ {
+ if (dld_link("/usr/lib/libc.a"))
+ {
+ elog(WARNING, "could not link C library");
+ return NULL;
+ }
+ if (dld_undefined_sym_count > 0)
+ {
+ if (dld_link("/usr/lib/libm.a"))
+ {
+ elog(WARNING, "could not link math library");
+ return NULL;
+ }
+ if (dld_undefined_sym_count > 0)
+ {
+ int count = dld_undefined_sym_count;
+ char **list = dld_list_undefined_sym();
+
+ /* list the undefined symbols, if any */
+ do
+ {
+ elog(WARNING, "\"%s\" is undefined", *list);
+ list++;
+ count--;
+ } while (count > 0);
+
+ dld_unlink_by_file(filename, 1);
+ return NULL;
+ }
+ }
+ }
+
+ return (void *) strdup(filename);
+#endif
+}
+
+PGFunction
+pg_dlsym(void *handle, char *funcname)
+{
+#ifndef HAVE_DLD_H
+ return NULL;
+#else
+ return (PGFunction) dld_get_func((funcname));
+#endif
+}
+
+void
+pg_dlclose(void *handle)
+{
+#ifndef HAVE_DLD_H
+#else
+ dld_unlink_by_file(handle, 1);
+ free(handle);
+#endif
+}
+
+char *
+pg_dlerror(void)
+{
+#ifndef HAVE_DLD_H
+ return "dynaloader unspported";
+#else
+ return dld_strerror(dld_errno);
+#endif
+}
+
+#endif /* !HAVE_DLOPEN */
diff --git a/src/backend/port/dynloader/haiku.h b/src/backend/port/dynloader/haiku.h
new file mode 100644
index 0000000..974cf4a
--- /dev/null
+++ b/src/backend/port/dynloader/haiku.h
@@ -0,0 +1,44 @@
+/*-------------------------------------------------------------------------
+ *
+ * linux.h
+ * Port-specific prototypes for Linux
+ *
+ *
+ * Portions Copyright (c) 1996-2013, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/backend/port/dynloader/haiku.h
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef PORT_PROTOS_H
+#define PORT_PROTOS_H
+
+#include "utils/dynamic_loader.h" /* pgrminclude ignore */
+#ifdef HAVE_DLOPEN
+#include <dlfcn.h>
+#endif
+
+
+#ifdef HAVE_DLOPEN
+
+/*
+ * In some older systems, the RTLD_NOW flag isn't defined and the mode
+ * argument to dlopen must always be 1. The RTLD_GLOBAL flag is wanted
+ * if available, but it doesn't exist everywhere.
+ * If it doesn't exist, set it to 0 so it has no effect.
+ */
+#ifndef RTLD_NOW
+#define RTLD_NOW 1
+#endif
+#ifndef RTLD_GLOBAL
+#define RTLD_GLOBAL 0
+#endif
+
+#define pg_dlopen(f) dlopen((f), RTLD_NOW | RTLD_GLOBAL)
+#define pg_dlsym dlsym
+#define pg_dlclose dlclose
+#define pg_dlerror dlerror
+#endif /* HAVE_DLOPEN */
+
+#endif /* PORT_PROTOS_H */
diff --git a/src/include/port/haiku.h b/src/include/port/haiku.h
new file mode 100644
index 0000000..beabea1
--- /dev/null
+++ b/src/include/port/haiku.h
@@ -0,0 +1 @@
+/* src/include/port/haiku.h */
diff --git a/src/makefiles/Makefile.haiku b/src/makefiles/Makefile.haiku
new file mode 100644
index 0000000..53780c1
--- /dev/null
+++ b/src/makefiles/Makefile.haiku
@@ -0,0 +1,12 @@
+AROPT = cr
+export_dynamic = -Wl,-E
+# Use --enable-new-dtags to generate DT_RUNPATH instead of DT_RPATH.
+# This allows LD_LIBRARY_PATH to still work when needed.
+rpath = -Wl,-rpath,'$(rpathdir)',--enable-new-dtags
+DLSUFFIX = .so
+
+CFLAGS_SL = -fpic
+
+# Rule for building a shared library from a single .o file
+%.so: %.o
+ $(CC) $(CFLAGS) $(LDFLAGS) $(LDFLAGS_SL) -shared -o $@ $<
diff --git a/src/template/haiku b/src/template/haiku
new file mode 100644
index 0000000..fd1e3dc
--- /dev/null
+++ b/src/template/haiku
@@ -0,0 +1,2 @@
+# src/template/haiku
+
--
1.8.3.4

View File

@@ -0,0 +1,79 @@
SUMMARY="A powerful, open source object-relational database system."
DESCRIPTION="
PostgreSQL is a powerful, open source object-relational database system. It has\
more than 15 years of active development and a proven architecture that has \
earned it a strong reputation for reliability, data integrity, and correctness.\
It runs on all major operating systems, including Linux, UNIX (AIX, BSD, HP-UX,\
SGI IRIX, Mac OS X, Solaris, Tru64), and Windows. It is fully ACID compliant,\
has full support for foreign keys, joins, views, triggers, and stored\
procedures (in multiple languages). It includes most SQL:2008 data types,\
including INTEGER, NUMERIC, BOOLEAN, CHAR, VARCHAR, DATE, INTERVAL, and\
TIMESTAMP. It also supports storage of binary large objects, including\
pictures, sounds, or video. It has native programming interfaces for C/C++,\
Java, .Net, Perl, Python, Ruby, Tcl, ODBC, among others, and exceptional\
documentation.
"
HOMEPAGE="http://www.postgresql.org/"
SRC_URI="http://ftp.postgresql.org/pub/source/v9.3.4/postgresql-9.3.4.tar.bz2"
CHECKSUM_SHA256="9ee819574dfc8798a448dc23a99510d2d8924c2f8b49f8228cd77e4efc8a6621"
REVISION="1"
ARCHITECTURES="!x86_gcc2 !x86 !x86_64"
LICENSE="PostgreSQL"
COPYRIGHT="1996-2014, PostgreSQL Global Development Group"
PROVIDES="
postgresql_server = $portVersion compat >= 9
cmd:clusterdb = $portVersion compat >= 9
cmd:createdb = $portVersion compat >= 9
cmd:createlang = $portVersion compat >= 9
cmd:createuser = $portVersion compat >= 9
cmd:dropdb = $portVersion compat >= 9
cmd:droplang = $portVersion compat >= 9
cmd:dropuser = $portVersion compat >= 9
cmd:pg_config = $portVersion compat >= 9
cmd:pg_dump = $portVersion compat >= 9
cmd:pg_dumpall = $portVersion compat >= 9
cmd:pg_isready = $portVersion compat >= 9
cmd:pg_restore = $portVersion compat >= 9
cmd:psql = $portVersion compat >= 9
cmd:reindexdb = $portVersion compat >= 9
cmd:vacuumdb = $portVersion compat >= 9
cmd:pgsql = $portVersion compat >= 9
"
REQUIRES="
haiku >= $haikuVersion
lib:libreadline
lib:libz
"
BUILD_REQUIRES="
haiku_devel >= $haikuVersion
devel:libreadline
devel:libz
"
BUILD_PREREQUIRES="
cmd:aclocal
cmd:autoconf
cmd:automake
cmd:gcc
cmd:ld
cmd:libtoolize
cmd:make
"
PATCHES="postgresql_server-9.3.4.patchset"
SOURCE_DIR="postgresql-$portVersion"
BUILD()
{
runConfigure ./configure
make $jobArgs
}
INSTALL()
{
make install
fixPkgconfig
}