Packaging gprbuild on OpenBSD

Hello,

I have not written a single piece of ada code in my life, though I think I am going to start now.
I have started packaging gprbuild 25.0.0 for OpenBSD. For now I have this diff.
Anyone interested on testing it and/or giving new ideas, as well as reasons why this is not a good idea is welcome. I am just a nooby here.

If this goes well, I will try to package also Alire, which for now has compiled without issues.

Thanks.

Index: Makefile
===================================================================
RCS file: Makefile
diff -N Makefile
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ Makefile	23 Mar 2026 18:43:04 -0000
@@ -0,0 +1,44 @@
+
+COMMENT = build system designed to construct multi-language systems
+
+V = 25.0.0
+DISTNAME = gprbuild-${V}
+REVISION = 0
+
+CATEGORIES = devel
+
+HOMEPAGE = https://github.com/AdaCore/gprbuild
+
+MAINTAINER = ports@openbsd.org
+
+# GLPv3+
+PERMIT_PACKAGE = Probably Yes, this is GPLv3
+PERMIT_DISTFILES = Probably Yes, this is GPLv3
+
+WANTLIB += c pthread
+
+SITES = https://github.com/
+
+BUILD_DEPENDS = lang/gcc/15,-ada
+
+DISTFILES += gprbuild-${V}{AdaCore/gprbuild/archive/refs/tags/v${V}}.tar.gz
+DISTFILES += xmlada-${V}{AdaCore/xmlada/archive/refs/tags/v${V}}.tar.gz
+DISTFILES += gprconfig_kb-${V}{AdaCore/gprconfig_kb/archive/refs/tags/v${V}}.tar.gz
+
+# We use the bootstrap script because building gprbuild requires gprbuild
+do-build:
+	cd ${WRKDIR}/gprbuild-${V};		\
+	./bootstrap.sh				\
+		--with-xmlada=../xmlada-${V}	\
+ 		--with-kb=../gprconfig_kb-${V}	\
+ 		--build
+
+do-install:
+	cd ${WRKDIR}/gprbuild-${V};		\
+	./bootstrap.sh				\
+		--prefix=/usr/local		\
+		--with-xmlada=../xmlada-${V}	\
+ 		--with-kb=../gprconfig_kb-${V}	\
+ 		--install
+
+.include <bsd.port.mk>
Index: distinfo
===================================================================
RCS file: distinfo
diff -N distinfo
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ distinfo	23 Mar 2026 18:43:04 -0000
@@ -0,0 +1,6 @@
+SHA256 (gprbuild-25.0.0.tar.gz) = 0S+UwewLbiGfaxYvcfVxKdIkJud5gJL1+FuewsyBi/E=
+SHA256 (gprconfig_kb-25.0.0.tar.gz) = gC5tOKOxEIl5JKnBbhQ8uGNg8t3pS7W5FEx8OR43sSE=
+SHA256 (xmlada-25.0.0.tar.gz) = 27WYSgkxMRx6eHpnnvTPru7dNXR0pYXcFwFA7yJR3Mo=
+SIZE (gprbuild-25.0.0.tar.gz) = 940774
+SIZE (gprconfig_kb-25.0.0.tar.gz) = 44165
+SIZE (xmlada-25.0.0.tar.gz) = 1082553
Index: pkg/DESCR
===================================================================
RCS file: pkg/DESCR
diff -N pkg/DESCR
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ pkg/DESCR	23 Mar 2026 18:43:04 -0000
@@ -0,0 +1,4 @@
+GPRbuild is a generic build tool designed for the construction of large
+multi-language systems organized into subsystems and libraries. It is
+well-suited for compiled languages supporting separate compilation, such as
+Ada, C, C++ and Fortran.
Index: pkg/PLIST
===================================================================
RCS file: pkg/PLIST
diff -N pkg/PLIST
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ pkg/PLIST	23 Mar 2026 18:43:04 -0000
@@ -0,0 +1,77 @@
+@bin bin/gprbuild
+@bin bin/gprclean
+@bin bin/gprconfig
+@bin bin/gprinstall
+@bin bin/gprls
+@bin bin/gprname
+libexec/gprbuild/
+@bin libexec/gprbuild/gprbind
+@bin libexec/gprbuild/gprlib
+share/gpr/
+share/gpr/_default.gpr
+share/gprconfig/
+share/gprconfig/0_default.xml
+share/gprconfig/aamp.xml
+share/gprconfig/aamp_compilers.xml
+share/gprconfig/aarch64-vx7.xml
+share/gprconfig/aarch64-vx7r2.xml
+share/gprconfig/arm-vx6.xml
+share/gprconfig/arm-vx7.xml
+share/gprconfig/arm-vx7r2.xml
+share/gprconfig/asis.xml
+share/gprconfig/asm.xml
+share/gprconfig/baselined.xml
+share/gprconfig/bin_img.xml
+share/gprconfig/c.xml
+share/gprconfig/clean.xml
+share/gprconfig/compilers-arm-vx7.xml
+share/gprconfig/compilers-asis.xml
+share/gprconfig/compilers-baselined.xml
+share/gprconfig/compilers-e500v2-vx6.xml
+share/gprconfig/compilers-e500v2-vx653.xml
+share/gprconfig/compilers-e500v2-vx7.xml
+share/gprconfig/compilers-e500v2-vx7r2.xml
+share/gprconfig/compilers-ppc-vx653.xml
+share/gprconfig/compilers-ppc-vx7.xml
+share/gprconfig/compilers-ppc-vx7r2.xml
+share/gprconfig/compilers-ppc64-vx7.xml
+share/gprconfig/compilers-ppc64-vx7r2.xml
+share/gprconfig/compilers-vxworks.xml
+share/gprconfig/compilers-x86-vx7.xml
+share/gprconfig/compilers-x86_64-vx7.xml
+share/gprconfig/compilers.xml
+share/gprconfig/cpp.xml
+share/gprconfig/cross.xml
+share/gprconfig/e500v2-vx6.xml
+share/gprconfig/e500v2-vx653.xml
+share/gprconfig/e500v2-vx7.xml
+share/gprconfig/e500v2-vx7r2.xml
+share/gprconfig/env.ent
+share/gprconfig/fallback_targets.xml
+share/gprconfig/fortran.xml
+share/gprconfig/gnat.xml
+share/gprconfig/linker.xml
+share/gprconfig/morello-vx7r2.xml
+share/gprconfig/nocompiler.xml
+share/gprconfig/ppc-vx6.xml
+share/gprconfig/ppc-vx653.xml
+share/gprconfig/ppc-vx7.xml
+share/gprconfig/ppc-vx7r2.xml
+share/gprconfig/ppc64-vx7.xml
+share/gprconfig/ppc64-vx7r2.xml
+share/gprconfig/shortcuts.ent
+share/gprconfig/targetset.xml
+share/gprconfig/tricore-compilers.xml
+share/gprconfig/tricore-configuration.xml
+share/gprconfig/tricore-target.xml
+share/gprconfig/vx6.ent
+share/gprconfig/vx653.ent
+share/gprconfig/vx7.ent
+share/gprconfig/vxworks.ent
+share/gprconfig/vxworks.xml
+share/gprconfig/windres.xml
+share/gprconfig/x86-vx6.xml
+share/gprconfig/x86-vx7.xml
+share/gprconfig/x86-vx7r2.xml
+share/gprconfig/x86_64-vx7.xml
+share/gprconfig/x86_64-vx7r2.xml

