view gub/specs/pthreads-w32.py @ 5661:9cc45009b221

Grand install_command () -> class.install_command hack.
author Jan Nieuwenhuizen <janneke@gnu.org>
date Sat, 26 Sep 2009 23:05:38 +0200
parents 7aee893b7746
children ccc20ae889ca
line wrap: on
line source

from gub import misc
from gub import target

class Pthreads_w32 (target.MakeBuild):
    source = 'ftp://sourceware.org/pub/pthreads-win32/pthreads-w32-2-8-0-release.tar.gz'
    make_flags = 'GC CROSS=%(toolchain_prefix)s'
    install_command = misc.join_lines ('''
install -d %(install_prefix)s/bin
install -d %(install_prefix)s/include
install -d %(install_prefix)s/lib
&& install -m644 pthread.h sched.h %(install_prefix)s/include
&& install -m755 pthreadGC2.dll %(install_prefix)s/bin
&& install -m755 libpthreadGC2.a %(install_prefix)s/lib
&& install -m755 pthreadGC2.dll %(install_prefix)s/bin/pthread.dll
&& install -m755 libpthreadGC2.a %(install_prefix)s/lib/libpthread.a
''')
    def install (self):
        for file in ['pthread.h', 'sched.h']:
            self.file_sub ([('#undef PTW32_LEVEL\s', ''' 
#ifndef _POSIX_SOURCE
#define _POSIX_SOURCE
#undef _POSIX_C_SOURCE
#define _POSIX_C_SOURCE 199000
/*URG*/
#define pid_t int
#endif

#undef PTW32_LEVEL
''')],
                           '%(builddir)s/%(file)s', env=locals ())
        self.system ('''
rm -rf %(install_root)s
cd %(builddir)s && %(install_command)s
''')
        self.install_license ()
        self.libtool_installed_la_fixups ()