[90862] trunk/dports/devel

g5pw at macports.org g5pw at macports.org
Fri Mar 16 02:35:56 PDT 2012


Revision: 90862
          https://trac.macports.org/changeset/90862
Author:   g5pw at macports.org
Date:     2012-03-16 02:35:56 -0700 (Fri, 16 Mar 2012)
Log Message:
-----------
devel/radare2:
New port

Added Paths:
-----------
    trunk/dports/devel/radare2/
    trunk/dports/devel/radare2/Portfile
    trunk/dports/devel/radare2/change_install_names
    trunk/dports/devel/radare2/files/
    trunk/dports/devel/radare2/files/patch-change_install_names.diff
    trunk/dports/devel/radare2/files/patch-libr-Makefile.diff
    trunk/dports/devel/radare2/files/patch-libr-config.mk.tail.diff
    trunk/dports/devel/radare2/files/patch-libr-rules.mk.diff
    trunk/dports/devel/radare2/files/patch-mk-gcc.mk.diff

Added: trunk/dports/devel/radare2/Portfile
===================================================================
--- trunk/dports/devel/radare2/Portfile	                        (rev 0)
+++ trunk/dports/devel/radare2/Portfile	2012-03-16 09:35:56 UTC (rev 90862)
@@ -0,0 +1,33 @@
+# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=portfile:sw=4:ts=4:sts=4
+# $Id$
+
+PortSystem          1.0
+
+name				radare2
+version				0.9
+categories			devel
+platforms           darwin
+license             GPL-3
+maintainers			g5pw pixilla openmaintainer
+description			Opensource tools to disasm, debug, analyze and manipulate binary files.
+long_description    ${description}
+homepage			http://radare.org/
+master_sites		${homepage}get/
+
+checksums           ${distname}${extract.suffix} \
+						rmd160  f68ebf07ec62e907980e8f8bc195754bf993b466 \
+						sha256  e12feea3b776601d7b680e64250897110cf4fca2f1214b4c527e13b7abe900e0
+
+patch.pre_args      -p1
+patchfiles          patch-change_install_names.diff \
+                    patch-libr-Makefile.diff \
+                    patch-libr-config.mk.tail.diff \
+                    patch-libr-rules.mk.diff \
+                    patch-mk-gcc.mk.diff
+
+build.env-append "LDFLAGS=-L${prefix}/lib"
+					
+post-destroot {
+    # Fix link lib paths
+    system "cd ${worksrcpath} && sh change_install_names ${destroot}"
+}


Property changes on: trunk/dports/devel/radare2/Portfile
___________________________________________________________________
Added: svn:keywords
   + Id
Added: svn:eol-style
   + native

