diff options
author | danfe <danfe@FreeBSD.org> | 2017-12-15 23:15:02 +0800 |
---|---|---|
committer | danfe <danfe@FreeBSD.org> | 2017-12-15 23:15:02 +0800 |
commit | b0493b6b4e48c713336af677533364af148006f0 (patch) | |
tree | 080005a892c8e1f640c448a0eaa329df561aa5ee /lang | |
parent | c931f095d66c5d8e03986f0b098ef843fc3fdda8 (diff) | |
download | freebsd-ports-gnome-b0493b6b4e48c713336af677533364af148006f0.tar.gz freebsd-ports-gnome-b0493b6b4e48c713336af677533364af148006f0.tar.zst freebsd-ports-gnome-b0493b6b4e48c713336af677533364af148006f0.zip |
Improve handling of the system architecture in `lang/ocaml'.
OCaml is using ARCH variable throughout its makefiles, which clashes with
our own variable of the same name. To workaround it, OCAML_ARCH variable
was introduced which is set based on ARCH, and makefiles later patched in
the `post-configure' target.
This approach does not scale well with porting OCaml to new architectures
as being fragile and sometimes making the build non-idempotent under some
circumstances.
Instead of "fixing" makefiles post-configure, rename ARCH to SYSTEM_ARCH:
this avoids the clash altogether and lets configure script to set correct
values for supported architectures in the first place with no adjustments
required afterwards.
Tested on: i386, amd64, powerpc
Diffstat (limited to 'lang')
-rw-r--r-- | lang/ocaml/Makefile | 13 | ||||
-rw-r--r-- | lang/ocaml/files/patch-configure | 9 |
2 files changed, 16 insertions, 6 deletions
diff --git a/lang/ocaml/Makefile b/lang/ocaml/Makefile index 7d804ead06cb..7516125081ca 100644 --- a/lang/ocaml/Makefile +++ b/lang/ocaml/Makefile @@ -99,10 +99,7 @@ CONFIGURE_ARGS+=-no-graph .include <bsd.port.pre.mk> .include "${FILESDIR}/manfiles" -OCAML_ARCH= ${ARCH:S/x86_64/amd64/:S/powerpc/power/:C/armv.*/arm/} - -.if defined(NO_PROFILE) || ${OCAML_ARCH:Mpower} || ${OCAML_ARCH:Mamd64} - +.if defined(NO_PROFILE) || ${ARCH:Mpowerpc} || ${ARCH:Mamd64} PLIST_SUB+= PROF="@comment " .else PLIST_SUB+= PROF="" @@ -119,6 +116,7 @@ post-extract: .endif post-patch: +# Don't hardcode GCC for depend target @${REINPLACE_CMD} \ -e '\|MKLIB=|s|ar rc|${AR} rc|' \ -e '\|RANLIB|s|ranlib|${RANLIB}|' \ @@ -127,7 +125,11 @@ post-patch: -e '\|mksharedlib=|s|$$bytecc|& $$bytecclinkopts|' \ -e 's|-lbfd -ldl|-lbfd $$dllib|' \ ${WRKSRC}/configure -# don't hardcode gcc for depend target + @${REINPLACE_CMD} -e 's,$$(ARCH),$$(SYSTEM_ARCH),' \ + ${WRKSRC}/Makefile ${WRKSRC}/asmrun/Makefile \ + ${WRKSRC}/otherlibs/systhreads/Makefile \ + ${WRKSRC}/testsuite/makefiles/Makefile.common \ + ${WRKSRC}/testsuite/tests/asmcomp/Makefile post-configure: # CFLAGS safeness @@ -141,7 +143,6 @@ post-configure: # user's umask(1) @${FIND} ${WRKDIR} -type f -name Makefile -print0 | \ ${XARGS} -0 -n 5 -x ${REINPLACE_CMD} -E \ - -e 's,\$$\(ARCH\),${OCAML_ARCH},g' \ -e 's,^(${PATTERN}+.*INSTALLDIR),\1\$${BSD_INSTALL_DATA} \4,' \ -e 's,^(${PATTERN}+.*BINDIR),\1\$${BSD_INSTALL_PROGRAM} \4,' \ -e 's,^(${PATTERN}+.*LIBDIR),\1\$${BSD_INSTALL_DATA} \4,' \ diff --git a/lang/ocaml/files/patch-configure b/lang/ocaml/files/patch-configure index e0295b61bd8c..b29f22d6b2b4 100644 --- a/lang/ocaml/files/patch-configure +++ b/lang/ocaml/files/patch-configure @@ -178,3 +178,12 @@ # Final twiddling of compiler options to work around known bugs nativeccprofopts="$nativecccompopts" +@@ -1723,7 +1728,7 @@ SYSLIB=-l\$(1) + MKLIB=${TOOLPREF}ar rc \$(1) \$(2); ${TOOLPREF}ranlib \$(1) + #ml let mklib out files opts = Printf.sprintf "${TOOLPREF}ar rc %s %s %s; ${TOOLPREF}ranlib %s" out opts files out;; + EOF +-echo "ARCH=$arch" >> Makefile ++echo "SYSTEM_ARCH=$arch" >> Makefile + echo "MODEL=$model" >> Makefile + echo "SYSTEM=$system" >> Makefile + echo "NATIVECC=$nativecc" >> Makefile |