Browse code

postgresql: Add support for LLVM and JIT with --with-llvm

This adds a new package called postgresql-llvmjit that includes all the
JIT compilation code needed to be able to enable JIT in PostgreSQL via
LLVM. This patch is the last one in the latest series to make
PostgreSQL on Photon equal to most major Linux distributions.

clang-devel requires the addition ncurses devel to allow the correct
fetching of -lcurses when compiling the JIT code for Postgres.

Change-Id: I05ed49d74f333c9940fd06420cdf94b034ca7874
Reviewed-on: http://photon-jenkins.eng.vmware.com:8082/12635
Tested-by: gerrit-photon <photon-checkins@vmware.com>
Reviewed-by: Alexey Makhalov <amakhalov@vmware.com>

Michael Paquier authored on 2021/03/16 07:52:20
Showing 2 changed files
... ...
@@ -1,7 +1,7 @@
1 1
 Summary:        C, C++, Objective C and Objective C++ front-end for the LLVM compiler.
2 2
 Name:           clang
3 3
 Version:        11.0.1
4
-Release:        1%{?dist}
4
+Release:        2%{?dist}
5 5
 License:        NCSA
6 6
 URL:            http://clang.llvm.org
7 7
 Group:          Development/Tools
... ...
@@ -29,6 +29,7 @@ C, C++, Objective C/C++, OpenCL C and others for the LLVM compiler. You can get
29 29
 %package        devel
30 30
 Summary:        Development headers for clang
31 31
 Requires:       %{name} = %{version}-%{release}
32
+Requires:       ncurses-devel
32 33
 %description    devel
33 34
 The clang-devel package contains libraries, header files and documentation for developing applications that use clang.
34 35
 
... ...
@@ -75,6 +76,8 @@ rm -rf %{buildroot}/*
75 75
 %{_includedir}/*
76 76
 
77 77
 %changelog
78
+*   Tue Mar 16 2021 Michael Paquier <mpaquier@vmware.com> 11.0.1-2
79
+-   Addition of required dependency to ncurses-devel for devel package.
78 80
 *   Thu Feb 04 2021 Shreenidhi Shedi <sshedi@vmware.com> 11.0.1-1
79 81
 -   Upgrade to v11.0.1
80 82
 *   Mon Aug 24 2020 Gerrit Photon <photon-checkins@vmware.com> 10.0.1-1
... ...
@@ -1,7 +1,7 @@
1 1
 Summary:        PostgreSQL database engine
2 2
 Name:           postgresql
3 3
 Version:        13.2
4
-Release:        8%{?dist}
4
+Release:        9%{?dist}
5 5
 License:        PostgreSQL
6 6
 URL:            www.postgresql.org
7 7
 Group:          Applications/Databases
... ...
@@ -15,6 +15,8 @@ Source0:        http://ftp.postgresql.org/pub/source/v%{version}/%{name}-%{versi
15 15
 %global pgmajorversion 13
16 16
 
17 17
 # Common libraries needed
18
+# clang-devel is needed for LLVM.
19
+BuildRequires:  clang-devel
18 20
 BuildRequires:  diffutils
19 21
 BuildRequires:  gcc
20 22
 BuildRequires:  gettext
... ...
@@ -25,6 +27,7 @@ BuildRequires:  libxml2-devel
25 25
 BuildRequires:  libxslt-devel
26 26
 BuildRequires:  linux-api-headers
27 27
 BuildRequires:  Linux-PAM-devel
28
+BuildRequires:  llvm-devel
28 29
 BuildRequires:  openldap
29 30
 BuildRequires:  perl
30 31
 BuildRequires:  perl-IPC-Run
... ...
@@ -112,8 +115,10 @@ included in the PostgreSQL distribution.
112 112
 Summary:	PostgreSQL development header files and libraries
113 113
 Requires:	%{name} = %{version}-%{release}
114 114
 Requires:	%{name}-libs = %{version}-%{release}
115
+Requires:  clang-devel
115 116
 Requires:  libxslt
116 117
 Requires:  libxslt-devel
118
+Requires:  llvm-devel
117 119
 Requires:  perl-IPC-Run
118 120
 
119 121
 %description devel
... ...
@@ -123,6 +128,15 @@ with a PostgreSQL database management server. It also contains the ecpg
123 123
 Embedded C Postgres preprocessor. You need to install this package if you
124 124
 want to develop applications which will interact with a PostgreSQL server.
125 125
 
126
+%package llvmjit
127
+Summary:    Just-in-time compilation support for PostgreSQL
128
+Requires:   %{name}-server = %{version}-%{release}
129
+Requires:   llvm
130
+
131
+%description llvmjit
132
+The postgresql-llvmjit package contains support for just-in-time
133
+compilation with PostgreSQL queries.
134
+
126 135
 %package plperl
127 136
 Summary:	The Perl procedural language for PostgreSQL
128 137
 Requires:	%{name}-server = %{version}-%{release}
... ...
@@ -169,6 +183,7 @@ sed -i '/DEFAULT_PGSOCKET_DIR/s@/tmp@/run/postgresql@' src/include/pg_config_man
169 169
     --with-ldap \
170 170
     --with-libxml \
171 171
     --with-libxslt \
172
+    --with-llvm \
172 173
     --with-openssl \
173 174
     --with-gssapi \
174 175
     --with-libedit-preferred \
... ...
@@ -457,6 +472,12 @@ rm -rf %{buildroot}/*
457 457
 %{_mandir}/man1/pg_standby.*
458 458
 %{_mandir}/man1/vacuumlo.*
459 459
 
460
+%files llvmjit
461
+%defattr(-,root,root)
462
+%{_libdir}/postgresql/bitcode/*
463
+%{_libdir}/postgresql/llvmjit.so
464
+%{_libdir}/postgresql/llvmjit_types.bc
465
+
460 466
 %files devel
461 467
 %defattr(-,root,root)
462 468
 %{_bindir}/ecpg
... ...
@@ -506,6 +527,8 @@ rm -rf %{buildroot}/*
506 506
 %{_libdir}/postgresql/plpython3.so
507 507
 
508 508
 %changelog
509
+*   Tue Mar 16 2021 Michael Paquier <mpaquier@vmware.com> 13.2-9
510
+-   Add support for JIT and LLVM
509 511
 *   Thu Mar 11 2021 Michael Paquier <mpaquier@vmware.com> 13.2-8
510 512
 -   Add support for libxslt
511 513
 *   Wed Mar 10 2021 Michael Paquier <mpaquier@vmware.com> 13.2-7