Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 11 Sep 2018 00:15:00 +0000 (UTC)
From:      Johannes M Dieterich <jmd@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r479487 - in head/devel: flang flang-clang flang-clang/files flang/files
Message-ID:  <201809110015.w8B0F0af023256@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jmd
Date: Tue Sep 11 00:15:00 2018
New Revision: 479487
URL: https://svnweb.freebsd.org/changeset/ports/479487

Log:
  devel/flang[-clang]: remove wrapper script dependency.
  
  Patch flang-clang directly to link the required libraries and include the proper
  library directories. Hence, the need of the wrapper script (and it's non-optimal
  behavior) vanishes.
  
  While there, mark flang-clang broken on 10. Its LLVM6 base is not supported
  there and due to libpgmath only working on 12+, there is no need for it
  anyways.

Added:
  head/devel/flang-clang/files/
  head/devel/flang-clang/files/patch-lib_Driver_ToolChains_CommonArgs.cpp   (contents, props changed)
  head/devel/flang-clang/files/patch-lib_Driver_ToolChains_FreeBSD.cpp   (contents, props changed)
Deleted:
  head/devel/flang/files/flang.in
Modified:
  head/devel/flang-clang/Makefile
  head/devel/flang-clang/pkg-plist
  head/devel/flang/Makefile
  head/devel/flang/pkg-plist

Modified: head/devel/flang-clang/Makefile
==============================================================================
--- head/devel/flang-clang/Makefile	Mon Sep 10 22:28:59 2018	(r479486)
+++ head/devel/flang-clang/Makefile	Tue Sep 11 00:15:00 2018	(r479487)
@@ -3,7 +3,7 @@
 
 PORTNAME=	flang-clang
 DISTVERSION=	6.0-g20180904
-PORTREVISION=	1
+PORTREVISION=	2
 CATEGORIES=	devel lang
 
 MAINTAINER=	jmd@FreeBSD.org
@@ -15,6 +15,7 @@ LICENSE_FILE=	${WRKSRC}/LICENSE.TXT
 LICENSE_PERMS=	dist-mirror dist-sell pkg-mirror pkg-sell auto-accept
 
 ONLY_FOR_ARCHS=	amd64
+IGNORE_FreeBSD_10=	base compiler too old
 
 BUILD_DEPENDS=	llvm60>=0:devel/llvm60
 RUN_DEPENDS=	llvm60>=0:devel/llvm60
@@ -37,6 +38,11 @@ CMAKE_ARGS+=	-DLLVM_CONFIG=${LOCALBASE}/bin/llvm-confi
 
 CMAKE_INSTALL_PREFIX=	${PREFIX}/flang
 
+post-patch:
+	@${REINPLACE_CMD} -e 's|%%LOCALBASE%%|${LOCALBASE}|' ${WRKSRC}/lib/Driver/ToolChains/FreeBSD.cpp
+
 post-install:
 	@${GZIP_CMD} ${STAGEDIR}/${PREFIX}/flang/man/man1/scan-build.1
+	${RLN} ${STAGEDIR}${PREFIX}/flang/bin/flang ${STAGEDIR}${PREFIX}/bin/flang
+
 .include <bsd.port.mk>

