From 14aba22ba8289aaf664ab03f6c66ca5a293aa411 Mon Sep 17 00:00:00 2001 From: Brooks Davis Date: Fri, 12 Oct 2012 00:53:48 +0000 Subject: Add a port of the development version of DragonEgg. DragonEgg is a gcc plugin that replaces GCC's optimizers and code generators with those from the LLVM project. It works with gcc-4.5 or gcc-4.6, can target the x86-32/x86-64 and ARM processor families. It fully supports Ada, C, C++ and Fortran. It has partial support for Go, Java, Obj-C and Obj-C++. Feature safe: yes --- lang/dragonegg-devel46/Makefile | 74 +++++++++++++++++++++++++ lang/dragonegg-devel46/distinfo | 2 + lang/dragonegg-devel46/files/patch-README | 90 +++++++++++++++++++++++++++++++ lang/dragonegg-devel46/pkg-descr | 8 +++ 4 files changed, 174 insertions(+) create mode 100644 lang/dragonegg-devel46/Makefile create mode 100644 lang/dragonegg-devel46/distinfo create mode 100644 lang/dragonegg-devel46/files/patch-README create mode 100644 lang/dragonegg-devel46/pkg-descr (limited to 'lang') diff --git a/lang/dragonegg-devel46/Makefile b/lang/dragonegg-devel46/Makefile new file mode 100644 index 000000000000..c017151031b2 --- /dev/null +++ b/lang/dragonegg-devel46/Makefile @@ -0,0 +1,74 @@ +# $FreeBSD$ +# + +PORTNAME= dragonegg46 +PORTVERSION= 3.2.r${SVN_REV} +CATEGORIES= lang devel +MASTER_SITES= ${MASTER_SITE_LOCAL} +MASTER_SITE_SUBDIR= brooks +PKGNAMESUFFIX= -devel + +MAINTAINER= brooks@FreeBSD.org +COMMENT= GCC plugin to use the LLVM backend + +# XXX: not entierly sure if llvm-devel is a depend +BUILD_DEPENDS+= llvm-devel>=${PORTVERSION}:${PORTSDIR}/devel/llvm-devel +RUN_DEPENDS+= ${CC}:${PORTSDIR}/lang/gcc \ + llvm-devel>=${PORTVERSION}:${PORTSDIR}/devel/llvm-devel + +OPTIONS_DEFINE= DOCS + +USE_BZIP2= yes +USE_GCC= 4.6 +USE_GMAKE= yes +USE_LDCONFIG= yes +MAKE_JOBS_SAFE= yes + +DRAGONEGG_RELEASE= ${PORTVERSION:C/\.r[0-9]*//} +DRAGONEGG_SO= dragonegg-${DRAGONEGG_RELEASE}.so +DRAGONEGG_PATH= ${GCC_LIBDIR}/${DRAGONEGG_SO} +GCC_LIBDIR= lib/${CC} + +ALL_TARGET= +MAKE_ARGS= GCC=${LOCALBASE}/bin/${CC} + +.include "${.CURDIR}/../../devel/llvm-devel/Makefile.svn_rev" + +PLIST_FILES= ${GCC_LIBDIR}/${DRAGONEGG_SO} + +.include + +.if ${PORT_OPTIONS:MDOCS} +PORTDOCS= README +.endif + +.if defined(BOOTSTRAP) || defined(SVN_FETCH) +FETCH_DEPENDS+= svn:${PORTSDIR}/devel/subversion + +do-fetch: + ${MKDIR} ${WRKDIR} + svn export -r ${SVN_REV} \ + http://llvm.org/svn/llvm-project/dragonegg/trunk \ + ${WRKDIR}/${DISTNAME} + cd ${WRKDIR}; tar cvfy ${DISTDIR}/${DISTNAME}.tar.bz2 ${DISTNAME} +.if ${USER} == brooks + scp ${DISTDIR}/${DISTNAME}.tar.bz2 \ + freefall.freebsd.org:public_distfiles/ +.endif +.endif + +post-patch: + ${REINPLACE_CMD} -e 's/%%CC%%/${CC}/' \ + -e 's#%%PLUGINPATH%%#${LOCALBASE}/${DRAGONEGG_PATH}#' \ + -e 's/arg-dragonegg/arg-dragonegg-${DRAGONEGG_RELEASE}/' \ + ${WRKSRC}/README + +do-install: + ${INSTALL_LIB} ${WRKSRC}/dragonegg.so \ + ${LOCALBASE}/${GCC_LIBDIR}/${DRAGONEGG_SO} +.if ${PORT_OPTIONS:MDOCS} + ${MKDIR} ${DOCSDIR} + ${INSTALL_DATA} ${WRKSRC}/README ${DOCSDIR} +.endif + +.include diff --git a/lang/dragonegg-devel46/distinfo b/lang/dragonegg-devel46/distinfo new file mode 100644 index 000000000000..19e380c61af4 --- /dev/null +++ b/lang/dragonegg-devel46/distinfo @@ -0,0 +1,2 @@ +SHA256 (dragonegg46-3.2.r164604.tar.bz2) = 6cc9cf2056e95883571ed67b454589e7655a3c219e07b27249252fc40a4737f5 +SIZE (dragonegg46-3.2.r164604.tar.bz2) = 602853 diff --git a/lang/dragonegg-devel46/files/patch-README b/lang/dragonegg-devel46/files/patch-README new file mode 100644 index 000000000000..5f0c98eb0905 --- /dev/null +++ b/lang/dragonegg-devel46/files/patch-README @@ -0,0 +1,90 @@ + +$FreeBSD$ + +--- README.orig ++++ README +@@ -1,82 +1,15 @@ + ---------------------- +-- BUILD INSTRUCTIONS - +----------------------- +- +-Prerequisites +-------------- +- +-The dragonegg plugin works with gcc 4.5, gcc 4.6 or gcc-4.7, so you will need to +-have one of these installed. Many linux distributions ship one or both of them, +-perhaps as an addon package; binaries can be downloaded for most platforms. +-Otherwise you can always build gcc yourself. Plugin support (--enable-plugin) +-needs to be enabled in gcc, but since it is enabled by default on most platforms +-you usually won't need to do this explicitly. +- +-Step 0: Build and install llvm +------------------------------- +- +-I'm assuming anyone reading this knows how to build and install llvm. The +-version of llvm must match the version of the plugin, so if you are building +-dragonegg-3.0 then you should use llvm-3.0, while if you are building the +-development version of dragonegg then use the development version of llvm. +- +- +-Step 1: Build the plugin +------------------------- +- +-Build the plugin like this: +- GCC=PATH_TO_INSTALLED_GCC make +-This command should be executed in the directory containing this README. +- +-The plugin needs to know about the version of gcc it will be loaded into, which +-is why you need to specify your version of gcc 4.5/4.6 via the GCC variable like +-this. For example, if the version of gcc you want to load the plugin into is +-/usr/local/gcc-4.6/bin/gcc, then you should do +- GCC=/usr/local/gcc-4.6/bin/gcc make +-If you don't set the GCC variable then by default "gcc" is used, so you +-can just do +- make +-if you plan to use the plugin with whatever version of gcc is in your path. +- +-The plugin makes use of various gcc headers that are usually shipped with gcc. +-However some linux distributions, for example debian and ubuntu, have split the +-headers out of gcc into a separate package. So if you get errors along the +-lines of "config.h not found", check whether gcc headers like "config.h" and +-"tree.h" are installed. On debian the package containing headers is called +-gcc-4.5-plugin-dev or gcc-4.6-plugin-dev. +- +-The plugin is compiled using the system compiler, and not with the gcc specified +-in the GCC variable (which wouldn't work if it is a cross compiler). If you +-want to also compile the plugin with your copy of gcc 4.5/4.6, you can do: +- CXX=PATH_TO_INSTALLED_GCC GCC=PATH_TO_INSTALLED_GCC make +- +-The build system runs the "llvm-config" program (which should be in your path if +-you installed llvm properly in step 0) to find out about the copy of LLVM you +-installed, so there is no need to tell the build system explicitly about LLVM. +-If llvm-config is not in your path then you can specify where to find it using +-the LLVM_CONFIG variable. +- +-The end result of the build is a shared library, dragonegg.so. +- +-If you want the dragonegg plugin to be able to load LLVM plugins then pass +-ENABLE_LLVM_PLUGINS=1 to make. +- +- +----------------------- + - USAGE INSTRUCTIONS - + ---------------------- + +-Run gcc as usual, but pass -fplugin=./dragonegg.so as an extra command line +-argument. Make sure you use the gcc you built dragonegg against (see step 1)! ++Run %%CC%% as usual, but pass -fplugin=%%PLUGINPATH%% ++as an extra command line argument. + + + ------------------ + - USEFUL OPTIONS - + ------------------ + +-If you renamed dragonegg.so to something else, for example llvm.so, replace +--fplugin-arg-dragonegg with -fplugin-arg-llvm in the options below. +- + -fplugin-arg-dragonegg-emit-ir + -flto + Output LLVM IR rather than target assembler. You need to use -S with this, diff --git a/lang/dragonegg-devel46/pkg-descr b/lang/dragonegg-devel46/pkg-descr new file mode 100644 index 000000000000..7f2a654ac9b3 --- /dev/null +++ b/lang/dragonegg-devel46/pkg-descr @@ -0,0 +1,8 @@ +DragonEgg is a gcc plugin that replaces GCC's optimizers and code +generators with those from the LLVM project. It works with gcc-4.5 +or gcc-4.6, can target the x86-32/x86-64 and ARM processor families, +and has been successfully used on the Darwin, FreeBSD, KFreeBSD, +Linux and OpenBSD platforms. It fully supports Ada, C, C++ and +Fortran. It has partial support for Go, Java, Obj-C and Obj-C++. + +WWW: http://dragonegg.llvm.org/ -- cgit v1.2.3