2 Likes

Hi @ZenitDS,

the Projects/Ideas category is generally reserved for projects/ideas that are looking to receive some funding from Ada Users/Awards. I think your post is misplaced, but… If you don’t mind, lets keep it here as this touches on a quite important topic that may need some funding! Maybe you would be interested in it :slight_smile:

Upstream support of Free/Net/OpenBSD/etc to GNAT!

A lot of OSes (Free/Net/OpenBSD, Illumos/Solaris, Ironclad/Gloire, Haiku…) do not have official support from the toolchain or compilers (GNAT). However, they are supported with external patches that live withing those OSes systems… I would like to propose a project to upstream to GCC/GNAT and GPRBuild those patches and have official support in them! Potentially also to Alire!

I think I do not have to explain why this would be helpful to the community or how that could benefit the outreach of Ada/SPARK to other communities and OSes that also present interesting environments (such as NetBSD with its plentiful set of architectures!).

Also, while the task seems challenging, most patches already exists and it would be an effort of upstreaming them, potentially with a cleanup, and testing them. I have done this in the past and it is not trivial, but once one understands the structure of GNAT, it is a very repetitive task!

I do not wish to be the one carrying this task.

Best regards,
Fer

Hi,

Yeah, my post is misplaced.
Although I appreciate the offer, I believe I am not qualified nor have the intent to request funding to take on the project you mention.
That said, I am interested in contributing to the support of OpenBSD, which is what I personally use.
I will keep it here if you so wish and guess it is General that this should be posted on, am I right?

