summaryrefslogtreecommitdiff
path: root/recipes/winpthreads.recipe
blob: e7ae5fc4d50c34d9176780d4d4d3298536c70922 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# -*- Mode: Python -*- vi:si:et:sw=4:sts=4:ts=4:syntax=python


class Recipe(recipe.Recipe):
    name = 'winpthreads'
    version = '20100604'
    license = License.LGPL
    btype = BuildType.CUSTOM
    stype = SourceType.CUSTOM

    files_libs = []
    files_devel = ['include/pthread.h', 'include/pthreads_win32_config.h',
                   'include/sched.h', 'include/semaphore.h']

    def prepare(self):
        if self.config.target_arch == Architecture.X86:
            self.libname = 'pthreadGC2-w32'
        if self.config.target_arch == Architecture.X86_64:
            self.libname = 'pthreadGC2-w64'
        self.dllname = self.libname + '.dll'
        self.files_libs = [self.libname]

    def install(self):
        import shutil
        from cerbero.errors import FatalError
        if self.config.target_platform != Platform.WINDOWS:
            raise FatalError("%s can only be installed on Windows" % self.name)
        shutil.copy(os.path.join(self.config.toolchain_prefix, 'bin', self.dllname),
                os.path.join(self.config.prefix, 'bin', self.dllname))
        for f in self.files_devel:
            shutil.copy(os.path.join(self.config.toolchain_prefix, self.config.host, f),
                        os.path.join(self.config.prefix, f))