CTSRD-CHERI / cheribsd-ports

FreeBSD ports tree adapted for CheriBSD.
https://CheriBSD.org
Other
5 stars 11 forks source link

math/gmp: Support purecap builds on Morello. #95

Closed bsdjhb closed 1 year ago

bsdjhb commented 1 year ago
bsdjhb commented 1 year ago

This is a prerequisite for building GDB as purecap.

kwitaszczyk commented 1 year ago

I'm fine with the current patch but it isn't sufficient to build it for CheriABI as math/gmp requires texinfo which we don't have for CheriABI.

I was thinking of the below patch (we disable DOCS NLS MANPAGES when building packages -- I should disable them in CheriBSD ports rather than external make.conf files) but gmp doesn't have an option to disable building docs/. It seems that patching configure for that is the only option here?

diff --git a/math/gmp/Makefile b/math/gmp/Makefile
index c3a8da71d5de..9e88757baa79 100644
--- a/math/gmp/Makefile
+++ b/math/gmp/Makefile
@@ -9,18 +9,16 @@ WWW=          https://gmplib.org/

 LICENSE=       LGPL3

-USES=          cpe libtool makeinfo tar:xz
+USES=          cpe libtool tar:xz

 CPE_VENDOR=    gmplib

 OPTIONS_DEFINE=        CPU_OPTS
+OPTIONS_DEFINE+=INFO MANPAGES
 CPU_OPTS_DESC= Enable assembly optimizations for your CPU

 HAS_CONFIGURE= yes
-CONFIGURE_ENV= MAKEINFO="${MAKEINFO} --no-split"
 CONFIGURE_ARGS=        --prefix=${PREFIX} \
-               --infodir=${PREFIX}/${INFO_PATH} \
-               --mandir=${PREFIX}/man \
                --enable-cxx

 USE_LDCONFIG=  yes
@@ -30,6 +28,18 @@ INFO=                gmp
 INSTALL_TARGET=        install-strip
 TEST_TARGET=   check

+.include <bsd.port.options.mk>
+
+.if ${PORT_OPTIONS:MINFO}
+USES+=                 makeinfo
+CONFIGURE_ENV+=        MAKEINFO="${MAKEINFO} --no-split"
+CONFIGURE_ARGS+=       --infodir=${PREFIX}/${INFO_PATH}
+.endif
+
+.if ${PORT_OPTIONS:MMANPAGES}
+CONFIGURE_ARGS+=       --mandir=${PREFIX}/man
+.endif
+
 .include <bsd.port.pre.mk>

 .if ${ARCH:Mmips*}
kwitaszczyk commented 1 year ago

I'd be fine with merging this now and fixing the docs/ issue separately.

bsdjhb commented 1 year ago

Huh, I built this as a port, and I guess it used the hybrid texinfo I had installed which is why I didn't run into that. Possibly it would be simpler to just install a hybrid texinfo as a build tool as we do for some other build tools since otherwise we will have to patch more ports in the future? (e.g. gdb itself also uses texinfo)

kwitaszczyk commented 1 year ago

So far, we were able to disable texinfo use cases with appropriate build system flags. If it turns out that multiple ports would have to be patched (because they don't provide flags to disable docs) then I agree using hybrid ABI texinfo makes sense. I should do an experimental to see how many extra packages we'd get with that.