Update project build process, now using PGXS
This commit is contained in:
parent
b9c9e61189
commit
dfd227da33
25
Makefile
25
Makefile
|
@ -1,18 +1,13 @@
|
|||
INCLUDEDIRS := -I.
|
||||
INCLUDEDIRS += -I$(shell pg_config --includedir-server)
|
||||
INCLUDEDIRS += -I$(shell pg_config --includedir)
|
||||
LIBDIR = -L$(shell pg_config --libdir)
|
||||
# This is where the shared object should be installed
|
||||
LIBINSTALL = $(shell pg_config --pkglibdir)
|
||||
CFLAGS += -std=c++14 -fpic
|
||||
MODULES = iban
|
||||
|
||||
all: iban.so
|
||||
EXTENSION = iban
|
||||
DATA = iban--1.0.0.sql
|
||||
PGFILEDESC = "iban - IBAN datatype and functions"
|
||||
|
||||
iban.so: iban.cc
|
||||
$(CC) $(CFLAGS) -o iban.o -c iban.cc $(INCLUDEDIRS)
|
||||
$(CC) -Wl,--gc-sections -shared -o iban.so iban.o $(LIBDIR) -lpq -lm -lstdc++
|
||||
cp iban.so $(LIBINSTALL)
|
||||
PG_CXXFLAGS = -std=c++14 -fPIC
|
||||
|
||||
clean:
|
||||
@$(RM) -rf *.o
|
||||
@$(RM) -rf iban.so
|
||||
PG_LDFLAGS = -lstdc++
|
||||
|
||||
PG_CONFIG = pg_config
|
||||
PGXS := $(shell $(PG_CONFIG) --pgxs)
|
||||
include $(PGXS)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- IBAN datatype and verificator -*- sql -*-
|
||||
---
|
||||
--- Copyright © 2016 Yorick de Wid <yorick17@outlook.com>
|
||||
--- Copyright © 2016-2020 Yorick de Wid <yorick17 at outlook dot com>
|
||||
---
|
||||
--- This program is free software: you can redistribute it and/or modify
|
||||
--- it under the terms of the GNU General Public License as published by
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# iban extension
|
||||
comment = 'IBAN verification'
|
||||
comment = 'IBAN functionality for PostgreSQL'
|
||||
default_version = '1.0.0'
|
||||
module_pathname = '$libdir/iban'
|
||||
relocatable = true
|
|
@ -19,11 +19,11 @@
|
|||
|
||||
extern "C"
|
||||
{
|
||||
#include <postgres.h>
|
||||
#include <string.h>
|
||||
#include <fmgr.h>
|
||||
#include <utils/builtins.h>
|
||||
#include <libpq/pqformat.h>
|
||||
|
||||
#include "postgres.h"
|
||||
#include "utils/builtins.h"
|
||||
#include "libpq/pqformat.h"
|
||||
|
||||
}
|
||||
|
||||
#include <iostream>
|
||||
|
@ -35,18 +35,12 @@ extern "C"
|
|||
#include "specification.h"
|
||||
#include "validate.h"
|
||||
|
||||
#define PG_RETURN_IBAN_P(x) PG_RETURN_POINTER(x)
|
||||
// #define PG_RETURN_IBAN_P(x) PG_RETURN_POINTER(x)
|
||||
|
||||
extern "C"
|
||||
{
|
||||
PG_MODULE_MAGIC;
|
||||
|
||||
extern Datum ibanin(PG_FUNCTION_ARGS);
|
||||
extern Datum ibanout(PG_FUNCTION_ARGS);
|
||||
extern Datum ibanrecv(PG_FUNCTION_ARGS);
|
||||
extern Datum ibansend(PG_FUNCTION_ARGS);
|
||||
extern Datum iban_validate(PG_FUNCTION_ARGS);
|
||||
|
||||
typedef char Iban;
|
||||
}
|
||||
|
|
@ -1,4 +1,5 @@
|
|||
#pragma once
|
||||
|
||||
#include <string>
|
||||
|
||||
class Specification {
|
||||
|
|
Loading…
Reference in New Issue