Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 15 Dec 2017 15:15:02 +0000 (UTC)
From:      Alexey Dokuchaev <danfe@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r456400 - in head/lang/ocaml: . files
Message-ID:  <201712151515.vBFFF2kg039549@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: danfe
Date: Fri Dec 15 15:15:02 2017
New Revision: 456400
URL: https://svnweb.freebsd.org/changeset/ports/456400

Log:
  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

Modified:
  head/lang/ocaml/Makefile
  head/lang/ocaml/files/patch-configure

Modified: head/lang/ocaml/Makefile
==============================================================================
--- head/lang/ocaml/Makefile	Fri Dec 15 15:14:11 2017	(r456399)
+++ head/lang/ocaml/Makefile	Fri Dec 15 15:15:02 2017	(r456400)
@@ -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,' \

Modified: head/lang/ocaml/files/patch-configure
==============================================================================
--- head/lang/ocaml/files/patch-configure	Fri Dec 15 15:14:11 2017	(r456399)
+++ head/lang/ocaml/files/patch-configure	Fri Dec 15 15:15:02 2017	(r456400)
@@ -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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201712151515.vBFFF2kg039549>