diff --git a/rpm.spec b/rpm.spec new file mode 100644 index 00000000..5175cb4b --- /dev/null +++ b/rpm.spec @@ -0,0 +1,70 @@ +%global sname sqlite_fdw +%global pginstdir /usr/pgsql-%{pgmajorversion} + +%{!?llvm:%global llvm 1} + +Summary: SQLite Foreign Data Wrapper for PostgreSQL +Name: %{sname}_%{pgmajorversion} +Version: 2.5.1 +Release: 2PIGSTY%{?dist} +License: PostgreSQL +URL: https://github.com/pgspider/%{sname} +Source0: %{sname}-%{version}.tar.gz +BuildRequires: postgresql%{pgmajorversion}-devel +BuildRequires: postgresql%{pgmajorversion}-server sqlite-devel +BuildRequires: libspatialite-devel +Requires: postgresql%{pgmajorversion}-server + +%if 0%{?suse_version} >= 1500 +# Unfortunately SLES 15 ships the libraries with -devel subpackage: +Requires: sqlite3-devel >= 3.7 +%else +# All other sane distributions have a separate -libs subpackage: +Requires: sqlite-libs >= 3.7 +%endif + +%description +This PostgreSQL extension is a Foreign Data Wrapper for SQLite. + +%if %llvm +%package llvmjit +Summary: Just-in-time compilation support for sqlite_fdw +Requires: %{name}%{?_isa} = %{version}-%{release} +%if 0%{?suse_version} >= 1500 +BuildRequires: llvm17-devel clang17-devel +Requires: llvm17 +%endif +%if 0%{?fedora} || 0%{?rhel} >= 8 +BuildRequires: llvm-devel >= 17.0 clang-devel >= 17.0 +Requires: llvm => 17.0 +%endif + +%description llvmjit +This package provides JIT support for %{sname} +%endif + +%prep +%setup -q -n %{sname}-%{version} + +%build +USE_PGXS=1 PATH=%{pginstdir}/bin/:$PATH %{__make} %{?_smp_mflags} + +%install +%{__rm} -rf %{buildroot} +USE_PGXS=1 PATH=%{pginstdir}/bin/:$PATH %{__make} %{?_smp_mflags} install DESTDIR=%{buildroot} +%{__install} -d %{buildroot}%{pginstdir}/doc/extension +%{__install} -m 644 README.md %{buildroot}%{pginstdir}/doc/extension/README-%{sname}.md +%{__rm} -f %{buildroot}%{pginstdir}/doc/extension/README.md + +%files +%defattr(-,root,root,-) +%{pginstdir}/lib/*.so +%{pginstdir}/share/extension/*.sql +%{pginstdir}/share/extension/*.control +%{pginstdir}/doc/extension/README-%{sname}.md + +%if %llvm +%files llvmjit + %{pginstdir}/lib/bitcode/%{sname}*.bc + %{pginstdir}/lib/bitcode/%{sname}/*.bc +%endif