This repository has been archived by the owner on Jun 24, 2022. It is now read-only.
forked from EddyPronk/gub
-
Notifications
You must be signed in to change notification settings - Fork 17
/
coreutils.py
54 lines (52 loc) · 2.05 KB
/
coreutils.py
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
import os
#
from gub import misc
from gub import tools
'''
Build shared libcoreutils.so without using libtool
for GUB's librestrict(2) to kick-in.
'''
no_patch = True # let's not use patch in a bootstrap package
class Coreutils__tools (tools.AutoBuild):
# source = 'http://ftp.gnu.org/pub/gnu/coreutils/coreutils-6.12.tar.gz'
source = 'http://ftp.gnu.org/pub/gnu/coreutils/coreutils-7.4.tar.gz'
patches = ['coreutils-6.12-shared-automake.patch']
dependencies = ['tools::autoconf', 'tools::automake']
force_autoupdate = True
if no_patch:
patches = []
dependencies = []
force_autoupdate = False
def patch (self):
if no_patch:
self.file_sub ([('noinst_LIBRARIES', 'lib_LIBRARIES')],
'%(srcdir)s/lib/gnulib.mk')
self.file_sub ([
(r'libcoreutils[.]a', 'libcoreutils.so'),
('[.][.]/lib/libcoreutils.so ([$][(]LIBINTL[)]) [.][.]/lib/libcoreutils.so', r'-L../lib -lcoreutils \1'),
], '%(srcdir)s/src/Makefile.in')
else:
tools.AutoBuild.patch (self)
def autoupdate (self):
if no_patch:
return
self.system ('''
cd %(srcdir)s && autoreconf
''')
configure_variables = (tools.AutoBuild.configure_variables
+ ' CFLAGS=-fPIC')
make_flags = misc.join_lines ('''
V=1
LDFLAGS='%(rpath)s'
LIBS='$(cp_LDADD) $(ls_LDADD) -lm'
RANLIB='mvaso () { test $$(basename $$1) == libcoreutils.a && mv $$1 $$(dirname $$1)/$$(basename $$1 .a).so || : ; }; mvaso '
libcoreutils_a_AR='gcc -shared -o'
''')
def install (self):
# The RANLIB/mvaso trick needs libcoreutils.a to exist at install time.
self.system ('cd %(builddir)s/lib && ln -f libcoreutils.so libcoreutils.a')
tools.AutoBuild.install (self)
self.system ('cd %(builddir)s/lib && rm -f libcoreutils.a')
if no_patch:
self.system ('mkdir -p %(install_prefix)s/lib')
self.system ('cp -pv %(builddir)s/lib/libcoreutils* %(install_prefix)s/lib')