1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-12-24 04:33:24 +00:00

Add lang/cling: Interactive C++ Interpreter Based on LLVM and Clang Libs

Cling is an interactive C++ interpreter,
built on the top of LLVM and Clang libraries.
Its advantages over the standard interpreters are that it has command prompt
and uses just-in-time (JIT) compiler for compilation.
One of Cling's main goals is to provide contemporary, high-performance
alternative of the current C++ interpreter in the ROOT project "CINT".
The backward-compatibility with CINT is major priority during the development.

Its main advantages are:
    Production-grade parser.
    Just-in-time compiler (JIT).
    Modular C++ API from the ground up.
    Separate parser and execution engine.
    C++ 11 support through clang.

PR:		215689
Submitted by:	Mahdi Mokhtari
Reviewed by:	mat, novel
Differential Revision:	https://reviews.freebsd.org/D9012
This commit is contained in:
Roman Bogorodskiy 2017-01-03 08:06:59 +00:00
parent 6f019c90b3
commit b4fa50f637
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=430442
9 changed files with 2030 additions and 0 deletions

View File

@ -40,6 +40,7 @@
SUBDIR += clang36
SUBDIR += clang37
SUBDIR += clang38
SUBDIR += cling
SUBDIR += clojure
SUBDIR += clojure-mode.el
SUBDIR += clover

118
lang/cling/Makefile Normal file
View File

