Re: Disable LLVM bitcode generation with pgxs.mk framework.

2024-03-12 Thread Daniel Gustafsson
> On 12 Mar 2024, at 14:38, Xing Guo  wrote:

> Would it be possible to add a new switch in the pgxs.mk framework to
> allow users to disable this feature?

Something like that doesn't seem unreasonable I think.

--
Daniel Gustafsson





Re: Disable LLVM bitcode generation with pgxs.mk framework.

2024-03-12 Thread Xing Guo
> On Tue, Mar 12, 2024 at 10:40 PM Daniel Gustafsson  wrote:
>
> > On 12 Mar 2024, at 14:38, Xing Guo  wrote:
>
> > Would it be possible to add a new switch in the pgxs.mk framework to
> > allow users to disable this feature?
>
> Something like that doesn't seem unreasonable I think.

Thanks.

I added a new option NO_LLVM_BITCODE to pgxs. I'm not sure if the name
is appropriate.

> --
> Daniel Gustafsson
>
From e19a724fad4949bef9bc4d0f8e58719607d979be Mon Sep 17 00:00:00 2001
From: Xing Guo 
Date: Wed, 13 Mar 2024 07:56:46 +0800
Subject: [PATCH v1] Add NO_LLVM_BITCODE option to pgxs.

This patch adds a new option NO_LLVM_BITCODE to pgxs to allow user to
disable LLVM bitcode generation completely even if the PostgreSQL
installation is configured with --with-llvm.
---
 doc/src/sgml/extend.sgml | 9 +
 src/makefiles/pgxs.mk| 6 ++
 2 files changed, 15 insertions(+)

diff --git a/doc/src/sgml/extend.sgml b/doc/src/sgml/extend.sgml
index 218940ee5c..6fe69746c2 100644
--- a/doc/src/sgml/extend.sgml
+++ b/doc/src/sgml/extend.sgml
@@ -1719,6 +1719,15 @@ include $(PGXS)
   
  
 
+ 
+  NO_LLVM_BITCODE
+  
+   
+don't generate LLVM bitcode even if the current PostgreSQL installation is configured with --with-llvm
+   
+  
+ 
+
  
   EXTRA_CLEAN
   
diff --git a/src/makefiles/pgxs.mk b/src/makefiles/pgxs.mk
index 0de3737e78..ec6a3c1f09 100644
--- a/src/makefiles/pgxs.mk
+++ b/src/makefiles/pgxs.mk
@@ -53,6 +53,8 @@
 # that don't need their build products to be installed
 #   NO_INSTALLCHECK -- don't define an installcheck target, useful e.g. if
 # tests require special configuration, or don't use pg_regress
+#   NO_LLVM_BITCODE -- don't generate LLVM bitcode even if the current
+# PostgreSQL installation is configured with --with-llvm
 #   EXTRA_CLEAN -- extra files to remove in 'make clean'
 #   PG_CPPFLAGS -- will be prepended to CPPFLAGS
 #   PG_CFLAGS -- will be appended to CFLAGS
@@ -218,6 +220,10 @@ endef
 
 all: $(PROGRAM) $(DATA_built) $(HEADER_allbuilt) $(SCRIPTS_built) $(addsuffix $(DLSUFFIX), $(MODULES)) $(addsuffix .control, $(EXTENSION))
 
+ifdef NO_LLVM_BITCODE
+with_llvm := no
+endif # NO_LLVM_BITCODE
+
 ifeq ($(with_llvm), yes)
 all: $(addsuffix .bc, $(MODULES)) $(patsubst %.o,%.bc, $(OBJS))
 endif
-- 
2.44.0



Re: Disable LLVM bitcode generation with pgxs.mk framework.

2024-03-12 Thread Peter Eisentraut

On 12.03.24 14:38, Xing Guo wrote:

When the PostgreSQL server is configured with --with-llvm, the pgxs.mk
framework will generate LLVM bitcode for extensions automatically.
Sometimes, I don't want to generate bitcode for some extensions. I can
turn off this feature by specifying with_llvm=0 in the make command.

```
make with_llvm=0
```

Would it be possible to add a new switch in the pgxs.mk framework to
allow users to disable this feature? E.g., the Makefile looks like:

```
WITH_LLVM=no
PG_CONFIG = pg_config
PGXS := $(shell $(PG_CONFIG) --pgxs)
```


Can't you just put the very same with_llvm=0 into the makefile?





Re: Disable LLVM bitcode generation with pgxs.mk framework.

2024-03-13 Thread Xing Guo
> On Wed, Mar 13, 2024 at 2:45 PM Peter Eisentraut  wrote:
>
> On 12.03.24 14:38, Xing Guo wrote:
> > When the PostgreSQL server is configured with --with-llvm, the pgxs.mk
> > framework will generate LLVM bitcode for extensions automatically.
> > Sometimes, I don't want to generate bitcode for some extensions. I can
> > turn off this feature by specifying with_llvm=0 in the make command.
> >
> > ```
> > make with_llvm=0
> > ```
> >
> > Would it be possible to add a new switch in the pgxs.mk framework to
> > allow users to disable this feature? E.g., the Makefile looks like:
> >
> > ```
> > WITH_LLVM=no
> > PG_CONFIG = pg_config
> > PGXS := $(shell $(PG_CONFIG) --pgxs)
> > ```
>
> Can't you just put the very same with_llvm=0 into the makefile?

Ah, you're right. I can set it by overriding that variable.

```
override with_llvm=no
```