Build software using a recipe. This function does the 'configure;make;make install' dance for C software, with a possibility to customize this process, basically a poor-mans DarwinPorts.
(recipe, basedir, archList)
| 949 | return |
| 950 | |
| 951 | def buildRecipe(recipe, basedir, archList): |
| 952 | """ |
| 953 | Build software using a recipe. This function does the |
| 954 | 'configure;make;make install' dance for C software, with a possibility |
| 955 | to customize this process, basically a poor-mans DarwinPorts. |
| 956 | """ |
| 957 | curdir = os.getcwd() |
| 958 | |
| 959 | name = recipe['name'] |
| 960 | THIRD_PARTY_LIBS.append(name) |
| 961 | url = recipe['url'] |
| 962 | configure = recipe.get('configure', './configure') |
| 963 | buildrecipe = recipe.get('buildrecipe', None) |
| 964 | install = recipe.get('install', 'make && make install DESTDIR=%s'%( |
| 965 | shellQuote(basedir))) |
| 966 | |
| 967 | archiveName = os.path.split(url)[-1] |
| 968 | sourceArchive = os.path.join(DEPSRC, archiveName) |
| 969 | |
| 970 | if not os.path.exists(DEPSRC): |
| 971 | os.mkdir(DEPSRC) |
| 972 | |
| 973 | verifyThirdPartyFile(url, recipe['checksum'], sourceArchive) |
| 974 | print("Extracting archive for %s"%(name,)) |
| 975 | buildDir=os.path.join(WORKDIR, '_bld') |
| 976 | if not os.path.exists(buildDir): |
| 977 | os.mkdir(buildDir) |
| 978 | |
| 979 | workDir = extractArchive(buildDir, sourceArchive) |
| 980 | os.chdir(workDir) |
| 981 | |
| 982 | for patch in recipe.get('patches', ()): |
| 983 | if isinstance(patch, tuple): |
| 984 | url, checksum = patch |
| 985 | fn = os.path.join(DEPSRC, os.path.basename(url)) |
| 986 | verifyThirdPartyFile(url, checksum, fn) |
| 987 | else: |
| 988 | # patch is a file in the source directory |
| 989 | fn = os.path.join(curdir, patch) |
| 990 | runCommand('patch -p%s < %s'%(recipe.get('patchlevel', 1), |
| 991 | shellQuote(fn),)) |
| 992 | |
| 993 | for patchscript in recipe.get('patchscripts', ()): |
| 994 | if isinstance(patchscript, tuple): |
| 995 | url, checksum = patchscript |
| 996 | fn = os.path.join(DEPSRC, os.path.basename(url)) |
| 997 | verifyThirdPartyFile(url, checksum, fn) |
| 998 | else: |
| 999 | # patch is a file in the source directory |
| 1000 | fn = os.path.join(curdir, patchscript) |
| 1001 | if fn.endswith('.bz2'): |
| 1002 | runCommand('bunzip2 -fk %s' % shellQuote(fn)) |
| 1003 | fn = fn[:-4] |
| 1004 | runCommand('sh %s' % shellQuote(fn)) |
| 1005 | os.unlink(fn) |
| 1006 | |
| 1007 | if 'buildDir' in recipe: |
| 1008 | os.chdir(recipe['buildDir']) |
no test coverage detected
searching dependent graphs…