@ -0,0 +1,118 @@
# Created by: Mahdi Mokhtari <mokhi64@gmail.com>
# $FreeBSD$
PORTNAME= cling
PORTVERSION= 0.4
PORTREVISION?= 0
CATEGORIES= lang devel
MASTER_SITES= https://root.cern.ch/download/cling/
DISTNAME= ${PORTNAME}_2016-12-29_sources
MAINTAINER= mokhi64@gmail.com
COMMENT= Interactive C++ Interpreter Based on LLVM and Clang Libs
LICENSE= LLVM NCSA
LICENSE_COMB= multi
LICENSE_NAME_LLVM= LLVM Release License
LICENSE_FILE_LLVM= ${WRKSRC}/LICENSE.TXT
LICENSE_FILE_NCSA= ${WRKSRC}/tools/cling/LICENSE.TXT
LICENSE_PERMS_LLVM= dist-mirror dist-sell pkg-mirror pkg-sell auto-accept
WRKSRC= ${WRKDIR}/src
LLVM_RELEASE= 3.9.0
LLVM_SUFFIX= 39_cern-root
LLVM_PREFIX= ${PREFIX}/llvm${LLVM_SUFFIX}
USES= cmake:outsource compiler:c11 compiler:c++11-lib cpe \
python:build tar:bzip2
USE_LDCONFIG= ${LLVM_PREFIX}/lib
SUB_FILES= llvm-wrapper.sh
SUB_LIST+= LLVM_PREFIX="${LLVM_PREFIX}" LLVM_SUFFIX="${LLVM_SUFFIX}"
PLIST_SUB+= LLVM_SUFFIX=${LLVM_SUFFIX} LLVM_RELEASE=${LLVM_RELEASE}
CMAKE_BUILD_TYPE= Release
CMAKE_INSTALL_PREFIX= ${LLVM_PREFIX}
CMAKE_ARGS+= -DINSTALL_LAYOUT=FREEBSD \
--target ${PORTNAME}
CLING_FILES= bin/cling \
lib/libcling.so \
lib/libclingInterpreter.a \
lib/libclingJupyter.so \
lib/libclingMetaProcessor.a \
lib/libclingUserInterface.a \
lib/libclingUtils.a \
include/cling/Interpreter/AutoloadCallback.h \
include/cling/Interpreter/CIFactory.h \
include/cling/Interpreter/CValuePrinter.h \
include/cling/Interpreter/ClangInternalState.h \
include/cling/Interpreter/ClingCodeCompleteConsumer.h \
include/cling/Interpreter/ClingOptions.h \
include/cling/Interpreter/CompilationOptions.h \
include/cling/Interpreter/DynamicExprInfo.h \
include/cling/Interpreter/DynamicLibraryManager.h \
include/cling/Interpreter/DynamicLookupLifetimeHandler.h \
include/cling/Interpreter/DynamicLookupRuntimeUniverse.h \
include/cling/Interpreter/Exception.h \
include/cling/Interpreter/Interpreter.h \
include/cling/Interpreter/InterpreterCallbacks.h \
include/cling/Interpreter/InvocationOptions.h \
include/cling/Interpreter/LookupHelper.h \
include/cling/Interpreter/RuntimePrintValue.h \
include/cling/Interpreter/RuntimeUniverse.h \
include/cling/Interpreter/Transaction.h \
include/cling/Interpreter/Value.h \
include/cling/MetaProcessor/MetaProcessor.h \
include/cling/UserInterface/UserInterface.h \
include/cling/UserInterface/textinput/Callbacks.h \
include/cling/UserInterface/textinput/Color.h \
include/cling/UserInterface/textinput/Display.h \
include/cling/UserInterface/textinput/Editor.h \
include/cling/UserInterface/textinput/History.h \
include/cling/UserInterface/textinput/InputData.h \
include/cling/UserInterface/textinput/KeyBinding.h \
include/cling/UserInterface/textinput/Range.h \
include/cling/UserInterface/textinput/Reader.h \
include/cling/UserInterface/textinput/SignalHandler.h \
include/cling/UserInterface/textinput/StreamReader.h \
include/cling/UserInterface/textinput/StreamReaderUnix.h \
include/cling/UserInterface/textinput/StreamReaderWin.h \
include/cling/UserInterface/textinput/TerminalConfigUnix.h \
include/cling/UserInterface/textinput/TerminalDisplay.h \
include/cling/UserInterface/textinput/TerminalDisplayUnix.h \
include/cling/UserInterface/textinput/TerminalDisplayWin.h \
include/cling/UserInterface/textinput/Text.h \
include/cling/UserInterface/textinput/TextInput.h \
include/cling/UserInterface/textinput/TextInputContext.h \
include/cling/Utils/AST.h \
include/cling/Utils/Output.h \
include/cling/Utils/ParserStateRAII.h \
include/cling/Utils/Paths.h \
include/cling/Utils/Platform.h \
include/cling/Utils/SourceNormalization.h \
include/cling/Utils/Validation.h
FIRST_FILE= ${CLING_FILES:C/^/XXXX/1:MXXXX*:C/^XXXX//}
post-patch:
@${REINPLACE_CMD} -e 's|%%LLVM_PREFIX%%|${LLVM_PREFIX}|g' \
${PATCH_WRKSRC}/tools/cling/tools/driver/cling.cpp
@${REINPLACE_CMD} -e 's|%%LLVM_PREFIX%%|${LLVM_PREFIX}|g' \
${PATCH_WRKSRC}/tools/cling/lib/Interpreter/CIFactory.cpp
post-install:
${RM} ${STAGEDIR}${LLVM_PREFIX}/man/man1/scan-build.1
${RM} -rf ${STAGEDIR}${LLVM_PREFIX}/man
${INSTALL_SCRIPT} ${WRKDIR}/llvm-wrapper.sh \
${STAGEDIR}${PREFIX}/${FIRST_FILE}
${MKDIR} ${STAGEDIR}${PREFIX}/include/${PORTNAME}/Interpreter
${MKDIR} ${STAGEDIR}${PREFIX}/include/${PORTNAME}/MetaProcessor
${MKDIR} ${STAGEDIR}${PREFIX}/include/${PORTNAME}/UserInterface/textinput
${MKDIR} ${STAGEDIR}${PREFIX}/include/${PORTNAME}/Utils
.for file in ${CLING_FILES:C/^/XXXX/1:NXXXX*}
${LN} -f ${STAGEDIR}${PREFIX}/${FIRST_FILE} ${STAGEDIR}${PREFIX}/${file}
.endfor
.include <bsd.port.mk>

3
lang/cling/distinfo Normal file
View File

@ -0,0 +1,3 @@
TIMESTAMP = 1483120709
SHA256 (cling_2016-12-29_sources.tar.bz2) = eef0857e96a4108abdb428d671b0334c6fd29065cfe2c8119d7208a4850012f1
SIZE (cling_2016-12-29_sources.tar.bz2) = 184926984

View File

@ -0,0 +1,10 @@
#!/bin/sh
# $FreeBSD$
LLVM_PREFIX="%%LLVM_PREFIX%%"
LLVM_SUFFIX="%%LLVM_SUFFIX%%"
tool=$(basename $0)
tool="${LLVM_PREFIX}/bin/${tool%${LLVM_SUFFIX}}"
LD_LIBRARY_PATH="${LD_LIBRARY_PATH:+${LD_LIBRARY_PATH}:}${LLVM_PREFIX}/lib" \
"${tool}" "${@}"

View File

@ -0,0 +1,13 @@
--- projects/CMakeLists.txt.orig 2017-01-01 11:36:50 UTC
+++ projects/CMakeLists.txt
@@ -25,7 +25,9 @@ if(${LLVM_BUILD_RUNTIME})
# first.
add_llvm_external_project(libcxxabi)
add_llvm_external_project(libcxx)
- add_llvm_external_project(libunwind)
+ if(FALSE)
+ add_llvm_external_project(libunwind)
+ endif()
endif()
if(NOT LLVM_BUILD_EXTERNAL_COMPILER_RT)
add_llvm_external_project(compiler-rt)

View File

@ -0,0 +1,13 @@
--- tools/cling/lib/Interpreter/CIFactory.cpp.orig 2016-12-29 13:54:44 UTC
+++ tools/cling/lib/Interpreter/CIFactory.cpp
@@ -307,8 +307,8 @@ namespace {
// Note: On FreeBSD it uses getprogpath().
// Note: Otherwise it uses dladdr().
//
- resourcePath
- = CompilerInvocation::GetResourcesPath("cling",
+ resourcePath = CompilerInvocation::GetResourcesPath(
+ "%%LLVM_PREFIX%%/bin/cling",
(void*)intptr_t(GetExecutablePath));
} else {
llvm::SmallString<512> tmp(llvmdir);

View File

@ -0,0 +1,11 @@
--- tools/cling/tools/driver/cling.cpp.orig 2016-12-29 13:54:45 UTC
+++ tools/cling/tools/driver/cling.cpp
@@ -51,7 +51,7 @@ int main( int argc, char **argv ) {
#endif
// Set up the interpreter
- cling::Interpreter interp(argc, argv);
+ cling::Interpreter interp(argc, argv, "%%LLVM_PREFIX%%/");
if (interp.getOptions().Help) {
return 0;
}

17
lang/cling/pkg-descr Normal file
View File

@ -0,0 +1,17 @@
Cling is an interactive C++ interpreter,
built on the top of LLVM and Clang libraries.
Its advantages over the standard interpreters are that it has command prompt
and uses just-in-time (JIT) compiler for compilation.
One of Cling's main goals is to provide contemporary, high-performance
alternative of the current C++ interpreter in the ROOT project "CINT".
The backward-compatibility with CINT is major priority during the development.
Its main advantages are:
Production-grade parser.
Just-in-time compiler (JIT).
Modular C++ API from the ground up.
Separate parser and execution engine.
C++ 11 support through clang.
WWW: https://root.cern.ch/cling

1844
lang/cling/pkg-plist Normal file

File diff suppressed because it is too large Load Diff