Best,
zen

Yup, that would have been the preferred place :slight_smile: If you want to move it feel free and I will delete my post.

And regarding your original post. It may be necessary to patch GPRbuild itself so that it recognises OpenBSD as a supported OS Add FreeBSD support · AdaCore/gprconfig_kb@2f58b6b · GitHub GPRbuild will most likely build, but it wont do anything and just fail.

Best regards,
Fer

I have actually built gprbuild using the bootstrap script and then built alire using the just built gprbuild, which seems to be working. At least it executes and i can search for packages. Not sure what you mean by not doing anything and just failing. Maybe it is for cross-compilation that it is needed? Just guessing.

Best regards,
zen

1 Like

Probably out of date and sounds like you’ve got gprbuild sorted but I put this together in my early Ada days. The ease with which I found you could use Gnat with OpenBSDs C source tree was astounding back then. I recently noticed Gnat 15 is now packaged for OpenBSD amd64 which is pretty cool. Perhaps gnat for OpenBSD Arm cpus will land one day too but just glad gnat 15 is there.

2 Likes

Update:

  • implemented some gprconfig_kb patches, as proposed by @Irvise. The previous worked but was unable to discover and use some if not all compilers.
  • there is an issue with finding the Ada compiler, because OpenBSD uses egcc instead of gcc so the finding gets messed up. An idea is to patch targetset.xml to use egcc instead of egcc when hardcoded. The other option is to just have to link /usr/local/bin/egcc to /usr/local/bin/gcc. But this is inconvenient and I believe that the gcc binary is used on other architectures for OpenBSD. The best would be to have an equivalent to x86_64-unknown-openbsd-egcc for gnat, this I will consult in the OpenBSD mailing list since egfortran does exist.
