[Clam-devel] Please test macosx dmg (only intel)

Pau Arumi parumi at iua.upf.edu
Tue Jan 23 11:43:39 PST 2007


a new day and a new package!
now it is turn for networkeditor:
http://clam.iua.upf.edu/download/mac/cvssnapshots/CLAM_NetworkEditor-0.4.3-CVS-20070123.dmg

as always, test please and report
still to-do: add network examples and other binaries (prototyper and 
qtdesigner), and ppc version of course.

good news are that now, building new bundles (and dmgs) is super easy 
since we integrated all the stuff in a new scons tool.
for instance this is all Annotator and NetworkEditor SConstruct knows 
about mac bundles:

    mac_bundle = env.Bundle(
        BUNDLE_NAME='NetworkEditor',
        BUNDLE_BINARIES=programs,
        BUNDLE_RESOURCEDIRS=[],
        BUNDLE_PLIST='resources/Info.plist',
        BUNDLE_ICON='resources/CLAM.icns',
     )

Pau & David

for the record, find attached a cleaned and enhanced version of the 
script that add all dependent libraries to the bundle and fixes external 
links.



-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.

-------------- next part --------------
#! /opt/local/bin/python

import os, glob
import sys

def run(command) :
	print "\033[32m:: ", command, "\033[0m"
	return os.system(command)
def norun(command) :
	print "\033[31mXX ", command, "\033[0m"


def needsChange(binary, blacklist) :
	#with python2.5 we could just return all([not binary.startswith(blacksheep) for blacksheep in blacklist])
	for blacksheep in blacklist :
		if binary.startswith( blacksheep ) : 
			print "found blackseep", binary
			return False
	return True

def libDependencies(binary, visited, blacklist) :
	print "examining", binary
	for line in os.popen("otool -L "+binary).readlines()[1:] :
		entry = line.split()[0]
		if entry in visited : continue
		if not needsChange( entry, blacklist ) : continue
		visited.append( entry )
		libDependencies( entry, visited, blacklist )

def addDependentLibs( bundle ) :
	binaries = glob.glob(bundle+"/Contents/MacOS/*") 

	doNotChange = [
		"/System/",
		"/usr/lib/",
		"@executable_path/",
	]
	libsPath = []
	for binary in binaries :
		libDependencies(binary, libsPath, doNotChange)
	print libsPath

	libs = [ (os.path.basename(path), path) for path in libsPath ] 
	run("mkdir -p %(bundle)s/Contents/Frameworks/" % locals() )

	vars = {}
	# copy all dependent libs to the bundle and change its id (relative path to the bundle)
	for lib, path in libs :
		run("cp %(path)s %(bundle)s/Contents/Frameworks/%(lib)s" % locals() )
		run("install_name_tool -id @executable_path/../Frameworks/%(lib)s %(bundle)s/Contents/Frameworks/%(lib)s" % locals() )
	# fix binary dependencies
	for current in binaries :
		for lib, libpath in libs :
			run("install_name_tool -change %(libpath)s @executable_path/../Frameworks/%(lib)s %(current)s" % locals() )
	# fix libs dependencies
	for current, _ in libs :
		for lib, libpath in libs :
			run("install_name_tool -change %(libpath)s @executable_path/../Frameworks/%(lib)s %(bundle)s/Contents/Frameworks/%(current)s" % locals() )

if __name__ == "__main__":
	addDependentLibs( "Annotator.app" )


More information about the clam-devel mailing list