# Path: scripts/pkgs/constants.py
# PREFIX = os.path.join(SW, 'sw')
# 
# def build_dir():
#     return _build_dir
# 
# Path: scripts/pkgs/utils.py
# def simple_build(configure_args=(), make_args=(), install_args=(), library_path=None, override_prefix=None, no_parallel=False, configure_name='./configure'):
#     if isinstance(configure_args, type('')):
#         configure_args = split(configure_args)
#     if isinstance(make_args, type('')):
#         make_args = split(make_args)
#     if isinstance(install_args, type('')):
#         install_args = split(install_args)
#     run(configure_name, '--prefix=' + (override_prefix or build_dir()), *configure_args)
#     make_opts = [] if no_parallel else split(MAKEOPTS)
#     run('make', *(make_opts + list(make_args)))
#     mi = ['make'] + list(install_args) + ['install']
#     run(*mi, library_path=library_path)
# 
# class ModifiedEnv(object):
# 
#     def __init__(self, **kwargs):
#         self.mods = kwargs
# 
#     def apply(self, mods):
#         for k, val in mods.iteritems():
#             if val:
#                 worker_env[k] = val
#             else:
#                 worker_env.pop(k, None)
# 
#     def __enter__(self):
#         self.orig = {k: worker_env.get(k) for k in self.mods}
#         self.apply(self.mods)
# 
#     def __exit__(self, *args):
#         self.apply(self.orig)
# 
# def walk(path='.'):
#     ''' A nice interface to os.walk '''
#     for dirpath, dirnames, filenames in os.walk(path):
#         for f in filenames:
#             yield os.path.join(dirpath, f)


import os
import shutil
from .constants import PREFIX, build_dir
from .utils import simple_build, ModifiedEnv, walk
#!/usr/bin/env python2
# vim:fileencoding=utf-8
# License: GPLv3 Copyright: 2016, Kovid Goyal <kovid at kovidgoyal.net>

from __future__ import (unicode_literals, division, absolute_import,
                        print_function)



def main(args):
    with ModifiedEnv(FREETYPE_CFLAGS='-I%s/include/freetype2' % PREFIX, FREETYPE_LIBS='-L%s/lib -lfreetype -lz -lbz2' % PREFIX):
        simple_build(

# Path: scripts/pkgs/constants.py
# PREFIX = os.path.join(SW, 'sw')
# 
# def build_dir():
#     return _build_dir
# 
# Path: scripts/pkgs/utils.py
# def simple_build(configure_args=(), make_args=(), install_args=(), library_path=None, override_prefix=None, no_parallel=False, configure_name='./configure'):
#     if isinstance(configure_args, type('')):
#         configure_args = split(configure_args)
#     if isinstance(make_args, type('')):
#         make_args = split(make_args)
#     if isinstance(install_args, type('')):
#         install_args = split(install_args)
#     run(configure_name, '--prefix=' + (override_prefix or build_dir()), *configure_args)
#     make_opts = [] if no_parallel else split(MAKEOPTS)
#     run('make', *(make_opts + list(make_args)))
#     mi = ['make'] + list(install_args) + ['install']
#     run(*mi, library_path=library_path)
# 
# class ModifiedEnv(object):
# 
#     def __init__(self, **kwargs):
#         self.mods = kwargs
# 
#     def apply(self, mods):
#         for k, val in mods.iteritems():
#             if val:
#                 worker_env[k] = val
#             else:
#                 worker_env.pop(k, None)
# 
#     def __enter__(self):
#         self.orig = {k: worker_env.get(k) for k in self.mods}
#         self.apply(self.mods)
# 
#     def __exit__(self, *args):
#         self.apply(self.orig)
# 
# def walk(path='.'):
#     ''' A nice interface to os.walk '''
#     for dirpath, dirnames, filenames in os.walk(path):
#         for f in filenames:
#             yield os.path.join(dirpath, f)


# Path: scripts/pkgs/fontconfig.py
import os
import shutil
from .constants import PREFIX, build_dir
from .utils import simple_build, ModifiedEnv, walk

#!/usr/bin/env python2
# vim:fileencoding=utf-8
# License: GPLv3 Copyright: 2016, Kovid Goyal <kovid at kovidgoyal.net>

from __future__ import (unicode_literals, division, absolute_import,
                        print_function)



def main(args):
    with ModifiedEnv(FREETYPE_CFLAGS='-I%s/include/freetype2' % PREFIX, FREETYPE_LIBS='-L%s/lib -lfreetype -lz -lbz2' % PREFIX):
        simple_build(

            '--disable-dependency-tracking --disable-static --disable-docs --with-expat=%s --with-add-fonts=/usr/share/fonts' % PREFIX)