Index: Makefile
===================================================================
RCS file: Makefile
diff -N Makefile
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ Makefile	27 Mar 2026 16:24:07 -0000
@@ -0,0 +1,45 @@
+
+COMMENT = build system designed to construct multi-language systems
+
+V = 25.0.0
+DISTNAME = gprbuild-${V}
+REVISION = 0
+
+CATEGORIES = devel
+
+HOMEPAGE = https://github.com/AdaCore/gprbuild
+
+MAINTAINER = ZenitDS <zenitds@proton.me>
+
+# GLPv3+
+PERMIT_PACKAGE = Probably Yes, this is GPLv3
+PERMIT_DISTFILES = Probably Yes, this is GPLv3
+
+WANTLIB += c pthread
+
+SITES = https://github.com/
+
+BUILD_DEPENDS = lang/gcc/15,-ada
+
+DISTFILES += gprbuild-${V}{AdaCore/gprbuild/archive/refs/tags/v${V}}.tar.gz
+DISTFILES += xmlada-${V}{AdaCore/xmlada/archive/refs/tags/v${V}}.tar.gz
+DISTFILES += gprconfig_kb-${V}{AdaCore/gprconfig_kb/archive/refs/tags/v${V}}.tar.gz
+WRKDIST = ${WRKDIR}
+
+# We use the bootstrap script because building gprbuild requires gprbuild
+do-build:
+	cd ${WRKDIR}/gprbuild-${V};		\
+	./bootstrap.sh				\
+		--with-xmlada=../xmlada-${V}	\
+ 		--with-kb=../gprconfig_kb-${V}	\
+ 		--build
+
+do-install:
+	cd ${WRKDIR}/gprbuild-${V};		\
+	./bootstrap.sh				\
+		--prefix=/usr/local		\
+		--with-xmlada=../xmlada-${V}	\
+ 		--with-kb=../gprconfig_kb-${V}	\
+ 		--install
+
+.include <bsd.port.mk>
Index: distinfo
===================================================================
RCS file: distinfo
diff -N distinfo
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ distinfo	27 Mar 2026 16:24:07 -0000
@@ -0,0 +1,6 @@
+SHA256 (gprbuild-25.0.0.tar.gz) = 0S+UwewLbiGfaxYvcfVxKdIkJud5gJL1+FuewsyBi/E=
+SHA256 (gprconfig_kb-25.0.0.tar.gz) = gC5tOKOxEIl5JKnBbhQ8uGNg8t3pS7W5FEx8OR43sSE=
+SHA256 (xmlada-25.0.0.tar.gz) = 27WYSgkxMRx6eHpnnvTPru7dNXR0pYXcFwFA7yJR3Mo=
+SIZE (gprbuild-25.0.0.tar.gz) = 940774
+SIZE (gprconfig_kb-25.0.0.tar.gz) = 44165
+SIZE (xmlada-25.0.0.tar.gz) = 1082553
Index: patches/patch-gprconfig_kb-25_0_0_db_compilers_xml
===================================================================
RCS file: patches/patch-gprconfig_kb-25_0_0_db_compilers_xml
diff -N patches/patch-gprconfig_kb-25_0_0_db_compilers_xml
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ patches/patch-gprconfig_kb-25_0_0_db_compilers_xml	27 Mar 2026 16:24:07 -0000
@@ -0,0 +1,66 @@
+Index: gprconfig_kb-25.0.0/db/compilers.xml
+--- gprconfig_kb-25.0.0/db/compilers.xml.orig
++++ gprconfig_kb-25.0.0/db/compilers.xml
+@@ -20,7 +20,7 @@
+   <!--    GCC 3.x & 4.x (not for GNAT Pro)-->
+   <compiler_description>
+     <name>GCC</name>
+-    <executable prefix="1">(.*-wrs-.*|.*-sysgo.*|.*-elf-.*|.*-eabi-.*|.*-eabispe-.*|avr-.*|.*-elinos-linux.*|.*-linux-gnu-|.*mingw32.*|.*-xcoff-.*|.*linux-android.*|arm-linux-gnueabi-|arm-linux-gnueabihf-|e500v2-gnu-linux-|powerpc-.*-linux.*-|.*-darwin.*-|.*-freebsd.*)?gcc(-\d+)?</executable>
++    <executable prefix="1">(.*-wrs-.*|.*-sysgo.*|.*-elf-.*|.*-eabi-.*|.*-eabispe-.*|avr-.*|.*-elinos-linux.*|.*-linux-gnu-|.*mingw32.*|.*-xcoff-.*|.*linux-android.*|arm-linux-gnueabi-|arm-linux-gnueabihf-|e500v2-gnu-linux-|powerpc-.*-linux.*-|.*-darwin.*-|.*-freebsd.*|.*-openbsd.*)?gcc(-\d+)?</executable>
+     <version>
+       <external>$EXEC -v</external>
+       <nogrep regexp="for GNAT Pro"></nogrep>
+@@ -36,7 +36,7 @@
+   <!--    GCC for GNAT Pro 3.x & 4.x -->
+   <compiler_description>
+     <name>GCC_Pro</name>
+-    <executable prefix="1">(.*-wrs-.*|.*-sysgo.*|.*-elf-.*|.*-eabi-.*|.*-eabispe-.*|avr-.*|.*-elinos-linux.*|.*-linux-gnu-|.*mingw32.*|.*-xcoff-.*|.*linux-android.*|arm-linux-gnueabi-|arm-linux-gnueabihf-|e500v2-gnu-linux-|powerpc-.*-linux.*-|.*-darwin.*-|.*-fastos.*|.*-freebsd.*|.*-qnx.*|.*-rtems.*)?gcc</executable>
++    <executable prefix="1">(.*-wrs-.*|.*-sysgo.*|.*-elf-.*|.*-eabi-.*|.*-eabispe-.*|avr-.*|.*-elinos-linux.*|.*-linux-gnu-|.*mingw32.*|.*-xcoff-.*|.*linux-android.*|arm-linux-gnueabi-|arm-linux-gnueabihf-|e500v2-gnu-linux-|powerpc-.*-linux.*-|.*-darwin.*-|.*-fastos.*|.*-freebsd.*|.*-openbsd.*|.*-qnx.*|.*-rtems.*)?gcc</executable>
+     <version>
+       <external>${PREFIX}gcc -v</external>
+ 
+@@ -121,7 +121,7 @@
+   <!--  G++ compilers for GNAT Pro  -->
+   <compiler_description>
+     <name>G++_Pro</name>
+-    <executable prefix="1">(.*-elf-.*|.*-eabi-.*|.*-wrs-.*|.*-fastos.*|.*-freebsd.*|.*-linux-gnu.*-|.*-linux-android.*|.*-rtems.*)?g\+\+</executable>
++    <executable prefix="1">(.*-elf-.*|.*-eabi-.*|.*-wrs-.*|.*-fastos.*|.*-freebsd.*|.*-openbsd.*|.*-linux-gnu.*-|.*-linux-android.*|.*-rtems.*)?g\+\+</executable>
+     <version>
+       <external>${PREFIX}g++ -v</external>
+ 
+@@ -138,7 +138,7 @@
+   <!--  Assembler (not for GNAT Pro) -->
+   <compiler_description>
+     <name>GCC-ASM</name>
+-    <executable prefix="1">(.*-wrs-.*|.*-sysgo.*|.*-elf-.*|.*-eabi-.*|.*-eabispe-.*|avr-.*|.*-elinos-linux.*|.*-linux-gnu-|.*mingw32.*|.*-xcoff-.*|.*linux-android.*|arm-linux-gnueabi-|arm-linux-gnueabihf-|e500v2-gnu-linux-|powerpc-.*-linux.*-|.*-darwin.*-|.*-fastos.*|.*-freebsd.*|.*-qnx.*|.*-rtems.*)?gcc(-\d+)?</executable>
++    <executable prefix="1">(.*-wrs-.*|.*-sysgo.*|.*-elf-.*|.*-eabi-.*|.*-eabispe-.*|avr-.*|.*-elinos-linux.*|.*-linux-gnu-|.*mingw32.*|.*-xcoff-.*|.*linux-android.*|arm-linux-gnueabi-|arm-linux-gnueabihf-|e500v2-gnu-linux-|powerpc-.*-linux.*-|.*-darwin.*-|.*-fastos.*|.*-freebsd.*|.*-openbsd.*|.*-qnx.*|.*-rtems.*)?gcc(-\d+)?</executable>
+     <version>
+       <external>$EXEC -v</external>
+       <nogrep regexp="for GNAT Pro"></nogrep>
+@@ -154,7 +154,7 @@
+   <!--  Assembler (for GNAT Pro) -->
+   <compiler_description>
+     <name>GCC-ASM_Pro</name>
+-    <executable prefix="1">(.*-wrs-.*|.*-sysgo.*|.*-elf-.*|.*-eabi-.*|.*-eabispe-.*|avr-.*|.*-elinos-linux.*|.*-linux-gnu-|.*mingw32.*|.*-xcoff-.*|.*linux-android.*|arm-linux-gnueabi-|arm-linux-gnueabihf-|e500v2-gnu-linux-|powerpc-.*-linux.*-|.*-darwin.*-|.*-.*fastos.*|.*-freebsd.*|.*-qnx.*|.*-rtems.*)?gcc</executable>
++    <executable prefix="1">(.*-wrs-.*|.*-sysgo.*|.*-elf-.*|.*-eabi-.*|.*-eabispe-.*|avr-.*|.*-elinos-linux.*|.*-linux-gnu-|.*mingw32.*|.*-xcoff-.*|.*linux-android.*|arm-linux-gnueabi-|arm-linux-gnueabihf-|e500v2-gnu-linux-|powerpc-.*-linux.*-|.*-darwin.*-|.*-.*fastos.*|.*-freebsd.*|.*-openbsd.*|.*-qnx.*|.*-rtems.*)?gcc</executable>
+     <version>
+       <external>${PREFIX}gcc -v</external>
+       <grep regexp="^gcc \S+ (\S+) \d+ (\(prerelease\) )?\(?for GNAT Pro" group="1"></grep>
+@@ -169,7 +169,7 @@
+   <!--  Binary image -->
+   <compiler_description>
+     <name>LD</name>
+-    <executable prefix="1">(.*-wrs.*-|.*-sysgo.*-|.*-elf.*-|.*-eabi.*-|.*-eabispe.*-|avr.*-|.*-elinos-linux.*-|.*-linux-gnu-|.*mingw32.*-|.*-xcoff.*-|.*linux-android.*|arm-linux-gnueabi-|arm-linux-gnueabihf-|e500v2-gnu-linux-|powerpc-.*-linux.*-|.*-darwin.*-|.*-fastos.*|.*-freebsd.*|.*-qnx.*-|.*-rtems.*-)?ld</executable>
++    <executable prefix="1">(.*-wrs.*-|.*-sysgo.*-|.*-elf.*-|.*-eabi.*-|.*-eabispe.*-|avr.*-|.*-elinos-linux.*-|.*-linux-gnu-|.*mingw32.*-|.*-xcoff.*-|.*linux-android.*|arm-linux-gnueabi-|arm-linux-gnueabihf-|e500v2-gnu-linux-|powerpc-.*-linux.*-|.*-darwin.*-|.*-fastos.*|.*-freebsd.*|.*-openbsd.*|.*-qnx.*-|.*-rtems.*-)?ld</executable>
+     <version>
+       <external>${PREFIX}ld -v</external>
+       <grep regexp="^(GNU ld.*|LLD) (\S+)" group="2"></grep>
+@@ -189,7 +189,7 @@
+    -->
+   <compiler_description>
+     <name>GNAT</name>
+-    <executable prefix="1">(.*-wrs-.*|.*-sysgo.*|.*-elf-.*|.*-eabi-.*|.*-eabispe-.*|avr-.*|.*-elinos-linux.*|.*-linux-gnu-|.*mingw32.*|.*-xcoff-.*|.*linux-android.*|arm-linux-gnueabi-|arm-linux-gnueabihf-|e500v2-gnu-linux-|powerpc-.*-linux.*-|.*-darwin.*-|.*-fastos.*|.*-freebsd.*|.*-qnx.*|.*-rtems.*)?gnatls</executable>
++    <executable prefix="1">(.*-wrs-.*|.*-sysgo.*|.*-elf-.*|.*-eabi-.*|.*-eabispe-.*|avr-.*|.*-elinos-linux.*|.*-linux-gnu-|.*mingw32.*|.*-xcoff-.*|.*linux-android.*|arm-linux-gnueabi-|arm-linux-gnueabihf-|e500v2-gnu-linux-|powerpc-.*-linux.*-|.*-darwin.*-|.*-fastos.*|.*-freebsd.*|.*-openbsd.*|.*-qnx.*|.*-rtems.*)?gnatls</executable>
+     <version>
+       <external>${PREFIX}gnatls -v --version</external>
+       <grep regexp="^GNATLS.+?(\d+(\.\d+)?)" group="1"></grep>
Index: patches/patch-gprconfig_kb-25_0_0_db_gnat_xml
===================================================================
RCS file: patches/patch-gprconfig_kb-25_0_0_db_gnat_xml
diff -N patches/patch-gprconfig_kb-25_0_0_db_gnat_xml
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ patches/patch-gprconfig_kb-25_0_0_db_gnat_xml	27 Mar 2026 16:24:07 -0000
@@ -0,0 +1,11 @@
+Index: gprconfig_kb-25.0.0/db/gnat.xml
+--- gprconfig_kb-25.0.0/db/gnat.xml.orig
++++ gprconfig_kb-25.0.0/db/gnat.xml
+@@ -259,6 +259,7 @@
+       <target name="^.*-fastos.*$" />
+       <target name="^.*-qnx[0-9]*$" />
+       <target name="^.*freebsd.*$" />
++      <target name="^.*openbsd.*$" />
+       <target name="^.*netbsd.*$" />
+       <target name="^.*dragonfly.*$" />
+       <target name="^.*cuda.*$" />
Index: patches/patch-gprconfig_kb-25_0_0_db_targetset_xml
===================================================================
RCS file: patches/patch-gprconfig_kb-25_0_0_db_targetset_xml
diff -N patches/patch-gprconfig_kb-25_0_0_db_targetset_xml
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ patches/patch-gprconfig_kb-25_0_0_db_targetset_xml	27 Mar 2026 16:24:07 -0000
@@ -0,0 +1,17 @@
+Index: gprconfig_kb-25.0.0/db/targetset.xml
+--- gprconfig_kb-25.0.0/db/targetset.xml.orig
++++ gprconfig_kb-25.0.0/db/targetset.xml
+@@ -238,6 +238,13 @@
+     <target>amd64-.*freebsd.*</target>
+   </targetset>
+ 
++  <!-- x86_64 OpenBSD -->
++  <targetset canonical="x86_64-openbsd">
++    <target>x86_64-openbsd</target>
++    <target>x86_64-.*openbsd.*</target>
++    <target>amd64-.*openbsd.*</target>
++  </targetset>
++
+   <!-- x86 NetBSD -->
+   <targetset canonical="x86-netbsd">
+     <target>x86-netbsd</target>
Index: pkg/DESCR
===================================================================
RCS file: pkg/DESCR
diff -N pkg/DESCR
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ pkg/DESCR	27 Mar 2026 16:24:07 -0000
@@ -0,0 +1,4 @@
+GPRbuild is a generic build tool designed for the construction of large
+multi-language systems organized into subsystems and libraries. It is
+well-suited for compiled languages supporting separate compilation, such as
+Ada, C, C++ and Fortran.
Index: pkg/PLIST
===================================================================
RCS file: pkg/PLIST
diff -N pkg/PLIST
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ pkg/PLIST	27 Mar 2026 16:24:07 -0000
@@ -0,0 +1,77 @@
+@bin bin/gprbuild
+@bin bin/gprclean
+@bin bin/gprconfig
+@bin bin/gprinstall
+@bin bin/gprls
+@bin bin/gprname
+libexec/gprbuild/
+@bin libexec/gprbuild/gprbind
+@bin libexec/gprbuild/gprlib
+share/gpr/
+share/gpr/_default.gpr
+share/gprconfig/
+share/gprconfig/0_default.xml
+share/gprconfig/aamp.xml
+share/gprconfig/aamp_compilers.xml
+share/gprconfig/aarch64-vx7.xml
+share/gprconfig/aarch64-vx7r2.xml
+share/gprconfig/arm-vx6.xml
+share/gprconfig/arm-vx7.xml
+share/gprconfig/arm-vx7r2.xml
+share/gprconfig/asis.xml
+share/gprconfig/asm.xml
+share/gprconfig/baselined.xml
+share/gprconfig/bin_img.xml
+share/gprconfig/c.xml
+share/gprconfig/clean.xml
+share/gprconfig/compilers-arm-vx7.xml
+share/gprconfig/compilers-asis.xml
+share/gprconfig/compilers-baselined.xml
+share/gprconfig/compilers-e500v2-vx6.xml
+share/gprconfig/compilers-e500v2-vx653.xml
+share/gprconfig/compilers-e500v2-vx7.xml
+share/gprconfig/compilers-e500v2-vx7r2.xml
+share/gprconfig/compilers-ppc-vx653.xml
+share/gprconfig/compilers-ppc-vx7.xml
+share/gprconfig/compilers-ppc-vx7r2.xml
+share/gprconfig/compilers-ppc64-vx7.xml
+share/gprconfig/compilers-ppc64-vx7r2.xml
+share/gprconfig/compilers-vxworks.xml
+share/gprconfig/compilers-x86-vx7.xml
+share/gprconfig/compilers-x86_64-vx7.xml
+share/gprconfig/compilers.xml
+share/gprconfig/cpp.xml
+share/gprconfig/cross.xml
+share/gprconfig/e500v2-vx6.xml
+share/gprconfig/e500v2-vx653.xml
+share/gprconfig/e500v2-vx7.xml
+share/gprconfig/e500v2-vx7r2.xml
+share/gprconfig/env.ent
+share/gprconfig/fallback_targets.xml
+share/gprconfig/fortran.xml
+share/gprconfig/gnat.xml
+share/gprconfig/linker.xml
+share/gprconfig/morello-vx7r2.xml
+share/gprconfig/nocompiler.xml
+share/gprconfig/ppc-vx6.xml
+share/gprconfig/ppc-vx653.xml
+share/gprconfig/ppc-vx7.xml
+share/gprconfig/ppc-vx7r2.xml
+share/gprconfig/ppc64-vx7.xml
+share/gprconfig/ppc64-vx7r2.xml
+share/gprconfig/shortcuts.ent
+share/gprconfig/targetset.xml
+share/gprconfig/tricore-compilers.xml
+share/gprconfig/tricore-configuration.xml
+share/gprconfig/tricore-target.xml
+share/gprconfig/vx6.ent
+share/gprconfig/vx653.ent
+share/gprconfig/vx7.ent
+share/gprconfig/vxworks.ent
+share/gprconfig/vxworks.xml
+share/gprconfig/windres.xml
+share/gprconfig/x86-vx6.xml
+share/gprconfig/x86-vx7.xml
+share/gprconfig/x86-vx7r2.xml
+share/gprconfig/x86_64-vx7.xml
+share/gprconfig/x86_64-vx7r2.xml
3 Likes

