Added recipes for curl, libidn2, libpsl and libunistring.
This commit is contained in:
42
recipes/unistring/recipe.py
Normal file
42
recipes/unistring/recipe.py
Normal file
@@ -0,0 +1,42 @@
|
||||
|
||||
|
||||
|
||||
import json
|
||||
import os
|
||||
import re
|
||||
import requests
|
||||
from SCons.Script import *
|
||||
|
||||
_VERSIONS_URL = 'https://ftp.gnu.org/gnu/libunistring/?F=0'
|
||||
_VERSION_PATTERN = re.compile(r'href="libunistring-([0-9]+)\.([0-9]+)\.([0-9]+)\.tar\.gz"')
|
||||
|
||||
def versions(env: Environment, update: bool = False):
|
||||
versions_file = os.path.join(env['DOWNLOAD_DIR'], 'libunistring_versions.json')
|
||||
if update or not os.path.exists(versions_file):
|
||||
req = requests.get(_VERSIONS_URL)
|
||||
result = []
|
||||
for match in _VERSION_PATTERN.finditer(req.text):
|
||||
result.append((int(match.groups()[0]), int(match.groups()[1]), int(match.groups()[2])))
|
||||
with open(versions_file, 'w') as f:
|
||||
json.dump(result, f)
|
||||
return result
|
||||
else:
|
||||
try:
|
||||
with open(versions_file, 'r') as f:
|
||||
return [tuple(v) for v in json.load(f)]
|
||||
except:
|
||||
print('libunistring_versions.json is empty or broken, redownloading.')
|
||||
return versions(env, update=True)
|
||||
|
||||
def dependencies(env: Environment, version) -> 'dict':
|
||||
return {}
|
||||
|
||||
def cook(env: Environment, version) -> dict:
|
||||
url = f'https://ftp.gnu.org/gnu/libunistring/libunistring-{version[0]}.{version[1]}.{version[2]}.tar.gz'
|
||||
repo = env.DownloadAndExtract(f'libunistring_{version[0]}.{version[1]}.{version[2]}', url = url, skip_folders = 1)
|
||||
checkout_root = repo['extracted_root']
|
||||
build_result = env.AutotoolsProject(checkout_root)
|
||||
return {
|
||||
'CPPPATH': build_result['CPPPATH'],
|
||||
'LIBS': [env.FindLib('unistring', paths=build_result['LIBPATH'])]
|
||||
}
|
||||
Reference in New Issue
Block a user