Skip to content

Commit 2214c89

Browse files
committed
Further fixes for compilation on Mac OSX.
1 parent 43ba1c4 commit 2214c89

File tree

2 files changed

+52
-18
lines changed

2 files changed

+52
-18
lines changed

bin/cs_compile.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,15 @@ def get_flags(self, flag):
265265

266266
#---------------------------------------------------------------------------
267267

268+
def get_ar_lib_dir(self):
269+
"""
270+
Determine directory containing library in archive mode.
271+
"""
272+
273+
return self.pkg.get_dir('libdir')
274+
275+
#---------------------------------------------------------------------------
276+
268277
def so_dirs_path(self, flags):
269278
"""
270279
Assemble path for shared libraries in nonstandard directories.
@@ -466,7 +475,7 @@ def link_obj(self, exec_name, obj_files=None, opt_libs=None,
466475
temp_dir = tempfile.mkdtemp(suffix=".cs_link")
467476
os.chdir(temp_dir)
468477

469-
lib0 = os.path.join(pkg.get_dir('libdir'),
478+
lib0 = os.path.join(self.get_ar_lib_dir(),
470479
'lib' + p_libs[0][2:] + '.a')
471480
p_libs = p_libs[1:]
472481
cmd = ['ar', 'x', lib0]

build-aux/cs_compile_build.py

Lines changed: 42 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,20 @@ def __init__(self,
119119
cs_compile.__init__(self, package)
120120
self.srcdir = srcdir
121121

122+
top_builddir = os.getcwd()
123+
while not os.path.isfile(os.path.join(top_builddir, "cs_config.h")):
124+
ds = os.path.split(top_builddir)
125+
if ds[1]:
126+
top_builddir = ds[0]
127+
else:
128+
break
129+
130+
if not os.path.isdir(os.path.join(top_builddir, "src")):
131+
raise Exception("top build directory not detected from: " \
132+
+ os.getcwd())
133+
134+
self.top_builddir = top_builddir
135+
122136
#---------------------------------------------------------------------------
123137

124138
def get_compiler(self, compiler):
@@ -143,17 +157,7 @@ def get_pkg_path_flags(self, flag):
143157

144158
flags = []
145159

146-
top_builddir = os.getcwd()
147-
while not os.path.isfile(os.path.join(top_builddir, "cs_config.h")):
148-
ds = os.path.split(top_builddir)
149-
if ds[1]:
150-
top_builddir = ds[0]
151-
else:
152-
break
153-
154-
if not os.path.isdir(os.path.join(top_builddir, "src")):
155-
raise Exception("top build directory not detected from: " \
156-
+ os.getcwd())
160+
top_builddir = self.top_builddir
157161

158162
# Add CPPFLAGS and LDFLAGS information for the current package
159163
if flag == 'cppflags':
@@ -184,6 +188,15 @@ def get_pkg_path_flags(self, flag):
184188

185189
return flags
186190

191+
#---------------------------------------------------------------------------
192+
193+
def get_ar_lib_dir(self):
194+
"""
195+
Determine directory containing library in archive mode.
196+
"""
197+
198+
return os.path.join(self.top_builddir, "src", "apps", ".libs")
199+
187200
#===============================================================================
188201
# Class used to manage install
189202
#===============================================================================
@@ -256,16 +269,13 @@ def flags_relocation(self, flag, cmd_line):
256269
#---------------------------------------------------------------------------
257270

258271
def get_flags(self, flag):
259-
260-
if flag == 'libs':
261-
return cs_compile.get_flags(self, flag)
262-
263-
cmd_line = []
264-
265272
"""
266273
Determine compilation flags for a given flag type.
267274
"""
268275

276+
if flag == 'libs':
277+
return cs_compile.get_flags(self, flag)
278+
269279
cmd_line = self.get_pkg_path_flags(flag)
270280

271281
# Build the command line, and split possible multiple arguments in lists.
@@ -290,6 +300,21 @@ def get_flags(self, flag):
290300

291301
return cmd_line
292302

303+
#---------------------------------------------------------------------------
304+
305+
def get_lib_dir(self):
306+
"""
307+
Determine directory containing library.
308+
"""
309+
310+
cmd_line = self.get_pkg_path_flags(flag)
311+
312+
# Build the command line, and split possible multiple arguments in lists.
313+
for lib in pkg.config.deplibs:
314+
if (pkg.config.libs[lib].have == "yes" \
315+
and (not pkg.config.libs[lib].dynamic_load)):
316+
cmd_line += separate_args(pkg.config.libs[lib].flags[flag])
317+
293318
#===============================================================================
294319
# Functions
295320
#===============================================================================

0 commit comments

Comments
 (0)