I think gprbuild/bootstrap.sh at bdfb879cf03643ec8e48a09ce07b08c4a6ff0263 · AdaCore/gprbuild · GitHub and autoconf-based setup for XmlAda xmlada/config.guess at 5e5b761eb827f458efd2043a5e9ab03e1a614720 · AdaCore/xmlada · GitHub will use the compiler pointed to by a CC environment variable.

I believe what you are referring to is for building GPRbuild itself, the issue comes in finding compilers with gprconfig after that when trying to use it. Building GPRbuild has no issues as you point out.

Thank you, it wasn’t obvious to me. It seems you have bootstrapped gprbuild already.

There is an issue with finding the Ada compiler, because OpenBSD uses egcc instead of gcc so the finding gets messed up.

The above is unclear, what is the problem…

In the FreeBSD world, the C compiler coming from FSF GNAT is installed under the respective toolchain directory:

> find /usr/local/gnat*/bin/gcc
/usr/local/gnat12/bin/gcc
/usr/local/gnat13/bin/gcc
/usr/local/gnat14/bin/gcc
/usr/local/gnat15/bin/gcc

This means that we I add /usr/local/gnat15/bin to the PATH I can simply run gcc - ada.mk « Uses « Mk - ports - FreeBSD ports tree we use this trick in the ports system as well.

