[78776] users/pixilla/devel

pixilla at macports.org pixilla at macports.org
Sat May 21 14:59:40 PDT 2011


Revision: 78776
          http://trac.macports.org/changeset/78776
Author:   pixilla at macports.org
Date:     2011-05-21 14:59:38 -0700 (Sat, 21 May 2011)
Log Message:
-----------
devel/mp-shared-objects: New Port. Simple script for showing and checking shared object paths.

Added Paths:
-----------
    users/pixilla/devel/mp-shared-objects/
    users/pixilla/devel/mp-shared-objects/Portfile
    users/pixilla/devel/mp-shared-objects/files/
    users/pixilla/devel/mp-shared-objects/files/mp-shared-objects

Added: users/pixilla/devel/mp-shared-objects/Portfile
===================================================================
--- users/pixilla/devel/mp-shared-objects/Portfile	                        (rev 0)
+++ users/pixilla/devel/mp-shared-objects/Portfile	2011-05-21 21:59:38 UTC (rev 78776)
@@ -0,0 +1,26 @@
+# -*- coding: utf-8; mode: tcl; tab-width: 4; truncate-lines: t; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:et:sw=4:ts=4:sts=4
+# $Id$
+
+
+PortSystem          1.0
+
+name                mp-shared-objects
+version             0.0.1
+categories          devel
+platforms           darwin
+license             GPL-2
+maintainers         pixilla
+distfiles
+
+description         Use otool to show/verify shared objects.
+long_description    ${description}
+
+homepage            {}
+master_sites        {}
+
+use_configure       no
+build               {}
+destroot {
+    xinstall -m 755 -W ${filespath} mp-shared-objects \
+        ${destroot}${prefix}/sbin/
+}


Property changes on: users/pixilla/devel/mp-shared-objects/Portfile
___________________________________________________________________
Added: svn:keywords
   + Id
Added: svn:eol-style
   + native

Added: users/pixilla/devel/mp-shared-objects/files/mp-shared-objects
===================================================================
--- users/pixilla/devel/mp-shared-objects/files/mp-shared-objects	                        (rev 0)
+++ users/pixilla/devel/mp-shared-objects/files/mp-shared-objects	2011-05-21 21:59:38 UTC (rev 78776)
@@ -0,0 +1,105 @@
+#!/bin/bash
+# Argument = [-q] <path name>
+
+eError="error: no such path"
+
+usage()
+{
+cat << EOF
+
+usage: $(basename $0) options
+
+This script runs otool -XL over the contents of a path:
+\$ $(basename $0) -p /opt/local/lib/mysql5
+or a MacPorts port name:
+\$ $(basename $0) -p mysql5 -m
+
+
+OPTIONS:
+    -h      Show this message
+    -p      Path or Port (requires -m) to check
+    -m      Use -p as a port name rather then a path
+    -c      Check if shared library exists, print "${eError}" if it does not
+    -q      Quite, only print errors, implies -c
+
+EOF
+}
+
+[ -z $TYPE ] && TYPE=PATH
+[ -z $CHECK_EXISTS ] && CHECK_EXISTS=
+[ -z $QUITE ] && QUITE=
+
+while getopts "hp:mcq" OPTION
+do
+    case $OPTION in
+        h)
+            usage
+            exit 1
+            ;;
+        p)
+            NAME=$OPTARG
+            ;;
+        m)
+            TYPE=PORT
+            ;;
+        c)
+            CHECK_EXISTS=yes
+            ;;
+        q)
+            QUITE=yes
+            CHECK_EXISTS=yes
+            ;;
+        ?)
+            usage
+            exit
+            ;;
+    esac
+done
+
+if [[ -z $NAME ]]
+then
+    usage
+    exit 1
+fi
+
+IFS=$'\n'
+if [ "${TYPE}" == "PATH" ]
+then
+  FILES=( $(find "${NAME}" -type f) )
+fi
+if [ "${TYPE}" == "PORT" ]
+then
+  FILES=( $(port -q contents "${NAME}" | sed -e "s/^ *//") )
+fi
+for (( fc = 0 ; fc < ${#FILES[@]} ; fc++ ))
+do
+    if [[ ! -f "${FILES[$fc]}" && ! -d "${FILES[$fc]}" ]]
+    then
+        echo "FILE ${eError}: ${FILES[$fc]}"
+        break 1
+    fi
+    if [ ! -d "${FILES[$fc]}" ]
+    then    
+        SHAREDLIBRARYS=( $(otool -XL "${FILES[$fc]}" | sed -e "s/^Archive.*//" | tr -d '\t' | awk '{print $1}') )
+        if [[ ${#SHAREDLIBRARYS[@]} -gt 0 ]]
+        then
+            [ -z $QUITE ] && echo "${FILES[$fc]}"
+            for (( sc = 0 ; sc < ${#SHAREDLIBRARYS[@]} ; sc++ ))
+            do
+                if [ ! -f "${SHAREDLIBRARYS[$sc]}" ]
+                then
+                    [ -n $QUITE ] && echo "${FILE[$fc]}"
+                    echo "SHAREDLIBRARY ${eError}: ${SHAREDLIBRARYS[$sc]}"
+break 2
+                else
+                    [ -z $QUITE ] && echo -e "\t${SHAREDLIBRARYS[$sc]}"
+                fi
+            done
+        fi
+    fi
+done
+unset IFS
+unset NAME
+unset CHECK_EXISTS
+unset QUITE
+


Property changes on: users/pixilla/devel/mp-shared-objects/files/mp-shared-objects
___________________________________________________________________
Added: svn:executable
   + *
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20110521/f6b30f0d/attachment.html>


More information about the macports-changes mailing list