Added: head/devel/flang-clang/files/patch-lib_Driver_ToolChains_CommonArgs.cpp
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/devel/flang-clang/files/patch-lib_Driver_ToolChains_CommonArgs.cpp	Tue Sep 11 00:15:00 2018	(r479487)
@@ -0,0 +1,18 @@
+--- lib/Driver/ToolChains/CommonArgs.cpp.orig	2018-09-10 18:28:59 UTC
++++ lib/Driver/ToolChains/CommonArgs.cpp
+@@ -183,6 +183,7 @@ void tools::AddLinkerInputs(const ToolChain &TC, const
+     // Add Fortan "main" before the first linker input
+     if (!SeenFirstLinkerInput) {
+       if (needFortranMain(D, Args)) {
++        CmdArgs.push_back("-lflangrti");
+         CmdArgs.push_back("-lflangmain");
+       }
+       SeenFirstLinkerInput = true;
+@@ -206,6 +207,7 @@ void tools::AddLinkerInputs(const ToolChain &TC, const
+   }
+ 
+   if (!SeenFirstLinkerInput && needFortranMain(D, Args)) {
++    CmdArgs.push_back("-lflangrti");
+     CmdArgs.push_back("-lflangmain");
+   }
+ 

Added: head/devel/flang-clang/files/patch-lib_Driver_ToolChains_FreeBSD.cpp
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/devel/flang-clang/files/patch-lib_Driver_ToolChains_FreeBSD.cpp	Tue Sep 11 00:15:00 2018	(r479487)
@@ -0,0 +1,26 @@
+--- lib/Driver/ToolChains/FreeBSD.cpp.orig	2018-08-24 17:46:18 UTC
++++ lib/Driver/ToolChains/FreeBSD.cpp
+@@ -196,6 +196,11 @@ void freebsd::Linker::ConstructJob(Compilation &C, con
+     assert(Output.isNothing() && "Invalid output.");
+   }
+ 
++  CmdArgs.push_back(Args.MakeArgString("-L%%LOCALBASE%%/flang/lib"));
++  CmdArgs.push_back(Args.MakeArgString("-L%%LOCALBASE%%/lib"));
++  CmdArgs.push_back(Args.MakeArgString("-L%%LOCALBASE%%/llvm60/lib"));
++  CmdArgs.push_back(Args.MakeArgString("-L/usr/lib"));
++
+   if (!Args.hasArg(options::OPT_nostdlib, options::OPT_nostartfiles)) {
+     const char *crt1 = nullptr;
+     if (!Args.hasArg(options::OPT_shared)) {
+@@ -263,6 +267,11 @@ void freebsd::Linker::ConstructJob(Compilation &C, con
+       CmdArgs.push_back("--as-needed");
+       CmdArgs.push_back("-lgcc_s");
+       CmdArgs.push_back("--no-as-needed");
++    }
++
++    if (!Args.hasArg(options::OPT_noFlangLibs)) {
++      CmdArgs.push_back("-lpgmath");
++      CmdArgs.push_back("-lflang"); 
+     }
+ 
+     if (Args.hasArg(options::OPT_pthread)) {

Modified: head/devel/flang-clang/pkg-plist
==============================================================================
--- head/devel/flang-clang/pkg-plist	Mon Sep 10 22:28:59 2018	(r479486)
+++ head/devel/flang-clang/pkg-plist	Tue Sep 11 00:15:00 2018	(r479487)
@@ -1,3 +1,4 @@
+bin/flang
 flang/bin/c-index-test
 flang/bin/clang
 flang/bin/clang++

Modified: head/devel/flang/Makefile
==============================================================================
--- head/devel/flang/Makefile	Mon Sep 10 22:28:59 2018	(r479486)
+++ head/devel/flang/Makefile	Tue Sep 11 00:15:00 2018	(r479487)
@@ -3,6 +3,7 @@
 
 PORTNAME=	flang
 DISTVERSION=	6.0-g20180904
+PORTREVISION=	1
 CATEGORIES=	devel
 
 MAINTAINER=	jmd@FreeBSD.org
@@ -49,11 +50,5 @@ MAKE_JOBS_UNSAFE=	yes
 
 post-patch:
 	@${CP} -r  ${WRKSRC}/tools/flang2/flang2exe/x86_64-Linux ${WRKSRC}/tools/flang2/flang2exe/x86_64-FreeBSD
-
-post-install:
-	@${SED} -e 's|%%PREFIX%%|${PREFIX}|g' \
-		< ${FILESDIR}/flang.in > \
-		${WRKDIR}/flang
-	${INSTALL_SCRIPT} ${WRKDIR}/flang ${STAGEDIR}/${PREFIX}/bin/flang
 
 .include <bsd.port.mk>

Modified: head/devel/flang/pkg-plist
==============================================================================
--- head/devel/flang/pkg-plist	Mon Sep 10 22:28:59 2018	(r479486)
+++ head/devel/flang/pkg-plist	Tue Sep 11 00:15:00 2018	(r479487)
@@ -1,4 +1,3 @@
-bin/flang
 flang/bin/flang1
 flang/bin/flang2
 flang/include/ieee_arithmetic.mod



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