The changes for FreeBSD in gprconfig_kb/db/compilers.xml at eed8e6866ce39f3e2b22493c32993bf859233334 · AdaCore/gprconfig_kb · GitHub seem to be minimal.

I don’t know how GNAT is deployed on OpenBSD, but if you are using something similar you might need not to use egcc at all, but again, I do not know the details of a problem.

1 Like

The problem comes when gprconfig_kb tries to match the binaries by using the gcc binary which causes issues with egcc being the actual name used by OpenBSD. Unfortunately in OpenBSD we do not have /usr/local/gnat15/bin or similar :frowning:.

Doing a ln -s /usr/local/bin/egcc /usr/local/bin/gcc is what works best for now.

I am currently a bit busy with other things but plan to come to this in the near future.

A lot of tools respect the environment variable CC=egcc but it isn’t as powerful as using a link and I always found it a bit awkward. There used to be gcc in base amd64 OpenBSD as license changes meant that they were stuck with I think gcc 8 but they have moved to clang now for amd64 whilst some other architectures still have gcc.

1 Like

I wonder how they install FSF GNAT, one could install gcc g++ and have the matching versions of runtime libraries available. Then bootstrap gprbuild using the gcc coming with the FSF package. Doing anything else is asking for trouble, as pointed out in another thread, such as

Building ada_language_server on OpenBSD