From aa6946caa4994ad491497dcf2632c68cf318bc61 Mon Sep 17 00:00:00 2001 From: BLM Date: Thu, 16 Jul 2015 13:34:42 -0500 Subject: [PATCH] Added extension files; renamed (again!) to pg_libphonenumber --- Makefile | 9 ++++-- pg_libphonenumber--1.0.sql | 31 +++++++++++++++++++ pg_libphonenumber.control | 2 ++ ...ibphonenumber.cpp => pg_libphonenumber.cpp | 0 4 files changed, 39 insertions(+), 3 deletions(-) create mode 100644 pg_libphonenumber--1.0.sql create mode 100644 pg_libphonenumber.control rename pg-libphonenumber.cpp => pg_libphonenumber.cpp (100%) diff --git a/Makefile b/Makefile index 86cad06..b1731d0 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,9 @@ -MODULE_big := pg-libphonenumber -OBJS := pg-libphonenumber.o -PG_CPPFLAGS := -fPIC -std=c++11 +EXTENSION := pg_libphonenumber +DATA := pg_libphonenumber--1.0.sql + +MODULE_big := pg_libphonenumber +OBJS := pg_libphonenumber.o +PG_CPPFLAGS := -fPIC -std=c++11 -g SHLIB_LINK := -lphonenumber -lstdc++ PG_CONFIG := pg_config diff --git a/pg_libphonenumber--1.0.sql b/pg_libphonenumber--1.0.sql new file mode 100644 index 0000000..1fee397 --- /dev/null +++ b/pg_libphonenumber--1.0.sql @@ -0,0 +1,31 @@ +-- complain if script is sourced in psql, rather than via CREATE EXTENSION +\echo Use "CREATE EXTENSION pg_libphonenumber" to load this file. \quit + +CREATE TYPE phone_number; + +CREATE FUNCTION phone_number_in(cstring) RETURNS phone_number + LANGUAGE c IMMUTABLE STRICT + AS 'pg_libphonenumber', 'phone_number_in'; + +CREATE FUNCTION phone_number_out(phone_number) RETURNS cstring + LANGUAGE c IMMUTABLE STRICT + AS 'pg_libphonenumber', 'phone_number_out'; + +CREATE FUNCTION phone_number_recv(internal) RETURNS phone_number + LANGUAGE c IMMUTABLE STRICT + AS 'pg_libphonenumber', 'phone_number_recv'; + +CREATE FUNCTION phone_number_send(phone_number) RETURNS bytea + LANGUAGE c IMMUTABLE STRICT + AS 'pg_libphonenumber', 'phone_number_send'; + +CREATE TYPE phone_number ( + INTERNALLENGTH = 64, + INPUT = phone_number_in, + OUTPUT = phone_number_out, + RECEIVE = phone_number_recv, + SEND = phone_number_send, + ALIGNMENT = double, + STORAGE = plain +); + diff --git a/pg_libphonenumber.control b/pg_libphonenumber.control new file mode 100644 index 0000000..7c1cdab --- /dev/null +++ b/pg_libphonenumber.control @@ -0,0 +1,2 @@ +encoding = 'utf-8' +relocatable = true diff --git a/pg-libphonenumber.cpp b/pg_libphonenumber.cpp similarity index 100% rename from pg-libphonenumber.cpp rename to pg_libphonenumber.cpp