Commit 05526dd3 authored by jmd's avatar jmd
Browse files

new ports: devel/flang and devel/flang-clang.

Welcome the freshly released flang Fortran LLVM compiler (currently only for amd6) ! It needs as a companion a custom clang, added as flang-clang.

Reviewed by:	swills (mentor)
Approved by:	swills (mentor)
Differential Revision:	https://reviews.freebsd.org/D10805
parent 25c0258c
......@@ -579,6 +579,8 @@
SUBDIR += fifechan
SUBDIR += firmware-utils
SUBDIR += fistgen
SUBDIR += flang
SUBDIR += flang-clang
SUBDIR += flatbuffers
SUBDIR += flatzebra
SUBDIR += flex-sdk
......
# Created by: Johannes M Dieterich <jmd@FreeBSD.org>
# $FreeBSD$
PORTNAME= flang-clang
DISTVERSION= 3.9-20170518
CATEGORIES= devel lang
MAINTAINER= jmd@FreeBSD.org
COMMENT= Fortran compiler targeting LLVM (modified clang part)
LICENSE= LLVM
LICENSE_NAME= LLVM Release License
LICENSE_FILE= ${WRKSRC}/LICENSE.TXT
LICENSE_PERMS= dist-mirror dist-sell pkg-mirror pkg-sell auto-accept
BUILD_DEPENDS= llvm39>=0:devel/llvm39 \
openmp>=0:devel/openmp
RUN_DEPENDS= llvm39>=0:devel/llvm39 \
openmp>=0:devel/openmp
USE_LDCONFIG= ${PREFIX}/flang/lib
USES= cmake:outsource compiler:c++11-lib libedit ninja tar:xz perl5 \
python shebangfix
USE_GNOME+= libxml2
SHEBANG_FILES= tools/scan-view/bin/scan-view \
tools/clang-format/git-clang-format \
tools/clang-format/clang-format-diff.py
USE_GITHUB= yes
GH_ACCOUNT= flang-compiler
GH_PROJECT= clang
GH_TAGNAME= edf56fd
CMAKE_ARGS+= -DLLVM_CONFIG=${LOCALBASE}/bin/llvm-config39
CMAKE_INSTALL_PREFIX= ${PREFIX}/flang
post-install:
@${GZIP_CMD} ${STAGEDIR}/${PREFIX}/flang/man/man1/scan-build.1
.include <bsd.port.mk>
TIMESTAMP = 1495120245
SHA256 (flang-compiler-clang-3.9-20170518-edf56fd_GH0.tar.gz) = ff5dfcc322ceb247dffe10300a0a6072face2ef458c413e2dd70fb5c8e51beaa
SIZE (flang-compiler-clang-3.9-20170518-edf56fd_GH0.tar.gz) = 14365634
Fortran compiler targeting LLVM (modified clang part)
WWW: https://github.com/flang-compiler/clang
This diff is collapsed.
# Created by: Johannes M Dieterich <jmd@FreeBSD.org>
# $FreeBSD$
PORTNAME= flang
DISTVERSION= 3.9-20170518
CATEGORIES= devel
MAINTAINER= jmd@FreeBSD.org
COMMENT= Fortran compiler targeting LLVM
LICENSE= APACHE20
LICENSE_FILE= ${WRKSRC}/LICENSE.txt
BUILD_DEPENDS= llvm39>=0:devel/llvm39 \
openmp>=0:devel/openmp \
flang-clang>=0:devel/flang-clang
RUN_DEPENDS= llvm39>=0:devel/llvm39 \
openmp>=0:devel/openmp \
flang-clang>=0:devel/flang-clang
ONLY_FOR_ARCHS= amd64
ONLY_FOR_ARCHS_REASON_amd64= for now only builds and is supported on amd64
USE_LDCONFIG= ${PREFIX}/flang/lib
USES= cmake:outsource compiler:c++11-lib libedit perl5 tar:xz \
shebangfix
USES_PYTHON?= python:build
USES+= ${_USES_PYTHON}
USE_GITHUB= yes
GH_ACCOUNT= flang-compiler
GH_TAGNAME= a9ccdd7
CMAKE_ARGS+= -DLLVM_CONFIG=${LOCALBASE}/bin/llvm-config39 \
-DCMAKE_CXX_COMPILER=${LOCALBASE}flang/bin/clang++ \
-DCMAKE_C_COMPILER=${LOCALBASE}/flang/bin/clang \
-DCMAKE_Fortran_COMPILER=${LOCALBASE}/flang/bin/flang
CMAKE_INSTALL_PREFIX= ${PREFIX}/flang
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>
TIMESTAMP = 1495121602
SHA256 (flang-compiler-flang-3.9-20170518-a9ccdd7_GH0.tar.gz) = ddcd8d00bf4429ca63a47d6509dc4c77708afbeda90133121bdb63505fa005b9
SIZE (flang-compiler-flang-3.9-20170518-a9ccdd7_GH0.tar.gz) = 3574207
#!/bin/sh
%%PREFIX%%/flang/bin/flang -L%%PREFIX%%/flang/lib -lflang -lflangmain -lflangrti -lexecinfo $@
--- CMakeLists.txt.orig 2017-05-17 00:40:01 UTC
+++ CMakeLists.txt
@@ -23,7 +23,7 @@ cmake_minimum_required(VERSION 2.8)
SET(CMAKE_Fortran_COMPILER_WORKS 1)
if( NOT DEFINED TARGET_ARCHITECTURE )
- execute_process(COMMAND uname -i OUTPUT_STRIP_TRAILING_WHITESPACE
+ execute_process(COMMAND uname -m OUTPUT_STRIP_TRAILING_WHITESPACE
OUTPUT_VARIABLE TARGET_ARCHITECTURE)
execute_process(COMMAND uname -s OUTPUT_STRIP_TRAILING_WHITESPACE
OUTPUT_VARIABLE TARGET_OS)
@@ -48,6 +48,19 @@ if( ${TARGET_OS} STREQUAL "Linux" )
message("Unsupported architecture: ${TARGET_ARCHITECTURE}" )
return()
endif()
+elseif( ${TARGET_OS} STREQUAL "FreeBSD" )
+ set(OS "FREEBSD")
+ set(OSNAME "FreeBSD")
+ # this is very hacky!
+ if( ${TARGET_ARCHITECTURE} STREQUAL "amd64" )
+ set(ARCHNAME x86-64)
+ set(ARCH X86)
+ set(WRDSZ 64)
+ set(TARGET_ARCHITECTURE x86_64)
+ else()
+ message("Unsupported architecture: ${TARGET_ARCHITECTURE}" )
+ return()
+ endif()
else()
message("Unsupported OS: ${TARGET_OS}" )
return()
@@ -56,7 +69,8 @@ endif()
# The cmake documentation states that these are set. They are not so we
# set them here
set(CMAKE_HOST_SYSTEM_NAME ${TARGET_OS})
-set(CMAKE_HOST_SYSTEM_PROCESSOR ${TARGET_ARCHITECTURE})
+# also a hack
+set(CMAKE_HOST_SYSTEM_PROCESSOR "x86-64")
# If we are not building as a part of LLVM, build Flang as an
# standalone project, using LLVM as an external library:
@@ -292,7 +306,7 @@ endif()
# Add appropriate flags for GCC
if (LLVM_COMPILER_IS_GCC_COMPATIBLE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -fno-common -Woverloaded-virtual -Wcast-qual -fno-strict-aliasing -pedantic -Wno-long-long -Wall -W -Wno-unused-parameter -Wwrite-strings")
- set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror")
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-macro-redefined -Wno-logical-not-parentheses -Wno-unknown-warning-option")
endif ()
if (APPLE)
--- runtime/flang/async.c.orig 2017-05-17 00:40:01 UTC
+++ runtime/flang/async.c
@@ -27,6 +27,8 @@
* Fio_asy_close - called from close
*/
+#include <sys/signal.h>
+
#if !defined(INTERIX86) && !defined(TARGET_INTERIX) && !defined(TARGET_OSX) && !defined(CRAY) && !defined(TARGET_WIN_X8632)
#if !defined(TARGET_WIN_X8664)
@@ -44,7 +46,6 @@
#include "stdioInterf.h"
#include "async.h"
-
#define FIO_MAX_ASYNC_TRANSACTIONS 16
/* one struct per file */
@@ -320,7 +321,7 @@ Fio_asy_read(struct asy *asy, void *adr,
asy->aiocb[tn].aio_reqprio = 0;
asy->aiocb[tn].aio_buf = adr;
asy->aiocb[tn].aio_nbytes = len;
- memset(&(asy->aiocb[tn].aio_sigevent), 0, sizeof(sigevent_t));
+ memset(&(asy->aiocb[tn].aio_sigevent), 0, sizeof(struct sigevent));
asy->aiocb[tn].aio_offset = asy->atd[tn].off;
n = aio_read(&(asy->aiocb[tn]));
#endif
@@ -374,7 +375,7 @@ Fio_asy_write(struct asy *asy, void *adr
asy->aiocb[tn].aio_reqprio = 0;
asy->aiocb[tn].aio_buf = adr;
asy->aiocb[tn].aio_nbytes = len;
- memset(&(asy->aiocb[tn].aio_sigevent), 0, sizeof(sigevent_t));
+ memset(&(asy->aiocb[tn].aio_sigevent), 0, sizeof(struct sigevent));
asy->aiocb[tn].aio_offset = asy->atd[tn].off;
n = aio_write(&(asy->aiocb[tn]));
#endif
--- runtime/flang/cdexp.c.orig 2017-05-17 00:40:01 UTC
+++ runtime/flang/cdexp.c
@@ -22,7 +22,8 @@ __mth_i_cdexp(dcmplx_t *dcmplx, double r
{
double x, y, z;
x = exp(real);
- sincos(imag, &z, &y);
+ z = sin(imag);
+ y = cos(imag);
y *= x;
z *= x;
d_dummy(y, z); /* should leave y & z in appropriate
--- runtime/flang/cexp.c.orig 2017-05-17 00:40:01 UTC
+++ runtime/flang/cexp.c
@@ -22,7 +22,8 @@ __mth_i_cexp(cmplx_t *cmplx, float real,
{
float x, y, z;
x = exp(real);
- sincosf(imag, &z, &y);
+ z = sinf(imag);
+ y = cosf(imag);
y *= x;
z *= x;
r_dummy(y, z); /* should leave y & z in appropriate
--- runtime/flang/stime3f.c.orig 2017-05-17 00:40:01 UTC
+++ runtime/flang/stime3f.c
@@ -27,13 +27,7 @@
int ENT3F(STIME, stime)(int *tp)
{
- int i;
- time_t t = *tp;
-
- if ((i = stime(&t)))
- i = __io_errno();
-
- return i;
+ return EPERM;
}
#endif /* !WINNT */
--- runtime/flangrti/dumpregs.h.orig 2017-05-17 00:40:01 UTC
+++ runtime/flangrti/dumpregs.h
@@ -21,6 +21,6 @@
* Declare routines that access the machine registers
*/
-void dumpregs(gregset_t *regs);
-gregset_t *getRegs(ucontext_t *u);
+void dumpregs(void *regs);
+void *getRegs(ucontext_t *u);
--- runtime/flangrti/erfc_scaled.c.orig 2017-05-17 00:40:01 UTC
+++ runtime/flangrti/erfc_scaled.c
@@ -19,7 +19,7 @@
#pragma global - Mx, 6, 0x100
#include "mthdecls.h"
-#if defined(TARGET_WIN) || defined(win32) || defined(TARGET_OSX)
+#if defined(TARGET_WIN) || defined(win32) || defined(TARGET_OSX) || defined(__FreeBSD__)
#include <float.h>
#else
#include <values.h>
--- runtime/flangrti/erfc_scaledf.c.orig 2017-05-17 00:40:01 UTC
+++ runtime/flangrti/erfc_scaledf.c
@@ -19,7 +19,7 @@
#pragma global - Mx, 6, 0x100
#include "mthdecls.h"
-#if defined(TARGET_WIN) || defined(win32) || defined(TARGET_OSX)
+#if defined(TARGET_WIN) || defined(win32) || defined(TARGET_OSX) || defined(__FreeBSD__)
#include <float.h>
#else
#include <values.h>
--- runtime/flangrti/iostdinit.c.orig 2017-05-17 00:40:01 UTC
+++ runtime/flangrti/iostdinit.c
@@ -160,7 +160,7 @@ __io_ferror(void *p)
int
__io_getfd(void *fp)
{
- return (((FILE *)fp)->_fileno);
+ return (((FILE *)fp)->_file);
}
/* is a tty? */
@@ -270,14 +270,14 @@ extern long *_imp___timezone_dll; /* for
#define timezone _timezone /* cygnus, timezone is usually a function */
#endif
-#elif !defined(DEC) && !defined(IBM) && !defined(ST100_V1_2) && !defined(OSX86) /* !defined(WINNT) */
+#elif !defined(DEC) && !defined(IBM) && !defined(ST100_V1_2) && !defined(OSX86) && !defined(__FreeBSD__) /* !defined(WINNT) */
extern time_t timezone; /* for the rest */
#endif
int
__io_timezone(void *tm)
{
-#if defined(SUN4) || defined(PPC) || defined(OSX86)
+#if defined(SUN4) || defined(PPC) || defined(OSX86) || defined(__FreeBSD__)
return ((struct tm *)tm)->tm_gmtoff;
#elif defined(WINNT) || defined(WIN64) || defined(WIN32)
return (0);
--- runtime/flangrti/trace_lin.c.orig 2017-05-17 00:40:01 UTC
+++ runtime/flangrti/trace_lin.c
@@ -85,7 +85,7 @@ static struct sigs sigs[] = {
{0, CODNULL, NULL} /* end of list */
};
-static gregset_t *regs; /* pointer to regs at signal */
+static void *regs; /* pointer to regs at signal */
/* walk the stack back */
@@ -99,7 +99,7 @@ __abort_trace(int skip)
char **strings;
size_t i, n;
- if (regs != (gregset_t *)0) {
+ if (regs != (void *)0) {
dumpregs(regs);
}
--- runtime/flangrti/x86_64-Linux/dumpregs.c.orig 2017-05-17 00:40:01 UTC
+++ runtime/flangrti/x86_64-Linux/dumpregs.c
@@ -40,7 +40,7 @@
#define RSP 15
#define RIP 16
-#if defined(TARGET_OSX) || defined(TARGET_WIN)
+#if defined(TARGET_OSX) || defined(TARGET_WIN) || defined(__FreeBSD__)
/* no gregs and/or ucontext defined in for OSX or Windows */
void *
getRegs(void *u)
Fortran compiler targeting LLVM (modified clang part)
WWW: https://github.com/flang-compiler/clang
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment