File mongo_fdw.spec of Package mongo_fdw

Name:      mongo_fdw
Summary:   PostgreSQL foreign data wrapper for MongoDB
Version:   5.0.0
Release:   1%{?dist}
License:   LGPL 3.0
Group:     Productivity/Databases/Servers
URL:       https://github.com/EnterpriseDB/%{name}

Source0:   https://github.com/EnterpriseDB/%{name}/releases/download/%{version}/%{name}-REL-5_0_0.tar.gz

Patch0:    makefile.patch
Patch1:    authentication_database-replica_set-options.patch
Patch2:    mongoc_init.patch

BuildRequires: autoconf
BuildRequires: automake
BuildRequires: libtool
BuildRequires: postgresql95-devel
BuildRequires: pkgconfig(libbson-1.0) > %{bsonver}
BuildRequires: pkgconfig(libmongoc-1.0)
BuildRequires: pkgconfig(json-c)
BuildRequires: pkgconfig(libsasl2)
BuildRequires: pkgconfig(libssl)
BuildRequires: pkgconfig(libcrypto)

%define pg_extensiondir %( pg_config --sharedir )/extension
%define pg_libdir %( pg_config --pkglibdir )

%description
This MongoDB extension implements the PostgreSQL's Foreign Data Wrapper.

Please note that this version of mongo_fdw works with PostgreSQL and EDB Postgres Advanced Server 9.3, 9.4, 9.5 and 9.6.

%prep

%setup -q -n %{name}-REL-5_0_0
#Use the meta driver
mv Makefile.meta Makefile

echo "#ifdef __CONFIG__" >> config.h
echo "#define META_DRIVER" >> config.h
echo "#endif" >> config.h

%patch0 -p0 
%patch1 -p1
%patch2 -p0

%build
make %{?_smp_mflags} all V=1

%install
make install DESTDIR=%{buildroot}

%files
%dir %( pg_config --sharedir)
%dir %{pg_extensiondir}
%{pg_extensiondir}/*
%dir %{pg_libdir}
%{pg_libdir}/*

%changelog