1#!/usr/bin/env python 2 3import os, sys, subprocess 4 5output = None 6output_type = 'executable' 7 8args = sys.argv[1:] 9while args: 10 arg = args.pop(0) 11 if arg == '-shared': 12 output_type = 'shared' 13 elif arg == '-dynamiclib': 14 output_type = 'dylib' 15 elif arg == '-c': 16 output_type = 'object' 17 elif arg == '-S': 18 output_type = 'assembly' 19 elif arg == '-o': 20 output = args.pop(0) 21 22if output == None: 23 print "No output file name!" 24 sys.exit(1) 25 26ret = subprocess.call(sys.argv[1:]) 27if ret != 0: 28 sys.exit(ret) 29 30# If we produce a dylib, ad-hoc sign it. 31if output_type in ['shared', 'dylib']: 32 ret = subprocess.call(["codesign", "-s", "-", output]) 33