[122587] users/ryandesign/ports/sysutils
ryandesign at macports.org
ryandesign at macports.org
Thu Jul 24 05:13:48 PDT 2014
Revision: 122587
https://trac.macports.org/changeset/122587
Author: ryandesign at macports.org
Date: 2014-07-24 05:13:48 -0700 (Thu, 24 Jul 2014)
Log Message:
-----------
macports-compiler-wrappers: new port (#44413)
Added Paths:
-----------
users/ryandesign/ports/sysutils/macports-compiler-wrappers/
users/ryandesign/ports/sysutils/macports-compiler-wrappers/Portfile
users/ryandesign/ports/sysutils/macports-compiler-wrappers/files/
users/ryandesign/ports/sysutils/macports-compiler-wrappers/files/wrapper.sh
Added: users/ryandesign/ports/sysutils/macports-compiler-wrappers/Portfile
===================================================================
--- users/ryandesign/ports/sysutils/macports-compiler-wrappers/Portfile (rev 0)
+++ users/ryandesign/ports/sysutils/macports-compiler-wrappers/Portfile 2014-07-24 12:13:48 UTC (rev 122587)
@@ -0,0 +1,85 @@
+# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4
+# $Id$
+
+PortSystem 1.0
+
+name macports-compiler-wrappers
+version 0.1
+categories sysutils
+platforms darwin
+maintainers ryandesign openmaintainer
+license BSD
+supported_archs noarch
+
+set compilers {
+ apple-gcc-4.0
+ apple-gcc-4.2
+ clang
+ gcc-3.3
+ gcc-4.0
+ gcc-4.2
+ llvm-gcc-4.2
+ macports-clang-2.9
+ macports-clang-3.0
+ macports-clang-3.1
+ macports-clang-3.2
+ macports-clang-3.3
+ macports-clang-3.4
+ macports-clang-3.5
+ macports-gcc-4.2
+ macports-gcc-4.3
+ macports-gcc-4.4
+ macports-gcc-4.5
+ macports-gcc-4.6
+ macports-gcc-4.7
+ macports-gcc-4.8
+ macports-gcc-4.9
+ macports-llvm-gcc-4.2
+}
+
+distfiles
+
+extract.mkdir yes
+
+post-extract {
+ copy ${filespath}/wrapper.sh ${worksrcpath}
+}
+
+post-patch {
+ reinplace "s|@PREFIX@|${prefix}|g" ${worksrcpath}/wrapper.sh
+}
+
+use_configure no
+
+build {}
+
+destroot {
+ set wrappers_dir ${prefix}/libexec/macports/compiler-wrappers
+ xinstall -d ${destroot}${wrappers_dir}
+ xinstall ${worksrcpath}/wrapper.sh ${destroot}${wrappers_dir}
+ set no_filter {-}
+ set wrapper {../../wrapper.sh}
+ foreach compiler ${compilers} {
+ set compiler_dir ${wrappers_dir}/${no_filter}/${compiler}
+ xinstall -d ${destroot}${compiler_dir}
+ ln -s ${wrapper} ${destroot}${compiler_dir}/cc
+ ln -s ${wrapper} ${destroot}${compiler_dir}/c++
+ if {[string match *clang* ${compiler}]} {
+ ln -s ${wrapper} ${destroot}${compiler_dir}/clang
+ ln -s ${wrapper} ${destroot}${compiler_dir}/clang++
+ }
+ if {[string match *gcc* ${compiler}]} {
+ ln -s ${wrapper} ${destroot}${compiler_dir}/gcc
+ ln -s ${wrapper} ${destroot}${compiler_dir}/g++
+ }
+ if {[string match *llvm-gcc* ${compiler}]} {
+ ln -s ${wrapper} ${destroot}${compiler_dir}/llvm-gcc
+ ln -s ${wrapper} ${destroot}${compiler_dir}/llvm-g++
+ }
+ }
+ foreach filter {ccache ccache-distcc distcc} {
+ ln -s -- ${no_filter} ${destroot}${wrappers_dir}/${filter}
+ }
+}
+
+livecheck.type none
Property changes on: users/ryandesign/ports/sysutils/macports-compiler-wrappers/Portfile
___________________________________________________________________
Added: svn:keywords
+ Id
Added: svn:eol-style
+ native
Added: users/ryandesign/ports/sysutils/macports-compiler-wrappers/files/wrapper.sh
===================================================================
--- users/ryandesign/ports/sysutils/macports-compiler-wrappers/files/wrapper.sh (rev 0)
+++ users/ryandesign/ports/sysutils/macports-compiler-wrappers/files/wrapper.sh 2014-07-24 12:13:48 UTC (rev 122587)
@@ -0,0 +1,133 @@
+#!/bin/sh
+
+PREFIX="@PREFIX@"
+
+WRAPPER_EXE="$(basename "$0")"
+# todo: error if called as wrapper.sh
+# todo: fewer shell calls
+COMPILER="$(cd "$(dirname "$0")" && basename "$(pwd)")"
+COMPILER_VERSION="${COMPILER##*-}"
+FILTER="$(cd "$(dirname "$(dirname "$0")")" && basename "$(pwd)")"
+
+find_developer_dir () {
+ if [ -x "$(which xcode-select 2>&1)" ]; then
+ xcode-select -print-path
+ else
+ echo "/Developer"
+ fi
+}
+
+find_developer_tool () {
+ TOOL="$1"
+ TOOL_PATH="/usr/bin/${TOOL}"
+ if [ -x "${TOOL_PATH}" ]; then
+ echo "${TOOL_PATH}"
+ else
+ TOOL_PATH="$(xcrun -find "${TOOL}" 2>/dev/null)"
+ if [ -x "${TOOL_PATH}" ]; then
+ echo "${TOOL_PATH}"
+ else
+ echo "$(find_developer_dir)/usr/bin/${TOOL}"
+ fi
+ fi
+return
+#old version:
+ if [ ! -x "${TOOL_PATH}/${TOOL}" ]; then
+ if [ -x "$(which xcrun 2>&1)" ]; then
+ TOOL_PATH="$(dirname "$(xcrun -find "${TOOL}")")"
+ fi
+ fi
+ if [ ! -x "${TOOL_PATH}/${TOOL}" ]; then
+ TOOL_PATH="$(find_developer_dir)/usr/bin"
+ fi
+ echo "${TOOL_PATH}/${TOOL}"
+}
+
+case "${FILTER}" in
+ -)
+ FILTER_EXE=""
+ ;;
+ ccache-distcc)
+ FILTER_EXE="ccache"
+ export CCACHE_PREFIX="distcc"
+ ;;
+ *)
+ FILTER_EXE="${FILTER}"
+ ;;
+esac
+
+case "${COMPILER}" in
+ *clang*)
+ case "${WRAPPER_EXE}" in
+ *++)
+ REAL_EXE="clang++"
+ ;;
+ *)
+ REAL_EXE="clang"
+ ;;
+ esac
+ ;;
+ *llvm-gcc*)
+ case "${WRAPPER_EXE}" in
+ *++)
+ REAL_EXE="llvm-g++-${COMPILER_VERSION}"
+ ;;
+ *)
+ REAL_EXE="llvm-gcc-${COMPILER_VERSION}"
+ ;;
+ esac
+ ;;
+ macports-gcc*)
+ case "${WRAPPER_EXE}" in
+ *++)
+ REAL_EXE="g++-mp-${COMPILER_VERSION}"
+ ;;
+ *)
+ REAL_EXE="gcc-mp-${COMPILER_VERSION}"
+ ;;
+ esac
+ ;;
+ *)
+ case "${WRAPPER_EXE}" in
+ *++)
+ REAL_EXE="g++-${COMPILER_VERSION}"
+ ;;
+ *)
+ REAL_EXE="gcc-${COMPILER_VERSION}"
+ ;;
+ esac
+ ;;
+esac
+
+case "${COMPILER}" in
+ macports-clang-*)
+ REAL_EXE_PATH="${PREFIX}/libexec/llvm-${COMPILER_VERSION}/bin/${REAL_EXE}"
+ ;;
+ macports-*gcc*)
+ REAL_EXE_PATH="${PREFIX}/bin/${REAL_EXE}"
+ ;;
+ *)
+ REAL_EXE_PATH="$(find_developer_tool "${REAL_EXE}")"
+ if [ "${REAL_EXE}" == "clang++" ]; then
+ if [ ! -x "${REAL_EXE_PATH}" ]; then
+ REAL_EXE_PATH="$(find_developer_tool "llvm-g++-4.2")"
+ fi
+ fi
+ ;;
+esac
+
+# echo "Compiler collection: ${COMPILER}"
+# echo "Compiler collection version: ${COMPILER_VERSION}"
+# echo "Wrapper executable: ${WRAPPER_EXE}"
+# echo "Filter: ${FILTER}"
+# echo "Filter executable: ${FILTER_EXE}"
+# echo "Real executable: ${REAL_EXE}"
+# echo "Real executable path: ${REAL_EXE_PATH}"
+# echo "Args:"
+#
+# for ARG in "${@}"; do
+# echo "${ARG}"
+# done
+
+# echo \
+exec ${FILTER_EXE} "${REAL_EXE_PATH}" "${@}" "-isystem${PREFIX}/include" "-L${PREFIX}/lib"
Property changes on: users/ryandesign/ports/sysutils/macports-compiler-wrappers/files/wrapper.sh
___________________________________________________________________
Added: svn:executable
+ *
Added: svn:eol-style
+ native
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/macports-changes/attachments/20140724/29fd5eeb/attachment.html>
More information about the macports-changes
mailing list