38 lines
		
	
	
		
			955 B
		
	
	
	
		
			Python
		
	
	
	
	
	
			
		
		
	
	
			38 lines
		
	
	
		
			955 B
		
	
	
	
		
			Python
		
	
	
	
	
	
 | 
						|
 | 
						|
import os
 | 
						|
import re
 | 
						|
from SCons.Script import *
 | 
						|
 | 
						|
 | 
						|
def _git_cook(env: Environment, repo: dict) -> dict:
 | 
						|
    checkout_root = repo['checkout_root']
 | 
						|
    build_result = env.CMakeProject(checkout_root, generate_args = ['-DNANA_CMAKE_INSTALL=ON'])
 | 
						|
 | 
						|
    lib_name = 'nana'
 | 
						|
    return {
 | 
						|
        'CPPPATH': build_result['CPPPATH'],
 | 
						|
        'LIBS': [env.FindLib(lib_name, paths=build_result['LIBPATH'])]
 | 
						|
    }
 | 
						|
 | 
						|
def _dependencies(env: Environment, version) -> dict:
 | 
						|
    result = {}
 | 
						|
    if os.name == 'nt':
 | 
						|
        pass
 | 
						|
    elif os.name == 'posix':
 | 
						|
        result.update({
 | 
						|
            'X11': {},
 | 
						|
            'Xft': {}
 | 
						|
        })
 | 
						|
    return result
 | 
						|
 | 
						|
env.GitRecipe(
 | 
						|
    globals = globals(),
 | 
						|
    repo_name = 'nana',
 | 
						|
    repo_url = 'httpshttps://github.com/mewin/nana.git',
 | 
						|
    tag_pattern = re.compile(r'^v([0-9]+)\.([0-9]+)\.([0-9]+)$'),
 | 
						|
    tag_fn = lambda version: f'v{version[0]}.{version[1]}.{version[2]}',
 | 
						|
    cook_fn = _git_cook,
 | 
						|
    dependencies = _dependencies
 | 
						|
)
 |