MŠMa¨:ã@sÍdZddlZddlZddlZddlmZddlmZddlm Z m Z m Z ddl m Z mZmZmZddlmZejdkr³ddlZGd d „d e ƒZdS) a9distutils.unixccompiler Contains the UnixCCompiler class, a subclass of CCompiler that handles the "typical" Unix-style command-line C compiler: * macros defined with -Dname[=value] * macros undefined with -Uname * include search directories specified with -Idir * libraries specified with -lllib * library search directories specified with -Ldir * compile handled by 'cc' (or similar) executable with -c option: compiles .c to .o * link static library handled by 'ar' command (possibly with 'ranlib') * link shared library handled by 'cc -shared' éN)Ú sysconfig)Únewer)Ú CCompilerÚgen_preprocess_optionsÚgen_lib_options)ÚDistutilsExecErrorÚ CompileErrorÚLibErrorÚ LinkError)ÚlogÚdarwincs eZdZdZddddgddgddgddd gd dgd d d gddiZejdd…dkr†dgedr?r%r'r*rZ EXECUTABLErrrÚbasenamer4r5r6r7r+rr r r@)rZ target_descr?rBr;r r!r"Zexport_symbolsr@r-r.Z build_temprAr/Zlib_optsZld_argsZlinkerÚir2r#r#r$ÚlinkžsH       "zUnixCCompiler.linkcCsd|S)Nz-Lr#)rÚdirr#r#r$Úlibrary_dir_optionØsz UnixCCompiler.library_dir_optioncCsd|kpd|kS)NÚgcczg++r#)rZ compiler_namer#r#r$Ú_is_gccÛszUnixCCompiler._is_gcccCs tjjtjdƒƒ}tjdd…dkr<d|Stjdd…dkr]d|Stjdd…d kr¡|j|ƒr“d d|gSd d|gStjdd…d ksÓtjdd…d krÝd|gS|j|ƒrtjdƒdkr d|Sd|Snd|SdS)NÚCCrr z-LéZfreebsdz -Wl,-rpath=ézhp-uxz-Wl,+sz+sZirix646Zosf1V5z-rpathÚGNULDÚyesz-Wl,--enable-new-dtags,-Rz-Wl,-Rz-R)r(r)rLrrr4r5rR)rrOrr#r#r$Úruntime_library_dir_optionÞs 2  z(UnixCCompiler.runtime_library_dir_optioncCsd|S)Nz-lr#)rÚlibr#r#r$Úlibrary_option szUnixCCompiler.library_optioncCs.|j|ddƒ}|j|ddƒ}|j|ddƒ}|j|ddƒ}tjdkr¨tjdƒ}tjd|ƒ} | dkr™d } n| jd ƒ} x|D]w} tj j | |ƒ} tj j | |ƒ} tj j | |ƒ}tj j | |ƒ}tjdkrÎ| j d ƒsF| j d ƒrÎ| j d ƒ rÎtj j | | d d…|ƒ} tj j | | d d…|ƒ} tj j | | d d…|ƒ}tj j | | d d…|ƒ}tj j | ƒrä| Stj j |ƒrú|Stj j | ƒr| Stj j |ƒr¯|Sq¯WdS)NZlib_typeÚsharedÚdylibÚ xcode_stubÚstaticr ÚCFLAGSz-isysroot\s+(\S+)ú/rEz/System/z/usr/z /usr/local/) r=r4r5rrÚreÚsearchÚgroupr(r)rKÚ startswithÚexists)rÚdirsrYr@Zshared_fZdylib_fZ xcode_stub_fZstatic_fZcflagsÚmZsysrootrOr[r\r^r]r#r#r$Úfind_library_file s>   """"zUnixCCompiler.find_library_file)Ú__name__Ú __module__Ú __qualname__Z compiler_typeZ executablesr4r5Zsrc_extensionsZ obj_extensionZstatic_lib_extensionZshared_lib_extensionZdylib_lib_extensionZxcode_stub_lib_extensionZstatic_lib_formatZshared_lib_formatZdylib_lib_formatZxcode_stub_lib_formatZ exe_extensionrr3r:rCrNrPrRrXrZrhr#r#)rr$r -sF            6   , r )Ú__doc__r(r4raZ distutilsrZdistutils.dep_utilrZdistutils.ccompilerrrrZdistutils.errorsrrr r r r5r6r r#r#r#r$Ús$"