Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
81b1c3ed
Commit
81b1c3ed
authored
Oct 25, 2010
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winegcc: Detect the appropriate lib directory for 32/64 cross-builds.
parent
78e4a096
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
57 additions
and
3 deletions
+57
-3
winegcc.c
tools/winegcc/winegcc.c
+57
-3
No files found.
tools/winegcc/winegcc.c
View file @
81b1c3ed
...
...
@@ -312,6 +312,60 @@ static const strarray* get_translator(struct options *opts)
return
ret
;
}
/* check that file is a library for the correct platform */
static
int
check_platform
(
struct
options
*
opts
,
const
char
*
file
)
{
int
ret
=
0
,
fd
=
open
(
file
,
O_RDONLY
);
if
(
fd
!=
-
1
)
{
unsigned
char
header
[
16
];
if
(
read
(
fd
,
header
,
sizeof
(
header
)
)
==
sizeof
(
header
))
{
/* FIXME: only ELF is supported, platform is not checked beyond 32/64 */
if
(
!
memcmp
(
header
,
"
\177
ELF"
,
4
))
{
if
(
header
[
4
]
==
2
)
/* 64-bit */
ret
=
(
opts
->
force_pointer_size
==
8
||
(
!
opts
->
force_pointer_size
&&
opts
->
target_cpu
==
CPU_x86_64
));
else
ret
=
(
opts
->
force_pointer_size
==
4
||
(
!
opts
->
force_pointer_size
&&
opts
->
target_cpu
!=
CPU_x86_64
));
}
}
close
(
fd
);
}
return
ret
;
}
static
char
*
get_lib_dir
(
struct
options
*
opts
)
{
static
const
char
*
stdlibpath
[]
=
{
LIBDIR
,
"/usr/lib"
,
"/usr/local/lib"
,
"/lib"
};
unsigned
int
i
;
for
(
i
=
0
;
i
<
sizeof
(
stdlibpath
)
/
sizeof
(
stdlibpath
[
0
]);
i
++
)
{
char
*
p
,
*
buffer
=
xmalloc
(
strlen
(
stdlibpath
[
i
])
+
sizeof
(
"32/libwine.so"
)
);
strcpy
(
buffer
,
stdlibpath
[
i
]
);
p
=
buffer
+
strlen
(
buffer
);
while
(
p
>
buffer
&&
p
[
-
1
]
==
'/'
)
p
--
;
strcpy
(
p
,
"/libwine.so"
);
if
(
check_platform
(
opts
,
buffer
))
return
buffer
;
if
(
p
>
buffer
+
2
&&
(
!
memcmp
(
p
-
2
,
"32"
,
2
)
||
!
memcmp
(
p
-
2
,
"64"
,
2
)))
p
-=
2
;
if
(
opts
->
force_pointer_size
==
4
||
(
!
opts
->
force_pointer_size
&&
opts
->
target_cpu
!=
CPU_x86_64
))
{
strcpy
(
p
,
"32/libwine.so"
);
if
(
check_platform
(
opts
,
buffer
))
return
buffer
;
}
if
(
opts
->
force_pointer_size
==
8
||
(
!
opts
->
force_pointer_size
&&
opts
->
target_cpu
==
CPU_x86_64
))
{
strcpy
(
p
,
"64/libwine.so"
);
if
(
check_platform
(
opts
,
buffer
))
return
buffer
;
}
free
(
buffer
);
}
return
xstrdup
(
LIBDIR
);
}
static
void
compile
(
struct
options
*
opts
,
const
char
*
lang
)
{
strarray
*
comp_args
=
strarray_alloc
();
...
...
@@ -578,7 +632,6 @@ static const char *mingw_unicode_hack( struct options *opts )
static
void
build
(
struct
options
*
opts
)
{
static
const
char
*
stdlibpath
[]
=
{
DLLDIR
,
LIBDIR
,
"/usr/lib"
,
"/usr/local/lib"
,
"/lib"
};
strarray
*
lib_dirs
,
*
files
;
strarray
*
spec_args
,
*
link_args
;
char
*
output_file
;
...
...
@@ -628,9 +681,10 @@ static void build(struct options* opts)
/* prepare the linking path */
if
(
!
opts
->
wine_objdir
)
{
char
*
lib_dir
=
get_lib_dir
(
opts
);
lib_dirs
=
strarray_dup
(
opts
->
lib_dirs
);
for
(
j
=
0
;
j
<
sizeof
(
stdlibpath
)
/
sizeof
(
stdlibpath
[
0
]);
j
++
)
strarray_add
(
lib_dirs
,
stdlibpath
[
j
]
);
strarray_add
(
lib_dirs
,
strmake
(
"%s/wine"
,
lib_dir
));
strarray_add
(
lib_dirs
,
lib_dir
);
}
else
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment