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
69a9c2be
Commit
69a9c2be
authored
Jan 30, 2020
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winegcc: Also search the include and lib dirs relative to the binary path.
Suggested by Kevin Puetz. Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
90a543d3
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
48 additions
and
9 deletions
+48
-9
Makefile.in
tools/winegcc/Makefile.in
+2
-1
winegcc.c
tools/winegcc/winegcc.c
+46
-8
No files found.
tools/winegcc/Makefile.in
View file @
69a9c2be
...
@@ -10,8 +10,9 @@ C_SRCS = \
...
@@ -10,8 +10,9 @@ C_SRCS = \
winegcc_EXTRADEFS
=
\
winegcc_EXTRADEFS
=
\
-DINCLUDEDIR
=
"
\"
${
includedir
}
\"
"
\
-DINCLUDEDIR
=
"
\"
${
includedir
}
\"
"
\
-DDLLDIR
=
"
\"
${
dlldir
}
\"
"
\
-DLIBDIR
=
"
\"
${
libdir
}
\"
"
\
-DLIBDIR
=
"
\"
${
libdir
}
\"
"
\
-DBIN_TO_INCLUDEDIR
=
\"
`
$(MAKEDEP)
-R
${
bindir
}
${
includedir
}
`
\"
\
-DBIN_TO_LIBDIR
=
\"
`
$(MAKEDEP)
-R
${
bindir
}
${
libdir
}
`
\"
\
-DCC
=
"
\"
$(CC)
\"
"
\
-DCC
=
"
\"
$(CC)
\"
"
\
-DCPP
=
"
\"
$(CPPBIN)
\"
"
\
-DCPP
=
"
\"
$(CPPBIN)
\"
"
\
-DCXX
=
"
\"
$(CXX)
\"
"
\
-DCXX
=
"
\"
$(CXX)
\"
"
\
...
...
tools/winegcc/winegcc.c
View file @
69a9c2be
...
@@ -145,6 +145,10 @@ static strarray* tmp_files;
...
@@ -145,6 +145,10 @@ static strarray* tmp_files;
static
sigset_t
signal_mask
;
static
sigset_t
signal_mask
;
#endif
#endif
static
const
char
*
bindir
;
static
const
char
*
libdir
;
static
const
char
*
includedir
;
enum
processor
{
proc_cc
,
proc_cxx
,
proc_cpp
,
proc_as
};
enum
processor
{
proc_cc
,
proc_cxx
,
proc_cpp
,
proc_as
};
static
const
struct
static
const
struct
...
@@ -532,7 +536,7 @@ static const char *get_multiarch_dir( enum target_cpu cpu )
...
@@ -532,7 +536,7 @@ static const char *get_multiarch_dir( enum target_cpu cpu )
static
char
*
get_lib_dir
(
struct
options
*
opts
)
static
char
*
get_lib_dir
(
struct
options
*
opts
)
{
{
static
const
char
*
stdlibpath
[]
=
{
LIBDIR
,
"/usr/lib"
,
"/usr/local/lib"
,
"/lib"
};
const
char
*
stdlibpath
[]
=
{
libdir
,
LIBDIR
,
"/usr/lib"
,
"/usr/local/lib"
,
"/lib"
};
static
const
char
libwine
[]
=
"/libwine.so"
;
static
const
char
libwine
[]
=
"/libwine.so"
;
const
char
*
bit_suffix
,
*
other_bit_suffix
,
*
build_multiarch
,
*
target_multiarch
;
const
char
*
bit_suffix
,
*
other_bit_suffix
,
*
build_multiarch
,
*
target_multiarch
;
const
char
*
root
=
opts
->
sysroot
?
opts
->
sysroot
:
""
;
const
char
*
root
=
opts
->
sysroot
?
opts
->
sysroot
:
""
;
...
@@ -548,8 +552,12 @@ static char *get_lib_dir( struct options *opts )
...
@@ -548,8 +552,12 @@ static char *get_lib_dir( struct options *opts )
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
stdlibpath
);
i
++
)
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
stdlibpath
);
i
++
)
{
{
char
*
p
,
*
buffer
=
xmalloc
(
strlen
(
root
)
+
strlen
(
stdlibpath
[
i
])
+
const
char
*
root
=
(
i
&&
opts
->
sysroot
)
?
opts
->
sysroot
:
""
;
strlen
(
"/arm-linux-gnueabi"
)
+
strlen
(
libwine
)
+
1
);
char
*
p
,
*
buffer
;
if
(
!
stdlibpath
[
i
])
continue
;
buffer
=
xmalloc
(
strlen
(
root
)
+
strlen
(
stdlibpath
[
i
])
+
strlen
(
"/arm-linux-gnueabi"
)
+
strlen
(
libwine
)
+
1
);
strcpy
(
buffer
,
root
);
strcpy
(
buffer
,
root
);
strcat
(
buffer
,
stdlibpath
[
i
]
);
strcat
(
buffer
,
stdlibpath
[
i
]
);
p
=
buffer
+
strlen
(
buffer
);
p
=
buffer
+
strlen
(
buffer
);
...
@@ -621,6 +629,28 @@ static char *get_lib_dir( struct options *opts )
...
@@ -621,6 +629,28 @@ static char *get_lib_dir( struct options *opts )
return
strmake
(
"%s%s"
,
root
,
LIBDIR
);
return
strmake
(
"%s%s"
,
root
,
LIBDIR
);
}
}
static
void
init_argv0_dir
(
const
char
*
argv0
)
{
#ifndef _WIN32
char
*
p
,
*
dir
;
#if defined(__linux__) || defined(__FreeBSD_kernel__) || defined(__NetBSD__)
dir
=
realpath
(
"/proc/self/exe"
,
NULL
);
#elif defined (__FreeBSD__) || defined(__DragonFly__)
dir
=
realpath
(
"/proc/curproc/file"
,
NULL
);
#else
dir
=
realpath
(
argv0
,
NULL
);
#endif
if
(
!
dir
)
return
;
if
(
!
(
p
=
strrchr
(
dir
,
'/'
)))
return
;
if
(
p
==
dir
)
p
++
;
*
p
=
0
;
bindir
=
dir
;
includedir
=
strmake
(
"%s/%s"
,
dir
,
BIN_TO_INCLUDEDIR
);
libdir
=
strmake
(
"%s/%s"
,
dir
,
BIN_TO_LIBDIR
);
#endif
}
static
void
compile
(
struct
options
*
opts
,
const
char
*
lang
)
static
void
compile
(
struct
options
*
opts
,
const
char
*
lang
)
{
{
strarray
*
comp_args
=
strarray_alloc
();
strarray
*
comp_args
=
strarray_alloc
();
...
@@ -772,23 +802,28 @@ no_compat_defines:
...
@@ -772,23 +802,28 @@ no_compat_defines:
{
{
const
char
*
incl_dirs
[]
=
{
INCLUDEDIR
,
"/usr/include"
,
"/usr/local/include"
};
const
char
*
incl_dirs
[]
=
{
INCLUDEDIR
,
"/usr/include"
,
"/usr/local/include"
};
const
char
*
root
=
opts
->
isysroot
?
opts
->
isysroot
:
opts
->
sysroot
?
opts
->
sysroot
:
""
;
const
char
*
root
=
opts
->
isysroot
?
opts
->
isysroot
:
opts
->
sysroot
?
opts
->
sysroot
:
""
;
const
char
*
isystem
=
gcc_defs
?
"-isystem"
:
"-I"
;
if
(
opts
->
use_msvcrt
)
if
(
opts
->
use_msvcrt
)
{
{
if
(
includedir
)
strarray_add
(
comp_args
,
strmake
(
"%s%s/wine/msvcrt"
,
isystem
,
includedir
));
for
(
j
=
0
;
j
<
ARRAY_SIZE
(
incl_dirs
);
j
++
)
for
(
j
=
0
;
j
<
ARRAY_SIZE
(
incl_dirs
);
j
++
)
{
{
if
(
j
&&
!
strcmp
(
incl_dirs
[
0
],
incl_dirs
[
j
]
))
continue
;
if
(
j
&&
!
strcmp
(
incl_dirs
[
0
],
incl_dirs
[
j
]
))
continue
;
strarray_add
(
comp_args
,
strmake
(
"%s%s%s/wine/msvcrt"
,
strarray_add
(
comp_args
,
strmake
(
"%s%s%s/wine/msvcrt"
,
isystem
,
root
,
incl_dirs
[
j
]
));
gcc_defs
?
"-isystem"
:
"-I"
,
root
,
incl_dirs
[
j
]
));
}
}
strarray_add
(
comp_args
,
"-D__MSVCRT__"
);
strarray_add
(
comp_args
,
"-D__MSVCRT__"
);
}
}
if
(
includedir
)
{
strarray_add
(
comp_args
,
strmake
(
"-I%s"
,
includedir
));
strarray_add
(
comp_args
,
strmake
(
"%s%s/wine/windows"
,
isystem
,
includedir
));
}
for
(
j
=
0
;
j
<
ARRAY_SIZE
(
incl_dirs
);
j
++
)
for
(
j
=
0
;
j
<
ARRAY_SIZE
(
incl_dirs
);
j
++
)
{
{
if
(
j
&&
!
strcmp
(
incl_dirs
[
0
],
incl_dirs
[
j
]
))
continue
;
if
(
j
&&
!
strcmp
(
incl_dirs
[
0
],
incl_dirs
[
j
]
))
continue
;
strarray_add
(
comp_args
,
strmake
(
"-I%s%s"
,
root
,
incl_dirs
[
j
]
));
strarray_add
(
comp_args
,
strmake
(
"-I%s%s"
,
root
,
incl_dirs
[
j
]
));
strarray_add
(
comp_args
,
strmake
(
"%s%s%s/wine/windows"
,
strarray_add
(
comp_args
,
strmake
(
"%s%s%s/wine/windows"
,
isystem
,
root
,
incl_dirs
[
j
]
));
gcc_defs
?
"-isystem"
:
"-I"
,
root
,
incl_dirs
[
j
]
));
}
}
}
}
else
if
(
opts
->
wine_objdir
)
else
if
(
opts
->
wine_objdir
)
...
@@ -830,6 +865,8 @@ static strarray *get_winebuild_args(struct options *opts)
...
@@ -830,6 +865,8 @@ static strarray *get_winebuild_args(struct options *opts)
binary
=
opts
->
winebuild
;
binary
=
opts
->
winebuild
;
else
if
(
opts
->
wine_objdir
)
else
if
(
opts
->
wine_objdir
)
binary
=
strmake
(
"%s/tools/winebuild/winebuild%s"
,
opts
->
wine_objdir
,
EXEEXT
);
binary
=
strmake
(
"%s/tools/winebuild/winebuild%s"
,
opts
->
wine_objdir
,
EXEEXT
);
else
if
(
bindir
)
binary
=
strmake
(
"%s/winebuild%s"
,
bindir
,
EXEEXT
);
else
else
binary
=
find_binary
(
opts
->
prefix
,
winebuild
?
winebuild
:
"winebuild"
);
binary
=
find_binary
(
opts
->
prefix
,
winebuild
?
winebuild
:
"winebuild"
);
strarray_add
(
spec_args
,
binary
);
strarray_add
(
spec_args
,
binary
);
...
@@ -1427,11 +1464,12 @@ int main(int argc, char **argv)
...
@@ -1427,11 +1464,12 @@ int main(int argc, char **argv)
sigaddset
(
&
signal_mask
,
SIGTERM
);
sigaddset
(
&
signal_mask
,
SIGTERM
);
sigaddset
(
&
signal_mask
,
SIGINT
);
sigaddset
(
&
signal_mask
,
SIGINT
);
#endif
#endif
init_argv0_dir
(
argv
[
0
]
);
/* setup tmp file removal at exit */
/* setup tmp file removal at exit */
tmp_files
=
strarray_alloc
();
tmp_files
=
strarray_alloc
();
atexit
(
clean_temp_files
);
atexit
(
clean_temp_files
);
/* initialize options */
/* initialize options */
memset
(
&
opts
,
0
,
sizeof
(
opts
));
memset
(
&
opts
,
0
,
sizeof
(
opts
));
opts
.
target_cpu
=
build_cpu
;
opts
.
target_cpu
=
build_cpu
;
...
...
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