summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--math/Makefile1
-rw-r--r--math/libpgmath/Makefile38
-rw-r--r--math/libpgmath/distinfo3
-rw-r--r--math/libpgmath/files/patch-lib_CMakeLists.txt48
-rw-r--r--math/libpgmath/files/patch-lib_common_CMakeLists.txt92
-rw-r--r--math/libpgmath/files/patch-lib_common_acos_fma3_CMakeLists.txt13
-rw-r--r--math/libpgmath/files/patch-lib_common_asin_fma3_CMakeLists.txt13
-rw-r--r--math/libpgmath/files/patch-lib_common_cos_CMakeLists.txt13
-rw-r--r--math/libpgmath/files/patch-lib_common_dispatch.c14
-rw-r--r--math/libpgmath/files/patch-lib_common_exp_fma3_CMakeLists.txt13
-rw-r--r--math/libpgmath/files/patch-lib_common_log_fma3_CMakeLists.txt13
-rw-r--r--math/libpgmath/files/patch-lib_common_pow_fma3_CMakeLists.txt13
-rw-r--r--math/libpgmath/files/patch-lib_common_powi_CMakeLists.txt13
-rw-r--r--math/libpgmath/files/patch-lib_common_sin_CMakeLists.txt13
-rw-r--r--math/libpgmath/files/patch-lib_common_sincos_CMakeLists.txt13
-rw-r--r--math/libpgmath/files/patch-lib_x86__64_CMakeLists.txt11
-rw-r--r--math/libpgmath/files/patch-lib_x86__64_fast_CMakeLists.txt11
-rw-r--r--math/libpgmath/files/patch-lib_x86__64_libm__amd.h23
-rw-r--r--math/libpgmath/pkg-descr6
19 files changed, 364 insertions, 0 deletions
diff --git a/math/Makefile b/math/Makefile
index dc3c46f32b64..ffc16c95c09e 100644
--- a/math/Makefile
+++ b/math/Makefile
@@ -312,6 +312,7 @@
SUBDIR += libmissing
SUBDIR += libocas
SUBDIR += liborigin
+ SUBDIR += libpgmath
SUBDIR += libpoly
SUBDIR += libqalculate
SUBDIR += libranlip
diff --git a/math/libpgmath/Makefile b/math/libpgmath/Makefile
new file mode 100644
index 000000000000..173f06fbd6fe
--- /dev/null
+++ b/math/libpgmath/Makefile
@@ -0,0 +1,38 @@
+# Created by: Johannes M Dieterich <jmd@FreeBSD.org>
+# $FreeBSD$
+
+PORTNAME= libpgmath
+DISTVERSION= g20180904
+CATEGORIES= math
+
+MAINTAINER= jmd@FreeBSD.org
+COMMENT= Compiler-callable math intrinsics library
+
+LICENSE= APACHE20
+LICENSE_FILE= ${WRKSRC}/LICENSE.txt
+
+ONLY_FOR_ARCHS= amd64
+IGNORE_FreeBSD_10= not supported on older than 12.0, no cpuid bit support
+IGNORE_FreeBSD_11= not supported on older than 12.0, no cpuid bit support
+
+BUILD_DEPENDS= llvm60>=0:devel/llvm60
+RUN_DEPENDS= llvm60>=0:devel/llvm60
+
+USES= cmake:outsource compiler:c++11-lib
+USE_LDCONFIG= yes
+
+USE_GITHUB= yes
+GH_ACCOUNT= flang-compiler
+GH_PROJECT= flang
+GH_TAGNAME= 53e368b
+
+CMAKE_ARGS+= -DLLVM_CONFIG=${LOCALBASE}/bin/llvm-config60 \
+ -DCMAKE_CXX_COMPILER=${LOCALBASE}/llvm60/bin/clang++ \
+ -DCMAKE_C_COMPILER=${LOCALBASE}/llvm60/bin/clang
+
+WRKSRC_SUBDIR= runtime/libpgmath
+
+PLIST_FILES= lib/libpgmath.a \
+ lib/libpgmath.so
+
+.include <bsd.port.mk>
diff --git a/math/libpgmath/distinfo b/math/libpgmath/distinfo
new file mode 100644
index 000000000000..84039d2d7ae8
--- /dev/null
+++ b/math/libpgmath/distinfo
@@ -0,0 +1,3 @@
+TIMESTAMP = 1536097093
+SHA256 (flang-compiler-flang-g20180904-53e368b_GH0.tar.gz) = e9cf2589c6cbad3ec953f4622ee60f7746c6921518d6905aef0526705d83c888
+SIZE (flang-compiler-flang-g20180904-53e368b_GH0.tar.gz) = 4603486
diff --git a/math/libpgmath/files/patch-lib_CMakeLists.txt b/math/libpgmath/files/patch-lib_CMakeLists.txt
new file mode 100644
index 000000000000..51078bd118c0
--- /dev/null
+++ b/math/libpgmath/files/patch-lib_CMakeLists.txt
@@ -0,0 +1,48 @@
+--- lib/CMakeLists.txt.orig 2018-09-03 06:03:48 UTC
++++ lib/CMakeLists.txt
+@@ -16,19 +16,23 @@
+
+ # This value will be the same as CMAKE_SYSTEM_PROCESSOR
+ set(PROCESSOR ${CMAKE_SYSTEM_PROCESSOR})
+-if(${LIBPGMATH_WITH_GENERIC} OR (NOT ${CMAKE_SYSTEM_PROCESSOR} MATCHES "x86_64|aarch64"))
++if(${LIBPGMATH_WITH_GENERIC} OR (NOT ${CMAKE_SYSTEM_PROCESSOR} MATCHES "x86_64|amd64|aarch64"))
+ set(PROCESSOR "generic")
+ endif()
+
++if(${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD" AND ${PROCESSOR} MATCHES "amd64")
++ set(PROCESSOR "x86_64")
++endif()
++
+ set_property(GLOBAL APPEND PROPERTY "TARGET_OBJECTS")
+
+-if(${CMAKE_SYSTEM_PROCESSOR} MATCHES "x86_64|AMD64" AND NOT ${LIBPGMATH_WITH_GENERIC})
+- if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
++if(${CMAKE_SYSTEM_PROCESSOR} MATCHES "x86_64|AMD64|amd64" AND NOT ${LIBPGMATH_WITH_GENERIC})
++ if(${CMAKE_SYSTEM_NAME} MATCHES "Linux|FreeBSD")
+
+ set(DEFINITIONS_L1
+ HOST_LINUX LINUX LINUX86 LINUX8664 MAXCPUS=256 MAXCPUSL=8 MAXCPUSR=8
+ TARGET_LINUX TARGET_LINUX_X86 TARGET_LINUX_X8664 TARGET_X86 TARGET_X8664
+- __gnu_linux__ PG_PIC)
++ __gnu_linux__ linux PG_PIC)
+ set(FLAGS_L1 "-m64 -O3 ")
+
+ set(DEFINITIONS_L2
+@@ -210,7 +214,7 @@ else()
+ endif()
+
+ include_directories(common)
+-if(${PROCESSOR} MATCHES "x86_64|AMD64" AND NOT ${LIBPGMATH_WITH_GENERIC})
++if(${PROCESSOR} MATCHES "x86_64|AMD64|amd64" AND NOT ${LIBPGMATH_WITH_GENERIC})
+ include_directories(x86_64)
+ # elseif(${CMAKE_SYSTEM_PROCESSOR} MATCHES "ppc64le")
+ # include_directories(ppc64le)
+@@ -223,7 +227,7 @@ endif()
+
+ # Add directories to build
+ add_subdirectory(common)
+-if(${PROCESSOR} MATCHES "x86_64|AMD64" AND NOT ${LIBPGMATH_WITH_GENERIC})
++if(${PROCESSOR} MATCHES "x86_64|AMD64|amd64" AND NOT ${LIBPGMATH_WITH_GENERIC})
+ add_subdirectory(x86_64)
+ # elseif(${CMAKE_SYSTEM_PROCESSOR} MATCHES "ppc64le")
+ # add_subdirectory(ppc64le)
diff --git a/math/libpgmath/files/patch-lib_common_CMakeLists.txt b/math/libpgmath/files/patch-lib_common_CMakeLists.txt
new file mode 100644
index 000000000000..3875fea39f8e
--- /dev/null
+++ b/math/libpgmath/files/patch-lib_common_CMakeLists.txt
@@ -0,0 +1,92 @@
+--- lib/common/CMakeLists.txt.orig 2018-09-03 06:03:48 UTC
++++ lib/common/CMakeLists.txt
+@@ -17,7 +17,7 @@
+ include_directories(${CMAKE_CURRENT_SOURCE_DIR})
+
+ if(NOT ${CMAKE_SYSTEM_NAME} MATCHES "Windows")
+- if(${CMAKE_SYSTEM_PROCESSOR} MATCHES "x86_64|ppc64le|aarch64" AND NOT ${LIBPGMATH_WITH_GENERIC})
++ if(${CMAKE_SYSTEM_PROCESSOR} MATCHES "x86_64|amd64|ppc64le|aarch64" AND NOT ${LIBPGMATH_WITH_GENERIC})
+ add_subdirectory("acos")
+ add_subdirectory("asin")
+ add_subdirectory("exp")
+@@ -33,8 +33,8 @@ get_property(FLAGS GLOBAL PROPERTY "FLAGS_L1")
+ get_property(DEFINITIONS GLOBAL PROPERTY "DEFINITIONS_L1")
+
+ set(SRCS)
+-if(${CMAKE_SYSTEM_PROCESSOR} MATCHES "x86_64" AND NOT ${LIBPGMATH_WITH_GENERIC})
+- if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
++if(${CMAKE_SYSTEM_PROCESSOR} MATCHES "x86_64|amd64" AND NOT ${LIBPGMATH_WITH_GENERIC})
++ if(${CMAKE_SYSTEM_NAME} MATCHES "Linux|FreeBSD")
+ add_subdirectory("cos")
+ add_subdirectory("cosf")
+ add_subdirectory("sincosf")
+@@ -278,13 +278,13 @@ libmath_add_object_library("${SRCS}" "${FLAGS}" "${DEF
+ set(DEFINITIONS_CMPLX ${DEFINITIONS} MTH_CMPLX_C99_ABI)
+ libmath_add_object_library("${MTH_CMPLX_SRCS}" "${FLAGS}" "${DEFINITIONS_CMPLX}" "common_mth_cmplx")
+
+-if(${CMAKE_SYSTEM_PROCESSOR} MATCHES "x86_64" AND NOT ${LIBPGMATH_WITH_GENERIC})
++if(${CMAKE_SYSTEM_PROCESSOR} MATCHES "x86_64|amd64" AND NOT ${LIBPGMATH_WITH_GENERIC})
+ # Generate mth_128mask.c
+ set(TARGET_NAME "mth_128mask")
+ add_custom_command(OUTPUT ${TARGET_NAME}.c PRE_BUILD
+ COMMAND awk -v MAX_VREG_SIZE=128 -v TARGET=X8664 -f ${LIBPGMATH_TOOLS_DIR}/mth_mask.awk > ${TARGET_NAME}.c)
+ add_custom_target(${TARGET_NAME} ALL DEPENDS "${TARGET_NAME}.c")
+- if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
++ if(${CMAKE_SYSTEM_NAME} MATCHES "Linux|FreeBSD")
+ set_property(SOURCE ${TARGET_NAME}.c APPEND_STRING PROPERTY COMPILE_FLAGS "-march=core2")
+ elseif(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
+ set_property(SOURCE ${TARGET_NAME}.c APPEND_STRING PROPERTY COMPILE_FLAGS "-msse2")
+@@ -297,7 +297,7 @@ if(${CMAKE_SYSTEM_PROCESSOR} MATCHES "x86_64" AND NOT
+ add_custom_command(OUTPUT ${TARGET_NAME}.c PRE_BUILD
+ COMMAND awk -v MAX_VREG_SIZE=128 -v TARGET=X8664 -f ${LIBPGMATH_TOOLS_DIR}/mth_generic_frp.awk > ${TARGET_NAME}.c)
+ add_custom_target(${TARGET_NAME} ALL DEPENDS "${TARGET_NAME}.c")
+- if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
++ if(${CMAKE_SYSTEM_NAME} MATCHES "Linux|FreeBSD")
+ set_property(SOURCE ${TARGET_NAME}.c APPEND_STRING PROPERTY COMPILE_FLAGS "-march=core2")
+ elseif(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
+ set_property(SOURCE ${TARGET_NAME}.c APPEND_STRING PROPERTY COMPILE_FLAGS "-msse2")
+@@ -310,7 +310,7 @@ if(${CMAKE_SYSTEM_PROCESSOR} MATCHES "x86_64" AND NOT
+ add_custom_command(OUTPUT ${TARGET_NAME}.c PRE_BUILD
+ COMMAND awk -v MAX_VREG_SIZE=256 -v TARGET=X8664 -f ${LIBPGMATH_TOOLS_DIR}/mth_mask.awk > ${TARGET_NAME}.c)
+ add_custom_target(${TARGET_NAME} ALL DEPENDS "${TARGET_NAME}.c")
+- if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
++ if(${CMAKE_SYSTEM_NAME} MATCHES "Linux|FreeBSD")
+ set_property(SOURCE ${TARGET_NAME}.c APPEND_STRING PROPERTY COMPILE_FLAGS "-march=sandybridge")
+ elseif(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
+ set_property(SOURCE ${TARGET_NAME}.c APPEND_STRING PROPERTY COMPILE_FLAGS "-mavx")
+@@ -323,7 +323,7 @@ if(${CMAKE_SYSTEM_PROCESSOR} MATCHES "x86_64" AND NOT
+ add_custom_command(OUTPUT ${TARGET_NAME}.c PRE_BUILD
+ COMMAND awk -v MAX_VREG_SIZE=256 -v TARGET=X8664 -f ${LIBPGMATH_TOOLS_DIR}/mth_generic_frp.awk > ${TARGET_NAME}.c)
+ add_custom_target(${TARGET_NAME} ALL DEPENDS "${TARGET_NAME}.c")
+- if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
++ if(${CMAKE_SYSTEM_NAME} MATCHES "Linux|FreeBSD")
+ set_property(SOURCE ${TARGET_NAME}.c APPEND_STRING PROPERTY COMPILE_FLAGS "-march=sandybridge")
+ elseif(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
+ set_property(SOURCE ${TARGET_NAME}.c APPEND_STRING PROPERTY COMPILE_FLAGS "-mavx")
+@@ -337,7 +337,7 @@ if(${CMAKE_SYSTEM_PROCESSOR} MATCHES "x86_64" AND NOT
+ COMMAND awk -v MAX_VREG_SIZE=512 -v TARGET=X8664 -f ${LIBPGMATH_TOOLS_DIR}/mth_mask.awk > ${TARGET_NAME}.c)
+ add_custom_target(${TARGET_NAME} ALL DEPENDS "${TARGET_NAME}.c")
+ set_property(SOURCE ${TARGET_NAME}.c APPEND_STRING PROPERTY COMPILE_FLAGS "")
+- if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
++ if(${CMAKE_SYSTEM_NAME} MATCHES "Linux|FreeBSD")
+ set_property(SOURCE ${TARGET_NAME}.c APPEND_STRING PROPERTY COMPILE_FLAGS "-mtune=knl -march=knl")
+ elseif(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
+ set_property(SOURCE ${TARGET_NAME}.c APPEND_STRING PROPERTY COMPILE_FLAGS "-mavx512f -mfma")
+@@ -350,7 +350,7 @@ if(${CMAKE_SYSTEM_PROCESSOR} MATCHES "x86_64" AND NOT
+ add_custom_command(OUTPUT ${TARGET_NAME}.c PRE_BUILD
+ COMMAND awk -v MAX_VREG_SIZE=512 -v TARGET=X8664 -f ${LIBPGMATH_TOOLS_DIR}/mth_generic_frp.awk > ${TARGET_NAME}.c)
+ add_custom_target(${TARGET_NAME} ALL DEPENDS "${TARGET_NAME}.c")
+- if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
++ if(${CMAKE_SYSTEM_NAME} MATCHES "Linux|FreeBSD")
+ set_property(SOURCE ${TARGET_NAME}.c APPEND_STRING PROPERTY COMPILE_FLAGS "-mtune=knl -march=knl")
+ elseif(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
+ set_property(SOURCE ${TARGET_NAME}.c APPEND_STRING PROPERTY COMPILE_FLAGS "-mavx512f -mfma")
+@@ -363,7 +363,7 @@ if(${CMAKE_SYSTEM_PROCESSOR} MATCHES "x86_64" AND NOT
+ add_custom_command(OUTPUT ${TARGET_NAME}.c PRE_BUILD
+ COMMAND awk -v MAX_VREG_SIZE=512 -v TARGET=X8664 -f ${LIBPGMATH_TOOLS_DIR}/mth_z2yy.awk > ${TARGET_NAME}.c)
+ add_custom_target(${TARGET_NAME} ALL DEPENDS "${TARGET_NAME}.c")
+- if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
++ if(${CMAKE_SYSTEM_NAME} MATCHES "Linux|FreeBSD")
+ set_property(SOURCE ${TARGET_NAME}.c APPEND_STRING PROPERTY COMPILE_FLAGS "-mtune=knl -march=knl")
+ elseif(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
+ set_property(SOURCE ${TARGET_NAME}.c APPEND_STRING PROPERTY COMPILE_FLAGS "-mavx512f -mfma")
diff --git a/math/libpgmath/files/patch-lib_common_acos_fma3_CMakeLists.txt b/math/libpgmath/files/patch-lib_common_acos_fma3_CMakeLists.txt
new file mode 100644
index 000000000000..493ef9f12338
--- /dev/null
+++ b/math/libpgmath/files/patch-lib_common_acos_fma3_CMakeLists.txt
@@ -0,0 +1,13 @@
+--- lib/common/acos/fma3/CMakeLists.txt.orig 2018-09-03 06:03:48 UTC
++++ lib/common/acos/fma3/CMakeLists.txt
+@@ -21,8 +21,8 @@ get_property(FLAGS GLOBAL PROPERTY "FLAGS_L2")
+ set(SRCS)
+
+ # Set source files, compiler flags and definitions
+-if(${CMAKE_SYSTEM_PROCESSOR} MATCHES "x86_64")
+- if(${CMAKE_SYSTEM_NAME} MATCHES "Linux|Darwin")
++if(${CMAKE_SYSTEM_PROCESSOR} MATCHES "x86_64|amd64")
++ if(${CMAKE_SYSTEM_NAME} MATCHES "Linux|FreeBSD|Darwin")
+ set(SRCS
+ sdacos.cpp
+ ssacos.cpp
diff --git a/math/libpgmath/files/patch-lib_common_asin_fma3_CMakeLists.txt b/math/libpgmath/files/patch-lib_common_asin_fma3_CMakeLists.txt
new file mode 100644
index 000000000000..8cc7535cb59d
--- /dev/null
+++ b/math/libpgmath/files/patch-lib_common_asin_fma3_CMakeLists.txt
@@ -0,0 +1,13 @@
+--- lib/common/asin/fma3/CMakeLists.txt.orig 2018-09-03 06:03:48 UTC
++++ lib/common/asin/fma3/CMakeLists.txt
+@@ -21,8 +21,8 @@ get_property(FLAGS GLOBAL PROPERTY "FLAGS_L2")
+ set(SRCS)
+
+ # Set source files, compiler flags and definitions
+-if(${CMAKE_SYSTEM_PROCESSOR} MATCHES "x86_64")
+- if(${CMAKE_SYSTEM_NAME} MATCHES "Linux|Darwin")
++if(${CMAKE_SYSTEM_PROCESSOR} MATCHES "x86_64|amd64")
++ if(${CMAKE_SYSTEM_NAME} MATCHES "Linux|FreeBSD|Darwin")
+ set(SRCS
+ sdasin.cpp
+ ssasin.cpp
diff --git a/math/libpgmath/files/patch-lib_common_cos_CMakeLists.txt b/math/libpgmath/files/patch-lib_common_cos_CMakeLists.txt
new file mode 100644
index 000000000000..d57bce890910
--- /dev/null
+++ b/math/libpgmath/files/patch-lib_common_cos_CMakeLists.txt
@@ -0,0 +1,13 @@
+--- lib/common/cos/CMakeLists.txt.orig 2018-09-03 06:03:48 UTC
++++ lib/common/cos/CMakeLists.txt
+@@ -21,8 +21,8 @@ get_property(FLAGS GLOBAL PROPERTY "FLAGS_L1")
+ set(SRCS)
+
+ # Set source files, compiler flags and definitions
+-if(${CMAKE_SYSTEM_PROCESSOR} MATCHES "x86_64")
+- if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
++if(${CMAKE_SYSTEM_PROCESSOR} MATCHES "x86_64|amd64")
++ if(${CMAKE_SYSTEM_NAME} MATCHES "Linux|FreeBSD")
+ set(COREAVX2_SRCS fd_cos_1_avx2.cpp fd_cos_2_avx2.cpp fd_cos_4_avx2.cpp)
+ set_property(SOURCE ${COREAVX2_SRCS} APPEND_STRING PROPERTY COMPILE_FLAGS "-Wno-attributes -mtune=core-avx2 -march=core-avx2 ")
+ set_property(SOURCE ${COREAVX2_SRCS} APPEND_STRING PROPERTY COMPILE_DEFINITIONS "PGI ")
diff --git a/math/libpgmath/files/patch-lib_common_dispatch.c b/math/libpgmath/files/patch-lib_common_dispatch.c
new file mode 100644
index 000000000000..fc8034e12865
--- /dev/null
+++ b/math/libpgmath/files/patch-lib_common_dispatch.c
@@ -0,0 +1,14 @@
+--- lib/common/dispatch.c.orig 2018-09-04 21:58:51 UTC
++++ lib/common/dispatch.c
+@@ -62,11 +62,7 @@
+ #include <time.h>
+ #include <unistd.h>
+ #include <inttypes.h>
+-#ifdef TARGET_LINUX_X8664
+-#include <malloc.h>
+-#else
+ #include <sched.h>
+-#endif
+ #include "mth_tbldefs.h"
+ #if defined(TARGET_LINUX_X8664) || defined(TARGET_OSX_X8664)
+ #include "cpuid8664.h"
diff --git a/math/libpgmath/files/patch-lib_common_exp_fma3_CMakeLists.txt b/math/libpgmath/files/patch-lib_common_exp_fma3_CMakeLists.txt
new file mode 100644
index 000000000000..69fda3702243
--- /dev/null
+++ b/math/libpgmath/files/patch-lib_common_exp_fma3_CMakeLists.txt
@@ -0,0 +1,13 @@
+--- lib/common/exp/fma3/CMakeLists.txt.orig 2018-09-03 06:03:48 UTC
++++ lib/common/exp/fma3/CMakeLists.txt
+@@ -21,8 +21,8 @@ get_property(FLAGS GLOBAL PROPERTY "FLAGS_L2")
+ set(SRCS)
+
+ # Set source files, compiler flags and definitions
+-if(${CMAKE_SYSTEM_PROCESSOR} MATCHES "x86_64")
+- if(${CMAKE_SYSTEM_NAME} MATCHES "Linux|Darwin")
++if(${CMAKE_SYSTEM_PROCESSOR} MATCHES "x86_64|amd64")
++ if(${CMAKE_SYSTEM_NAME} MATCHES "Linux|FreeBSD|Darwin")
+ set(SRCS
+ sdexp.cpp
+ ssexp.cpp
diff --git a/math/libpgmath/files/patch-lib_common_log_fma3_CMakeLists.txt b/math/libpgmath/files/patch-lib_common_log_fma3_CMakeLists.txt
new file mode 100644
index 000000000000..b6107d32d444
--- /dev/null
+++ b/math/libpgmath/files/patch-lib_common_log_fma3_CMakeLists.txt
@@ -0,0 +1,13 @@
+--- lib/common/log/fma3/CMakeLists.txt.orig 2018-09-03 06:03:48 UTC
++++ lib/common/log/fma3/CMakeLists.txt
+@@ -21,8 +21,8 @@ get_property(FLAGS GLOBAL PROPERTY "FLAGS_L2")
+ set(SRCS)
+
+ # Set source files, compiler flags and definitions
+-if(${CMAKE_SYSTEM_PROCESSOR} MATCHES "x86_64")
+- if(${CMAKE_SYSTEM_NAME} MATCHES "Linux|Darwin")
++if(${CMAKE_SYSTEM_PROCESSOR} MATCHES "x86_64|amd64")
++ if(${CMAKE_SYSTEM_NAME} MATCHES "Linux|FreeBSD|Darwin")
+ set(SRCS
+ fdlog1.cpp
+ fdlog2.cpp
diff --git a/math/libpgmath/files/patch-lib_common_pow_fma3_CMakeLists.txt b/math/libpgmath/files/patch-lib_common_pow_fma3_CMakeLists.txt
new file mode 100644
index 000000000000..d4a838568070
--- /dev/null
+++ b/math/libpgmath/files/patch-lib_common_pow_fma3_CMakeLists.txt
@@ -0,0 +1,13 @@
+--- lib/common/pow/fma3/CMakeLists.txt.orig 2018-09-03 06:03:48 UTC
++++ lib/common/pow/fma3/CMakeLists.txt
+@@ -21,8 +21,8 @@ get_property(FLAGS GLOBAL PROPERTY "FLAGS_L2")
+ set(SRCS)
+
+ # Set source files, compiler flags and definitions
+-if(${CMAKE_SYSTEM_PROCESSOR} MATCHES "x86_64")
+- if(${CMAKE_SYSTEM_NAME} MATCHES "Linux|Darwin")
++if(${CMAKE_SYSTEM_PROCESSOR} MATCHES "x86_64|amd64")
++ if(${CMAKE_SYSTEM_NAME} MATCHES "Linux|FreeBSD|Darwin")
+ set(SRCS
+ sdpow.cpp
+ sspow.cpp
diff --git a/math/libpgmath/files/patch-lib_common_powi_CMakeLists.txt b/math/libpgmath/files/patch-lib_common_powi_CMakeLists.txt
new file mode 100644
index 000000000000..86ee6d2492e8
--- /dev/null
+++ b/math/libpgmath/files/patch-lib_common_powi_CMakeLists.txt
@@ -0,0 +1,13 @@
+--- lib/common/powi/CMakeLists.txt.orig 2018-09-03 06:03:48 UTC
++++ lib/common/powi/CMakeLists.txt
+@@ -19,8 +19,8 @@ get_property(DEFINITIONS GLOBAL PROPERTY "DEFINITIONS_
+ get_property(FLAGS GLOBAL PROPERTY "FLAGS_L1")
+
+ # Set source files, compiler flags and definitions
+-if(${CMAKE_SYSTEM_PROCESSOR} MATCHES "x86_64")
+- if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
++if(${CMAKE_SYSTEM_PROCESSOR} MATCHES "x86_64|amd64")
++ if(${CMAKE_SYSTEM_NAME} MATCHES "Linux|FreeBSD")
+ # Set source files
+ set(CORE2_SRCS fxpowi.c pxpowi.c)
+ set_property(SOURCE ${CORE2_SRCS} APPEND_STRING PROPERTY COMPILE_FLAGS "-march=core2 ")
diff --git a/math/libpgmath/files/patch-lib_common_sin_CMakeLists.txt b/math/libpgmath/files/patch-lib_common_sin_CMakeLists.txt
new file mode 100644
index 000000000000..4977873bfed2
--- /dev/null
+++ b/math/libpgmath/files/patch-lib_common_sin_CMakeLists.txt
@@ -0,0 +1,13 @@
+--- lib/common/sin/CMakeLists.txt.orig 2018-09-03 06:03:48 UTC
++++ lib/common/sin/CMakeLists.txt
+@@ -21,8 +21,8 @@ get_property(FLAGS GLOBAL PROPERTY "FLAGS_L1")
+ set(SRCS)
+
+ # Set source files, compiler flags and definitions
+-if(${CMAKE_SYSTEM_PROCESSOR} MATCHES "x86_64")
+- if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
++if(${CMAKE_SYSTEM_PROCESSOR} MATCHES "x86_64|amd64")
++ if(${CMAKE_SYSTEM_NAME} MATCHES "Linux|FreeBSD")
+ set(COREAVX2_SRCS fd_sin_1_avx2.cpp fd_sin_2_avx2.cpp fd_sin_4_avx2.cpp)
+ set_property(SOURCE ${COREAVX2_SRCS} APPEND_STRING PROPERTY COMPILE_FLAGS "-Wno-attributes -mtune=core-avx2 -march=core-avx2 ")
+ set_property(SOURCE ${COREAVX2_SRCS} APPEND_STRING PROPERTY COMPILE_DEFINITIONS "PGI ")
diff --git a/math/libpgmath/files/patch-lib_common_sincos_CMakeLists.txt b/math/libpgmath/files/patch-lib_common_sincos_CMakeLists.txt
new file mode 100644
index 000000000000..66ba99690f25
--- /dev/null
+++ b/math/libpgmath/files/patch-lib_common_sincos_CMakeLists.txt
@@ -0,0 +1,13 @@
+--- lib/common/sincos/CMakeLists.txt.orig 2018-09-03 06:03:48 UTC
++++ lib/common/sincos/CMakeLists.txt
+@@ -26,8 +26,8 @@ else()
+ endif()
+
+ # Set source files, compiler flags and definitions
+-if(${CMAKE_SYSTEM_PROCESSOR} MATCHES "x86_64")
+- if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
++if(${CMAKE_SYSTEM_PROCESSOR} MATCHES "x86_64|amd64")
++ if(${CMAKE_SYSTEM_NAME} MATCHES "Linux|FreeBSD")
+ libmath_add_object_library("${SRCS}" "${FLAGS}" "${DEFINITIONS}" "gssincos4")
+ set_property(TARGET gssincos4 APPEND PROPERTY COMPILE_DEFINITIONS SINCOS=__mth_sincos PRECSIZE=4 VLEN=4)
+ libmath_add_object_library("${SRCS}" "${FLAGS}" "${DEFINITIONS}" "gdsincos2")
diff --git a/math/libpgmath/files/patch-lib_x86__64_CMakeLists.txt b/math/libpgmath/files/patch-lib_x86__64_CMakeLists.txt
new file mode 100644
index 000000000000..c8dcfc8cf0e4
--- /dev/null
+++ b/math/libpgmath/files/patch-lib_x86__64_CMakeLists.txt
@@ -0,0 +1,11 @@
+--- lib/x86_64/CMakeLists.txt.orig 2018-09-03 06:03:48 UTC
++++ lib/x86_64/CMakeLists.txt
+@@ -88,7 +88,7 @@ list(APPEND DEFINITIONS _GNU_SOURCE _ISOC99_SOURCE)
+ if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
+ list(APPEND DEFINITIONS _GNU_SOURCE)
+ endif()
+-set(FLAGS "${FLAGS}-Wall -W -Wstrict-prototypes -Wwrite-strings -Werror ")
++set(FLAGS "${FLAGS}-Wall -W -Wstrict-prototypes -Wwrite-strings ")
+ libmath_add_object_library("${SRCS}" "${FLAGS}" "${DEFINITIONS}" "isoc99")
+
+ # isoc99_log2
diff --git a/math/libpgmath/files/patch-lib_x86__64_fast_CMakeLists.txt b/math/libpgmath/files/patch-lib_x86__64_fast_CMakeLists.txt
new file mode 100644
index 000000000000..d73da247317f
--- /dev/null
+++ b/math/libpgmath/files/patch-lib_x86__64_fast_CMakeLists.txt
@@ -0,0 +1,11 @@
+--- lib/x86_64/fast/CMakeLists.txt.orig 2018-09-03 06:03:48 UTC
++++ lib/x86_64/fast/CMakeLists.txt
+@@ -39,7 +39,7 @@ add_custom_command(OUTPUT tmp.${TARGET_NAME}.h PRE_BUI
+ add_custom_target(${TARGET_NAME} ALL
+ DEPENDS tmp.${TARGET_NAME}.h)
+
+-if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
++if(${CMAKE_SYSTEM_NAME} MATCHES "Linux|FreeBSD")
+ list(APPEND DEFINITIONS LINUX_ELF)
+ endif()
+ include_directories(${CMAKE_CURRENT_BINARY_DIR})
diff --git a/math/libpgmath/files/patch-lib_x86__64_libm__amd.h b/math/libpgmath/files/patch-lib_x86__64_libm__amd.h
new file mode 100644
index 000000000000..ea1f6d660a4c
--- /dev/null
+++ b/math/libpgmath/files/patch-lib_x86__64_libm__amd.h
@@ -0,0 +1,23 @@
+--- lib/x86_64/libm_amd.h.orig 2018-09-03 06:03:48 UTC
++++ lib/x86_64/libm_amd.h
+@@ -68,7 +68,7 @@ regulations applicable in licensee's jurisdiction.
+
+ #include <math.h>
+
+-#if !defined(TARGET_WIN)
++#if !defined(TARGET_LINUX)
+ typedef long __INT8_T;
+ typedef unsigned long __UINT8_T;
+
+@@ -79,6 +79,11 @@ typedef unsigned long long __UINT8_T;
+
+ /* Open Tools #defines ldexpf */
+ #undef ldexpf
++
++#define DOMAIN 1
++#define SING 2
++#define OVERFLOW 3
++#define UNDERFLOW 4
+
+ #endif
+
diff --git a/math/libpgmath/pkg-descr b/math/libpgmath/pkg-descr
new file mode 100644
index 000000000000..6a119fe50d61
--- /dev/null
+++ b/math/libpgmath/pkg-descr
@@ -0,0 +1,6 @@
+Compiler-callable math intrinsics library
+
+This is the companion math library for the flang compiler. It features some
+optimized libm-style functions and has vectorization support.
+
+WWW: https://github.com/flang-compiler/flang