Added: trunk/dports/devel/radare2/change_install_names
===================================================================
--- trunk/dports/devel/radare2/change_install_names	                        (rev 0)
+++ trunk/dports/devel/radare2/change_install_names	2012-03-16 09:35:56 UTC (rev 90862)
@@ -0,0 +1,74 @@
+#!/bin/sh
+
+# Be noise.
+VERBOSE=no
+# Stop on path failures.
+STOP=no
+
+# This is the DESTROOT we have installed into.
+# Example:
+#   $ DESTROOT=/sandbox/radare2 make install
+#   $ sudo change_install_names /sandbox/radare2
+DESTROOT="${1}"
+
+# find files in DESTROOT
+FILES=( $(find "${DESTROOT}" -type f) )
+IFS=$'\n'
+# work on each file in FILES
+for (( fc = 0 ; fc < ${#FILES[@]} ; fc++ ))
+do
+    # If we are not a file or dir we are done.
+    if [[ ! -f "${FILES[$fc]}" && ! -d "${FILES[$fc]}" ]]
+    then
+        echo "FILE ${eError}: ${FILES[$fc]}"
+        break 1
+    # If we are a file lets try to fix our id. We do not bother checking file type because
+    # install_name_tool harmlessly fails to work on files it is not designed to work on.
+    elif [[ -f "${FILES[$fc]}" ]]
+    then
+        FILEID=$(echo "${FILES[$fc]}" | sed "s|^${DESTROOT}||")
+        [ "$VERBOSE" == "yes" ] && echo "FILEID: ${FILEID}"
+        # fix the file id.
+        install_name_tool -id "${FILEID}" "${FILES[$fc]}" 2>/dev/null
+    fi
+    # If not a dir, look for shared libs.
+    if [ ! -d "${FILES[$fc]}" ]
+    then
+        # Create an array of all the shared files if any.
+        SHAREDLIBRARYS=( $(otool -XL "${FILES[$fc]}" | sed -e "s/^Archive.*//" | tr -d '\t' | awk '{print $1}') )
+        if [[ ${#SHAREDLIBRARYS[@]} -gt 0 ]]
+        then
+            for (( sc = 0 ; sc < ${#SHAREDLIBRARYS[@]} ; sc++ ))
+            do
+                # If the shared lib path is not a full path we need to fix it.
+                if [ ${SHAREDLIBRARYS[$sc]:0:1} != "/" ]
+                then
+                    [ "$VERBOSE" == "yes" ] && echo "${FILES[$fc]}"
+                    [ "$VERBOSE" == "yes" ] && echo "${SHAREDLIBRARYS[$sc]}"
+                    [ "$VERBOSE" == "yes" ] && echo "find ${DESTROOT} -not -type d -name ${SHAREDLIBRARYS[$sc]}"
+                    # Try and find the lib in DESTROOT
+                    FOUNDPATH=$(find ${DESTROOT} -not -type d -name ${SHAREDLIBRARYS[$sc]} | sed "s,^${DESTROOT},,")
+                    echo "${FOUNDPATH}"
+                    # Fix the path.
+                    install_name_tool -change "${SHAREDLIBRARYS[$sc]}" "${FOUNDPATH}" "${FILES[$fc]}" 2>/dev/null
+                fi
+            done
+            # After fix test.
+            SHAREDLIBRARYS=( $(otool -XL "${FILES[$fc]}" | sed -e "s/^Archive.*//" | tr -d '\t' | awk '{print $1}') )
+            for (( sc = 0 ; sc < ${#SHAREDLIBRARYS[@]} ; sc++ ))
+            do
+                # Look for each shared files path.
+                # Also prepend DESTROOT to each path as we may be installing the path from DESTROOT now.
+                if [[ ! -f "${DESTROOT}${SHAREDLIBRARYS[$sc]}" && ! -f "${SHAREDLIBRARYS[$sc]}" ]]
+                then
+                    echo "${FILES[$fc]}"
+                    echo "${SHAREDLIBRARYS[$sc]}"
+                    exit 1
+                fi
+            done
+            [ "$VERBOSE" == "yes" ] && otool -XL "${FILES[$fc]}"
+            [ "$STOP" == "yes" ] && break 2
+        fi
+    fi
+done
+unset IFS

Added: trunk/dports/devel/radare2/files/patch-change_install_names.diff
===================================================================
--- trunk/dports/devel/radare2/files/patch-change_install_names.diff	                        (rev 0)
+++ trunk/dports/devel/radare2/files/patch-change_install_names.diff	2012-03-16 09:35:56 UTC (rev 90862)
@@ -0,0 +1,77 @@
+--- a/change_install_names	1969-12-31 16:00:00.000000000 -0800
++++ b/change_install_names	2011-12-19 18:27:40.000000000 -0800
+@@ -0,0 +1,74 @@
++#!/bin/sh
++
++# Be noise.
++VERBOSE=no
++# Stop on path failures.
++STOP=no
++
++# This is the DESTROOT we have installed into.
++# Example:
++#   $ DESTROOT=/sandbox/radare2 make install
++#   $ sudo change_install_names /sandbox/radare2
++DESTROOT="${1}"
++
++# find files in DESTROOT
++FILES=( $(find "${DESTROOT}" -type f) )
++IFS=$'\n'
++# work on each file in FILES
++for (( fc = 0 ; fc < ${#FILES[@]} ; fc++ ))
++do
++    # If we are not a file or dir we are done.
++    if [[ ! -f "${FILES[$fc]}" && ! -d "${FILES[$fc]}" ]]
++    then
++        echo "FILE ${eError}: ${FILES[$fc]}"
++        break 1
++    # If we are a file lets try to fix our id. We do not bother checking file type because
++    # install_name_tool harmlessly fails to work on files it is not designed to work on.
++    elif [[ -f "${FILES[$fc]}" ]]
++    then
++        FILEID=$(echo "${FILES[$fc]}" | sed "s|^${DESTROOT}||")
++        [ "$VERBOSE" == "yes" ] && echo "FILEID: ${FILEID}"
++        # fix the file id.
++        install_name_tool -id "${FILEID}" "${FILES[$fc]}" 2>/dev/null
++    fi
++    # If not a dir, look for shared libs.
++    if [ ! -d "${FILES[$fc]}" ]
++    then
++        # Create an array of all the shared files if any.
++        SHAREDLIBRARYS=( $(otool -XL "${FILES[$fc]}" | sed -e "s/^Archive.*//" | tr -d '\t' | awk '{print $1}') )
++        if [[ ${#SHAREDLIBRARYS[@]} -gt 0 ]]
++        then
++            for (( sc = 0 ; sc < ${#SHAREDLIBRARYS[@]} ; sc++ ))
++            do
++                # If the shared lib path is not a full path we need to fix it.
++                if [ ${SHAREDLIBRARYS[$sc]:0:1} != "/" ]
++                then
++                    [ "$VERBOSE" == "yes" ] && echo "${FILES[$fc]}"
++                    [ "$VERBOSE" == "yes" ] && echo "${SHAREDLIBRARYS[$sc]}"
++                    [ "$VERBOSE" == "yes" ] && echo "find ${DESTROOT} -not -type d -name ${SHAREDLIBRARYS[$sc]}"
++                    # Try and find the lib in DESTROOT
++                    FOUNDPATH=$(find ${DESTROOT} -not -type d -name ${SHAREDLIBRARYS[$sc]} | sed "s,^${DESTROOT},,")
++                    echo "${FOUNDPATH}"
++                    # Fix the path.
++                    install_name_tool -change "${SHAREDLIBRARYS[$sc]}" "${FOUNDPATH}" "${FILES[$fc]}" 2>/dev/null
++                fi
++            done
++            # After fix test.
++            SHAREDLIBRARYS=( $(otool -XL "${FILES[$fc]}" | sed -e "s/^Archive.*//" | tr -d '\t' | awk '{print $1}') )
++            for (( sc = 0 ; sc < ${#SHAREDLIBRARYS[@]} ; sc++ ))
++            do
++                # Look for each shared files path.
++                # Also prepend DESTROOT to each path as we may be installing the path from DESTROOT now.
++                if [[ ! -f "${DESTROOT}${SHAREDLIBRARYS[$sc]}" && ! -f "${SHAREDLIBRARYS[$sc]}" ]]
++                then
++                    echo "${FILES[$fc]}"
++                    echo "${SHAREDLIBRARYS[$sc]}"
++                    exit 1
++                fi
++            done
++            [ "$VERBOSE" == "yes" ] && otool -XL "${FILES[$fc]}"
++            [ "$STOP" == "yes" ] && break 2
++        fi
++    fi
++done
++unset IFS

Added: trunk/dports/devel/radare2/files/patch-libr-Makefile.diff
===================================================================
--- trunk/dports/devel/radare2/files/patch-libr-Makefile.diff	                        (rev 0)
+++ trunk/dports/devel/radare2/files/patch-libr-Makefile.diff	2012-03-16 09:35:56 UTC (rev 90862)
@@ -0,0 +1,29 @@
+--- a/libr/Makefile	2011-12-16 06:44:05.000000000 -0800
++++ b/libr/Makefile	2011-12-16 12:44:12.000000000 -0800
+@@ -54,7 +54,7 @@
+ 	done
+ 	for a in ${LIBLIST} ; do \
+ 		ln -fs ${PWD}/$${a}/libr_$${a}.${EXT_SO} ${LFX}/libr_$${a}.${EXT_SO} ; \
+-		ln -fs ${PWD}/$${a}/libr_$${a}.${EXT_SO} ${LFX}/libr_$${a}.${EXT_SO}.${LIBVERSION} ; \
++		ln -fs ${PWD}/$${a}/libr_$${a}.${EXT_SO} ${LFX}/libr_$${a}.${LIBVERSION}.${EXT_SO} ; \
+ 		ln -fs ${PWD}/$${a}/libr_$${a}.${EXT_AR} ${LFX}/libr_$${a}.${EXT_AR} ; \
+ 		for b in $${a}/p/*.${EXT_SO} ; do \
+ 			if [ -e ${PWD}/$${b} ] ; then \
+@@ -68,12 +68,12 @@
+ 	# libraries
+ 	@${INSTALL_DIR} ${LFX}
+ 	@for a in `find * -type f | grep -e '\.${EXT_SO}$$' | grep -v lib/t | grep lib | grep -v /p/` ; do \
+-	  b=`echo $$a|cut -d / -f 2`; \
+-	  echo " ${LFX}/$$b.${LIBVERSION}"; \
+-	  ${INSTALL_LIB} $$a ${LFX}/$$b.${LIBVERSION} ; \
+-	  ( cd ${LFX} ; ln -fs $$b.${LIBVERSION} $$b ) ; \
++	  b=`echo $$a|cut -d / -f 2|sed -e 's,\.${EXT_SO},,g'`; \
++	  echo " ${LFX}/$$b.${LIBVERSION}.${EXT_SO}"; \
++	  ${INSTALL_LIB} $$a ${LFX}/$$b.${LIBVERSION}.${EXT_SO} ; \
++	  ( cd ${LFX} ; ln -fs $$b.${LIBVERSION}.${EXT_SO} $$b.${EXT_SO} ) ; \
+ 	done
+-	#Linux only? ( cd ${LFX} ; ln -fs $$b.${LIBVERSION} $$b.0 ; ln -fs $$b.0 $$b )
++	#Linux only? ( cd ${LFX} ; ln -fs $$b.${LIBVERSION}.${EXT_SO} $$b.0.${EXT_SO} ; ln -fs $$b.0.${EXT_SO} $$b.${EXT_SO} )
+ 	# object archives
+ 	@for a in `find * -type f | grep -e '\.a$$' | grep -v fs/p` ; do \
+ 	  echo " ${LFX}/$$a"; ${INSTALL_DATA} $$a ${LFX} ; done

Added: trunk/dports/devel/radare2/files/patch-libr-config.mk.tail.diff
===================================================================
--- trunk/dports/devel/radare2/files/patch-libr-config.mk.tail.diff	                        (rev 0)
+++ trunk/dports/devel/radare2/files/patch-libr-config.mk.tail.diff	2012-03-16 09:35:56 UTC (rev 90862)
@@ -0,0 +1,10 @@
+--- a/libr/config.mk.tail	2011-12-16 06:44:05.000000000 -0800
++++ b/libr/config.mk.tail	2011-12-16 12:45:09.000000000 -0800
+@@ -130,6 +130,6 @@
+ ifeq (${OSTYPE},windows)
+ libname=-shared -o $1.${EXT_SO}
+ else
+-libname=-shared -o $1.${EXT_SO} ${LDFLAGS_SONAME}$1.${EXT_SO}.${LIBVERSION}
++libname=-shared -o $1.${EXT_SO} ${LDFLAGS_SONAME}$1.${LIBVERSION}.${EXT_SO}
+ endif
+ endif

Added: trunk/dports/devel/radare2/files/patch-libr-rules.mk.diff
===================================================================
--- trunk/dports/devel/radare2/files/patch-libr-rules.mk.diff	                        (rev 0)
+++ trunk/dports/devel/radare2/files/patch-libr-rules.mk.diff	2012-03-16 09:35:56 UTC (rev 90862)
@@ -0,0 +1,20 @@
+--- a/libr/rules.mk	2011-12-16 06:44:05.000000000 -0800
++++ b/libr/rules.mk	2011-12-16 14:25:19.000000000 -0800
+@@ -19,7 +19,7 @@
+ SRC=$(subst .o,.c,$(OBJ))
+ 
+ ifeq (${OSTYPE},gnulinux)
+-LIBNAME=${LDFLAGS_SONAME}${LIBSO}.${LIBVERSION}
++LIBNAME=${LDFLAGS_SONAME}${LIBSO}
+ else
+ LIBNAME=${LDFLAGS_SONAME}${LIBSO}
+ endif
+@@ -102,7 +102,7 @@
+ all: ${BIN}${EXT_EXE}
+ 
+ ${BIN}${EXT_EXE}: ${OBJ}
+-	${CC} $+ -L.. ${LDFLAGS} ${LDLIBS} -o ${BIN}${EXT_EXE}
++	${CC} $+ -L.. ${LDFLAGS} ${LDLIBS} -headerpad_max_install_names -o ${BIN}${EXT_EXE}
+ endif
+ 
+ # Dummy myclean rule that can be overriden by the t/ Makefile

Added: trunk/dports/devel/radare2/files/patch-mk-gcc.mk.diff
===================================================================
--- trunk/dports/devel/radare2/files/patch-mk-gcc.mk.diff	                        (rev 0)
+++ trunk/dports/devel/radare2/files/patch-mk-gcc.mk.diff	2012-03-16 09:35:56 UTC (rev 90862)
@@ -0,0 +1,11 @@
+--- a/mk/gcc.mk	2011-12-16 06:44:05.000000000 -0800
++++ b/mk/gcc.mk	2011-12-16 12:22:15.000000000 -0800
+@@ -19,7 +19,7 @@
+ #CFLAGS+=-arch ${ARCH}
+ #LDFLAGS+=-arch ${ARCH}
+ LDFLAGS_LIB=-dynamiclib
+-LDFLAGS_SONAME=-Wl,-install_name,
++LDFLAGS_SONAME=-Wl,-headerpad_max_install_names,-install_name,
+ else
+ LDFLAGS_LIB=-shared
+ #ifneq (${NAME},)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20120316/371f9c2f/attachment.html>


More information about the macports-changes mailing list