Added recipes for some Linux system libraries.
This commit is contained in:
23
recipes/X11/recipe.py
Normal file
23
recipes/X11/recipe.py
Normal file
@@ -0,0 +1,23 @@
|
||||
|
||||
|
||||
import os
|
||||
from SCons.Script import *
|
||||
|
||||
|
||||
def available(env: Environment):
|
||||
if os.name != 'posix':
|
||||
return 'X11 is only available on Linux.'
|
||||
|
||||
def versions(env: Environment, update: bool = False):
|
||||
if os.name == 'posix':
|
||||
return [(0, 0, 0)]
|
||||
else:
|
||||
return []
|
||||
|
||||
def dependencies(env: Environment, version) -> 'dict':
|
||||
return {}
|
||||
|
||||
def cook(env: Environment, version) -> dict:
|
||||
return {
|
||||
'LIBS': ['X11']
|
||||
}
|
||||
25
recipes/Xft/recipe.py
Normal file
25
recipes/Xft/recipe.py
Normal file
@@ -0,0 +1,25 @@
|
||||
|
||||
|
||||
import os
|
||||
from SCons.Script import *
|
||||
|
||||
|
||||
def available(env: Environment):
|
||||
if os.name != 'posix':
|
||||
return 'Xft is only available on Linux.'
|
||||
|
||||
def versions(env: Environment, update: bool = False):
|
||||
if os.name == 'posix':
|
||||
return [(0, 0, 0)]
|
||||
else:
|
||||
return []
|
||||
|
||||
def dependencies(env: Environment, version) -> 'dict':
|
||||
return {
|
||||
'fontconfig': {}
|
||||
}
|
||||
|
||||
def cook(env: Environment, version) -> dict:
|
||||
return {
|
||||
'LIBS': ['Xft']
|
||||
}
|
||||
25
recipes/fontconfig/recipe.py
Normal file
25
recipes/fontconfig/recipe.py
Normal file
@@ -0,0 +1,25 @@
|
||||
|
||||
|
||||
import os
|
||||
from SCons.Script import *
|
||||
|
||||
|
||||
def available(env: Environment):
|
||||
if os.name != 'posix':
|
||||
return 'Fontconfig is only available on Linux.'
|
||||
|
||||
def versions(env: Environment, update: bool = False):
|
||||
if os.name == 'posix':
|
||||
return [(0, 0, 0)]
|
||||
else:
|
||||
return []
|
||||
|
||||
def dependencies(env: Environment, version) -> 'dict':
|
||||
return {
|
||||
'freetype': {}
|
||||
}
|
||||
|
||||
def cook(env: Environment, version) -> dict:
|
||||
return {
|
||||
'LIBS': ['fontconfig']
|
||||
}
|
||||
23
recipes/freetype/recipe.py
Normal file
23
recipes/freetype/recipe.py
Normal file
@@ -0,0 +1,23 @@
|
||||
|
||||
|
||||
import os
|
||||
from SCons.Script import *
|
||||
|
||||
|
||||
def available(env: Environment):
|
||||
if os.name != 'posix':
|
||||
return 'Freetype is only available on Linux.'
|
||||
|
||||
def versions(env: Environment, update: bool = False):
|
||||
if os.name == 'posix':
|
||||
return [(0, 0, 0)]
|
||||
else:
|
||||
return []
|
||||
|
||||
def dependencies(env: Environment, version) -> 'dict':
|
||||
return {}
|
||||
|
||||
def cook(env: Environment, version) -> dict:
|
||||
return {
|
||||
'LIBS': ['freetype']
|
||||
}
|
||||
37
recipes/nana/recipe.py
Normal file
37
recipes/nana/recipe.py
Normal file
@@ -0,0 +1,37 @@
|
||||
|
||||
|
||||
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
|
||||
)
|
||||
@@ -6,6 +6,16 @@ from SCons.Script import *
|
||||
_REPO_NAME = 'zlib'
|
||||
_REPO_URL = 'https://github.com/madler/zlib.git'
|
||||
_TAG_PATTERN = re.compile(r'^v([0-9]+)\.([0-9]+)(?:\.([0-9]+))?$')
|
||||
_VERSION_SOURCE = '''
|
||||
#include <zlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
puts(ZLIB_VERSION);
|
||||
return 0;
|
||||
}
|
||||
'''
|
||||
|
||||
def _build_lib_name(env: Environment) -> str:
|
||||
if os.name == 'posix':
|
||||
@@ -17,19 +27,29 @@ def _build_lib_name(env: Environment) -> str:
|
||||
else:
|
||||
raise Exception('libpng is not supported yet on this OS')
|
||||
|
||||
def versions(env: Environment, update: bool = False):
|
||||
def versions(env: Environment, update: bool = False, options: dict = {}):
|
||||
tags = env.GitTags(repo_name = _REPO_NAME, remote_url = _REPO_URL, force_fetch=update)
|
||||
result = []
|
||||
for tag in tags:
|
||||
match = _TAG_PATTERN.match(tag)
|
||||
if match:
|
||||
result.append((int(match.groups()[0]), int(match.groups()[1]), int(match.groups()[2] or 0)))
|
||||
|
||||
if options.get('use_system_library'):
|
||||
version = env.VersionFromSource('pkgconf --cflags-only-I zlib', _VERSION_SOURCE)
|
||||
if version:
|
||||
env['SYSTEM_ZLIB_VERSION'] = version
|
||||
result.append(version)
|
||||
else:
|
||||
for tag in tags:
|
||||
match = _TAG_PATTERN.match(tag)
|
||||
if match:
|
||||
result.append((int(match.groups()[0]), int(match.groups()[1]), int(match.groups()[2] or 0)))
|
||||
return result
|
||||
|
||||
def dependencies(env: Environment, version) -> 'dict':
|
||||
return {}
|
||||
|
||||
def cook(env: Environment, version) -> dict:
|
||||
def cook(env: Environment, version, options: dict = {}) -> dict:
|
||||
if options.get('use_system_library'):
|
||||
return env.PkgCook('pkgconf --cflags --libs zlib')
|
||||
|
||||
git_ref = f'refs/tags/v{version[0]}.{version[1]}'
|
||||
if version[2] != 0:
|
||||
git_ref = git_ref + f'.{version[2]}'
|
||||
|
||||
Reference in New Issue
Block a user