Commit ada5e652 authored by Alexandre Julliard's avatar Alexandre Julliard

Implemented import libraries; on Unix we import the .def file

directly, on Mingw we use it to build the .a library.
parent b42dc56f
...@@ -34,8 +34,10 @@ EXEEXT = @EXEEXT@ ...@@ -34,8 +34,10 @@ EXEEXT = @EXEEXT@
OBJEXT = @OBJEXT@ OBJEXT = @OBJEXT@
LIBEXT = @LIBEXT@ LIBEXT = @LIBEXT@
DLLEXT = @DLLEXT@ DLLEXT = @DLLEXT@
IMPLIBEXT = @IMPLIBEXT@
CROSSCC = @CROSSCC@ CROSSCC = @CROSSCC@
LDSHARED = @LDSHARED@ LDSHARED = @LDSHARED@
DLLTOOL = @DLLTOOL@
DLLWRAP = @DLLWRAP@ DLLWRAP = @DLLWRAP@
DLLWRAPFLAGS = --add-stdcall-alias DLLWRAPFLAGS = --add-stdcall-alias
AR = @AR@ rc AR = @AR@ rc
...@@ -240,7 +242,8 @@ install:: $(INSTALLSUBDIRS:%=%/__install__) ...@@ -240,7 +242,8 @@ install:: $(INSTALLSUBDIRS:%=%/__install__)
uninstall:: $(INSTALLSUBDIRS:%=%/__uninstall__) uninstall:: $(INSTALLSUBDIRS:%=%/__uninstall__)
.PHONY: install uninstall $(INSTALLSUBDIRS:%=%/__install__) $(INSTALLSUBDIRS:%=%/__uninstall__) .PHONY: install install-lib install-dev uninstall \
$(INSTALLSUBDIRS:%=%/__install__) $(INSTALLSUBDIRS:%=%/__uninstall__)
# Rules for checking that no imports are missing # Rules for checking that no imports are missing
......
...@@ -40,7 +40,6 @@ SUBDIRS = \ ...@@ -40,7 +40,6 @@ SUBDIRS = \
# Sub-directories to install for install-lib # Sub-directories to install for install-lib
INSTALLLIBSUBDIRS = \ INSTALLLIBSUBDIRS = \
dlls \
documentation \ documentation \
library \ library \
miscemu \ miscemu \
...@@ -54,6 +53,9 @@ INSTALLDEVSUBDIRS = \ ...@@ -54,6 +53,9 @@ INSTALLDEVSUBDIRS = \
ole \ ole \
tools tools
# Sub-directories to install for both install-lib and install-dev
INSTALLBOTHSUBDIRS = dlls
INSTALLSUBDIRS = $(INSTALLDEVSUBDIRS) $(INSTALLLIBSUBDIRS) INSTALLSUBDIRS = $(INSTALLDEVSUBDIRS) $(INSTALLLIBSUBDIRS)
# Sub-directories to run make test into # Sub-directories to run make test into
...@@ -81,11 +83,11 @@ install-aclocal: dummy ...@@ -81,11 +83,11 @@ install-aclocal: dummy
$(MKINSTALLDIRS) $(datadir)/aclocal $(MKINSTALLDIRS) $(datadir)/aclocal
$(INSTALL_DATA) $(SRCDIR)/aclocal.m4 $(datadir)/aclocal/wine.m4 $(INSTALL_DATA) $(SRCDIR)/aclocal.m4 $(datadir)/aclocal/wine.m4
install-lib:: $(INSTALLLIBSUBDIRS:%=%/__install__) install-lib:: $(INSTALLLIBSUBDIRS:%=%/__install__) $(INSTALLBOTHSUBDIRS:%=%/__install-lib__)
install-dev:: $(INSTALLDEVSUBDIRS:%=%/__install__) install-aclocal install-dev:: $(INSTALLDEVSUBDIRS:%=%/__install__) $(INSTALLBOTHSUBDIRS:%=%/__install-dev__) install-aclocal
install:: install-aclocal install:: install-lib install-dev install-aclocal
-$(LDCONFIG) -$(LDCONFIG)
@if test -n "`LANG=C $(LDD) $(bindir)/wine|grep not.found`"; \ @if test -n "`LANG=C $(LDD) $(bindir)/wine|grep not.found`"; \
then \ then \
...@@ -99,11 +101,20 @@ install:: install-aclocal ...@@ -99,11 +101,20 @@ install:: install-aclocal
echo "*************************************************" ; \ echo "*************************************************" ; \
fi fi
uninstall:: uninstall:: $(INSTALLBOTHSUBDIRS:%=%/__uninstall__)
$(RM) $(datadir)/aclocal/wine.m4 $(RM) $(datadir)/aclocal/wine.m4
-rmdir $(datadir)/aclocal -rmdir $(datadir)/aclocal
.PHONY: install-aclocal install-lib install-dev $(INSTALLBOTHSUBDIRS:%=%/__install-lib__): dummy
cd `dirname $@` && $(MAKE) install-lib
$(INSTALLBOTHSUBDIRS:%=%/__install-dev__): dummy
cd `dirname $@` && $(MAKE) install-dev
$(INSTALLBOTHSUBDIRS:%=%/__uninstall__): dummy
cd `dirname $@` && $(MAKE) uninstall
.PHONY: install-aclocal $(INSTALLBOTHSUBDIRS:%=%/__install-lib__) $(INSTALLBOTHSUBDIRS:%=%/__install-dev__) $(INSTALLBOTHSUBDIRS:%=%/__uninstall__)
# Dependencies between directories # Dependencies between directories
...@@ -113,9 +124,9 @@ server: library tools unicode ...@@ -113,9 +124,9 @@ server: library tools unicode
miscemu programs: dlls library ole tools unicode miscemu programs: dlls library ole tools unicode
tools: library unicode tools: library unicode
dlls/__install__: library ole tools unicode dlls/__install-lib__ dlls/__install-dev__: library ole tools unicode
server/__install__: library tools unicode server/__install__: library tools unicode
miscemu/__install__ programs/__install__: library ole tools unicode dlls/__install__ miscemu/__install__ programs/__install__: library ole tools unicode dlls/__install-lib__
library/__install__: library library/__install__: library
ole/__install__: ole ole/__install__: ole
tools/__install__: tools tools/__install__: tools
......
...@@ -305,7 +305,7 @@ ac_includes_default="\ ...@@ -305,7 +305,7 @@ ac_includes_default="\
# include <unistd.h> # include <unistd.h>
#endif" #endif"
ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS LIBEXT OPTIONS WIN16_FILES WIN16_INSTALL build build_cpu build_vendor build_os host host_cpu host_vendor host_os SET_MAKE CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CPP TOOLSDIR X_CFLAGS X_PRE_LIBS X_LIBS X_EXTRA_LIBS YACC LEX LEXLIB LEX_OUTPUT_ROOT XYACC XLEX LD ac_ct_LD AR ac_ct_AR RANLIB ac_ct_RANLIB STRIP ac_ct_STRIP WINDRES ac_ct_WINDRES INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA LN_S LN C2MAN LDCONFIG LINT LINTFLAGS DB2HTML DB2PDF DB2PS JPEGLIB EGREP XLIB XFILES OPENGLFILES GLU32FILES OPENGL_LIBS NASLIBS CURSESLIBS sane_devel SANELIBS SANEINCL ft_devel ft_devel2 FREETYPEINCL ARTSCCONFIG ARTSLIBS ARTSINCL ALSALIBS AUDIOIOLIBS DLLEXT DLLFLAGS DLLIBS LDDLLFLAGS LDSHARED DLLWRAP ac_ct_DLLWRAP CROSSTEST CROSSCC DLLTOOL LDPATH CRTLIBS LDD ALLOCA LIBOBJS LTLIBOBJS' ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS OPTIONS WIN16_FILES WIN16_INSTALL build build_cpu build_vendor build_os host host_cpu host_vendor host_os SET_MAKE CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CPP TOOLSDIR X_CFLAGS X_PRE_LIBS X_LIBS X_EXTRA_LIBS YACC LEX LEXLIB LEX_OUTPUT_ROOT XYACC XLEX LD ac_ct_LD AR ac_ct_AR RANLIB ac_ct_RANLIB STRIP ac_ct_STRIP WINDRES ac_ct_WINDRES INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA LN_S LN C2MAN LDCONFIG LINT LINTFLAGS DB2HTML DB2PDF DB2PS JPEGLIB EGREP XLIB XFILES OPENGLFILES GLU32FILES OPENGL_LIBS NASLIBS CURSESLIBS sane_devel SANELIBS SANEINCL ft_devel ft_devel2 FREETYPEINCL ARTSCCONFIG ARTSLIBS ARTSINCL ALSALIBS AUDIOIOLIBS DLLEXT DLLFLAGS DLLIBS LDDLLFLAGS LDSHARED LIBEXT IMPLIBEXT DLLTOOL ac_ct_DLLTOOL DLLWRAP ac_ct_DLLWRAP CROSSTEST CROSSCC LDPATH CRTLIBS LDD ALLOCA LIBOBJS LTLIBOBJS'
ac_subst_files='MAKE_RULES MAKE_DLL_RULES MAKE_TEST_RULES MAKE_PROG_RULES' ac_subst_files='MAKE_RULES MAKE_DLL_RULES MAKE_TEST_RULES MAKE_PROG_RULES'
# Initialize some variables set by options. # Initialize some variables set by options.
...@@ -1283,9 +1283,6 @@ ac_configure="$SHELL $ac_aux_dir/configure" # This should be Cygnus configure. ...@@ -1283,9 +1283,6 @@ ac_configure="$SHELL $ac_aux_dir/configure" # This should be Cygnus configure.
LIBEXT="so"
# Check whether --enable-win16 or --disable-win16 was given. # Check whether --enable-win16 or --disable-win16 was given.
if test "${enable_win16+set}" = set; then if test "${enable_win16+set}" = set; then
enableval="$enable_win16" enableval="$enable_win16"
...@@ -9883,10 +9880,94 @@ LDDLLFLAGS="" ...@@ -9883,10 +9880,94 @@ LDDLLFLAGS=""
LDSHARED="" LDSHARED=""
LIBEXT="so"
IMPLIBEXT="def"
case $host_os in case $host_os in
cygwin*|mingw32*) cygwin*|mingw32*)
if test -n "$ac_tool_prefix"; then if test -n "$ac_tool_prefix"; then
# Extract the first word of "${ac_tool_prefix}dlltool", so it can be a program name with args.
set dummy ${ac_tool_prefix}dlltool; ac_word=$2
echo "$as_me:$LINENO: checking for $ac_word" >&5
echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
if test "${ac_cv_prog_DLLTOOL+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
if test -n "$DLLTOOL"; then
ac_cv_prog_DLLTOOL="$DLLTOOL" # Let the user override the test.
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_DLLTOOL="${ac_tool_prefix}dlltool"
echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
fi
fi
DLLTOOL=$ac_cv_prog_DLLTOOL
if test -n "$DLLTOOL"; then
echo "$as_me:$LINENO: result: $DLLTOOL" >&5
echo "${ECHO_T}$DLLTOOL" >&6
else
echo "$as_me:$LINENO: result: no" >&5
echo "${ECHO_T}no" >&6
fi
fi
if test -z "$ac_cv_prog_DLLTOOL"; then
ac_ct_DLLTOOL=$DLLTOOL
# Extract the first word of "dlltool", so it can be a program name with args.
set dummy dlltool; ac_word=$2
echo "$as_me:$LINENO: checking for $ac_word" >&5
echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
if test "${ac_cv_prog_ac_ct_DLLTOOL+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
if test -n "$ac_ct_DLLTOOL"; then
ac_cv_prog_ac_ct_DLLTOOL="$ac_ct_DLLTOOL" # Let the user override the test.
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_ac_ct_DLLTOOL="dlltool"
echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
test -z "$ac_cv_prog_ac_ct_DLLTOOL" && ac_cv_prog_ac_ct_DLLTOOL="false"
fi
fi
ac_ct_DLLTOOL=$ac_cv_prog_ac_ct_DLLTOOL
if test -n "$ac_ct_DLLTOOL"; then
echo "$as_me:$LINENO: result: $ac_ct_DLLTOOL" >&5
echo "${ECHO_T}$ac_ct_DLLTOOL" >&6
else
echo "$as_me:$LINENO: result: no" >&5
echo "${ECHO_T}no" >&6
fi
DLLTOOL=$ac_ct_DLLTOOL
else
DLLTOOL="$ac_cv_prog_DLLTOOL"
fi
if test -n "$ac_tool_prefix"; then
# Extract the first word of "${ac_tool_prefix}dllwrap", so it can be a program name with args. # Extract the first word of "${ac_tool_prefix}dllwrap", so it can be a program name with args.
set dummy ${ac_tool_prefix}dllwrap; ac_word=$2 set dummy ${ac_tool_prefix}dllwrap; ac_word=$2
echo "$as_me:$LINENO: checking for $ac_word" >&5 echo "$as_me:$LINENO: checking for $ac_word" >&5
...@@ -9971,6 +10052,7 @@ fi ...@@ -9971,6 +10052,7 @@ fi
else else
LIBEXT="dll" LIBEXT="dll"
fi fi
IMPLIBEXT="a"
;; ;;
*) *)
...@@ -14554,7 +14636,6 @@ s,@ECHO_C@,$ECHO_C,;t t ...@@ -14554,7 +14636,6 @@ s,@ECHO_C@,$ECHO_C,;t t
s,@ECHO_N@,$ECHO_N,;t t s,@ECHO_N@,$ECHO_N,;t t
s,@ECHO_T@,$ECHO_T,;t t s,@ECHO_T@,$ECHO_T,;t t
s,@LIBS@,$LIBS,;t t s,@LIBS@,$LIBS,;t t
s,@LIBEXT@,$LIBEXT,;t t
s,@OPTIONS@,$OPTIONS,;t t s,@OPTIONS@,$OPTIONS,;t t
s,@WIN16_FILES@,$WIN16_FILES,;t t s,@WIN16_FILES@,$WIN16_FILES,;t t
s,@WIN16_INSTALL@,$WIN16_INSTALL,;t t s,@WIN16_INSTALL@,$WIN16_INSTALL,;t t
...@@ -14633,11 +14714,14 @@ s,@DLLFLAGS@,$DLLFLAGS,;t t ...@@ -14633,11 +14714,14 @@ s,@DLLFLAGS@,$DLLFLAGS,;t t
s,@DLLIBS@,$DLLIBS,;t t s,@DLLIBS@,$DLLIBS,;t t
s,@LDDLLFLAGS@,$LDDLLFLAGS,;t t s,@LDDLLFLAGS@,$LDDLLFLAGS,;t t
s,@LDSHARED@,$LDSHARED,;t t s,@LDSHARED@,$LDSHARED,;t t
s,@LIBEXT@,$LIBEXT,;t t
s,@IMPLIBEXT@,$IMPLIBEXT,;t t
s,@DLLTOOL@,$DLLTOOL,;t t
s,@ac_ct_DLLTOOL@,$ac_ct_DLLTOOL,;t t
s,@DLLWRAP@,$DLLWRAP,;t t s,@DLLWRAP@,$DLLWRAP,;t t
s,@ac_ct_DLLWRAP@,$ac_ct_DLLWRAP,;t t s,@ac_ct_DLLWRAP@,$ac_ct_DLLWRAP,;t t
s,@CROSSTEST@,$CROSSTEST,;t t s,@CROSSTEST@,$CROSSTEST,;t t
s,@CROSSCC@,$CROSSCC,;t t s,@CROSSCC@,$CROSSCC,;t t
s,@DLLTOOL@,$DLLTOOL,;t t
s,@LDPATH@,$LDPATH,;t t s,@LDPATH@,$LDPATH,;t t
s,@CRTLIBS@,$CRTLIBS,;t t s,@CRTLIBS@,$CRTLIBS,;t t
s,@LDD@,$LDD,;t t s,@LDD@,$LDD,;t t
......
...@@ -12,9 +12,6 @@ AC_CONFIG_AUX_DIR(tools) ...@@ -12,9 +12,6 @@ AC_CONFIG_AUX_DIR(tools)
dnl **** Command-line arguments **** dnl **** Command-line arguments ****
dnl Library type .so or .a
AC_SUBST(LIBEXT,"so")
AC_ARG_ENABLE(win16, AC_HELP_STRING([--disable-win16],[do not include Win16 support])) AC_ARG_ENABLE(win16, AC_HELP_STRING([--disable-win16],[do not include Win16 support]))
AC_ARG_ENABLE(debug, AC_HELP_STRING([--disable-debug],[compile out all debugging messages])) AC_ARG_ENABLE(debug, AC_HELP_STRING([--disable-debug],[compile out all debugging messages]))
AC_ARG_ENABLE(trace, AC_HELP_STRING([--disable-trace],[compile out TRACE messages])) AC_ARG_ENABLE(trace, AC_HELP_STRING([--disable-trace],[compile out TRACE messages]))
...@@ -752,9 +749,12 @@ AC_SUBST(DLLFLAGS,"") ...@@ -752,9 +749,12 @@ AC_SUBST(DLLFLAGS,"")
AC_SUBST(DLLIBS,"") AC_SUBST(DLLIBS,"")
AC_SUBST(LDDLLFLAGS,"") AC_SUBST(LDDLLFLAGS,"")
AC_SUBST(LDSHARED,"") AC_SUBST(LDSHARED,"")
AC_SUBST(LIBEXT,"so")
AC_SUBST(IMPLIBEXT,"def")
case $host_os in case $host_os in
cygwin*|mingw32*) cygwin*|mingw32*)
AC_CHECK_TOOL(DLLTOOL,dlltool,false)
AC_CHECK_TOOL(DLLWRAP,dllwrap,false) AC_CHECK_TOOL(DLLWRAP,dllwrap,false)
if test "$DLLWRAP" = "false"; then if test "$DLLWRAP" = "false"; then
LIBEXT="a" LIBEXT="a"
...@@ -762,6 +762,7 @@ case $host_os in ...@@ -762,6 +762,7 @@ case $host_os in
dnl FIXME - check whether dllwrap works correctly... dnl FIXME - check whether dllwrap works correctly...
LIBEXT="dll" LIBEXT="dll"
fi fi
IMPLIBEXT="a"
;; ;;
*) *)
AC_CHECK_HEADERS(dlfcn.h, AC_CHECK_HEADERS(dlfcn.h,
......
...@@ -18,13 +18,15 @@ WIN16_FILES = $(SPEC_SRCS:.spec=.spec.o) $(C_SRCS16:.c=.o) $(EXTRA_OBJS16) ...@@ -18,13 +18,15 @@ WIN16_FILES = $(SPEC_SRCS:.spec=.spec.o) $(C_SRCS16:.c=.o) $(EXTRA_OBJS16)
ALL_OBJS = @WIN16_FILES@ $(OBJS) $(MODULE).dbg.o ALL_OBJS = @WIN16_FILES@ $(OBJS) $(MODULE).dbg.o
ALL_LIBS = $(LIBWINE) $(EXTRALIBS) $(LIBS) ALL_LIBS = $(LIBWINE) $(EXTRALIBS) $(LIBS)
all: $(MODULE)$(DLLEXT) all: $(MODULE)$(DLLEXT) $(SUBDIRS)
@MAKE_RULES@ @MAKE_RULES@
IMPORTLIBS = $(DELAYIMPORTS:%=$(DLLDIR)/lib%.$(IMPLIBEXT)) $(IMPORTS:%=$(DLLDIR)/lib%.$(IMPLIBEXT))
# Rules for .so files # Rules for .so files
$(MAINSPEC).c: $(MAINSPEC) $(RC_SRCS:.rc=.res) $(SYMBOLFILE) $(WINEBUILD) $(MAINSPEC).c: $(MAINSPEC) $(RC_SRCS:.rc=.res) $(SYMBOLFILE) $(IMPORTLIBS) $(WINEBUILD)
$(LDPATH) $(WINEBUILD) $(DEFS) -o $@ --spec $(SRCDIR)/$(MAINSPEC) $(RC_SRCS:.rc=.res) $(SYMBOLFILE) $(DLLMAIN:%=-e %) -L$(DLLDIR) $(DELAYIMPORTS:%=-d%) $(IMPORTS:%=-l%) $(LDPATH) $(WINEBUILD) $(DEFS) -o $@ --spec $(SRCDIR)/$(MAINSPEC) $(RC_SRCS:.rc=.res) $(SYMBOLFILE) $(DLLMAIN:%=-e %) -L$(DLLDIR) $(DELAYIMPORTS:%=-d%) $(IMPORTS:%=-l%)
$(MODULE).so: $(MAINSPEC).o $(ALL_OBJS) Makefile.in $(MODULE).so: $(MAINSPEC).o $(ALL_OBJS) Makefile.in
...@@ -41,8 +43,8 @@ $(MODULE).glue.c: $(C_SRCS) $(C_SRCS16) $(WINEBUILD) ...@@ -41,8 +43,8 @@ $(MODULE).glue.c: $(C_SRCS) $(C_SRCS16) $(WINEBUILD)
# Rules for .dll files # Rules for .dll files
$(MODULE): $(RCOBJS) $(OBJS) $(MODULE).dbg.o $(SPEC_DEF) Makefile.in $(MODULE): $(RCOBJS) $(OBJS) $(MODULE).dbg.o $(SPEC_DEF) $(IMPORTLIBS) Makefile.in
$(DLLWRAP) $(DLLWRAPFLAGS) --def $(SPEC_DEF) --implib lib$(MODULE:.dll=.a) -o $@ $(RCOBJS) $(OBJS) $(MODULE).dbg.o $(DLLMAIN:%=--entry %) -L$(DLLDIR) $(DELAYIMPORTS:%=-l%) $(IMPORTS:%=-l%) $(ALL_LIBS) $(DLLWRAP) -k --def $(SPEC_DEF) -o $@ $(RCOBJS) $(OBJS) $(MODULE).dbg.o $(DLLMAIN:%=--entry %) -L$(DLLDIR) $(DELAYIMPORTS:%=-l%) $(IMPORTS:%=-l%) $(ALL_LIBS)
$(SPEC_DEF): $(WINEBUILD) $(SPEC_DEF): $(WINEBUILD)
......
...@@ -3,7 +3,7 @@ TOPOBJDIR = ../.. ...@@ -3,7 +3,7 @@ TOPOBJDIR = ../..
SRCDIR = @srcdir@ SRCDIR = @srcdir@
VPATH = @srcdir@ VPATH = @srcdir@
MODULE = comdlg32.dll MODULE = comdlg32.dll
IMPORTS = shell32 shlwapi comctl32 winspool.drv user32 gdi32 kernel32 IMPORTS = shell32 shlwapi comctl32 winspool user32 gdi32 kernel32
ALTNAMES = commdlg.dll ALTNAMES = commdlg.dll
EXTRALIBS = $(LIBUUID) EXTRALIBS = $(LIBUUID)
......
...@@ -202,6 +202,48 @@ foreach my $mod (sort keys %directories) ...@@ -202,6 +202,48 @@ foreach my $mod (sort keys %directories)
################################################################ ################################################################
# output the import libraries rules
my @implibs = grep /\.dll$/, keys %directories;
push @implibs, "winspool.drv";
print NEWMAKE "\n# Import libraries\n\nIMPORT_LIBS =";
foreach my $mod (sort @implibs)
{
my $def = $mod;
$def =~ s/\.(dll|drv)$/.\$(IMPLIBEXT)/;
printf NEWMAKE " \\\n\tlib%s", $def;
}
print NEWMAKE "\n\n";
foreach my $mod (sort @implibs)
{
my $dir = $directories{$mod};
my $def = $mod;
my $spec = $mod;
$spec =~ s/\.dll$//;
$def =~ s/\.(dll|drv)$//;
printf NEWMAKE "lib%s.def: %s/%s.spec.def\n", $def, $dir, $spec;
printf NEWMAKE "\t\$(RM) \$@ && \$(LN_S) %s/%s.spec.def \$@\n", $dir, $spec;
printf NEWMAKE "lib%s.a: %s/%s.spec.def\n", $def, $dir, $spec;
printf NEWMAKE "\t\$(DLLTOOL) -k -l \$@ -d %s/%s.spec.def\n\n", $dir, $spec;
}
foreach my $mod (sort @implibs)
{
my $dir = $directories{$mod};
my $spec = $mod;
$spec =~ s/\.dll$//;
printf NEWMAKE "%s/%s.spec.def: \$(WINEBUILD)\n", $dir, $spec;
}
print NEWMAKE <<EOF;
\$(SUBDIRS): \$(IMPORT_LIBS)
EOF
################################################################
# output the inter-dll dependencies and rules # output the inter-dll dependencies and rules
print NEWMAKE "# Map library name to the corresponding directory\n\n"; print NEWMAKE "# Map library name to the corresponding directory\n\n";
...@@ -218,38 +260,6 @@ foreach my $mod (sort keys %directories) ...@@ -218,38 +260,6 @@ foreach my $mod (sort keys %directories)
printf NEWMAKE "%s/__install__: %s\$(DLLEXT)\n", $directories{$mod}, $mod; printf NEWMAKE "%s/__install__: %s\$(DLLEXT)\n", $directories{$mod}, $mod;
} }
print NEWMAKE "\n# Inter-dll dependencies\n\n";
my @depends = ();
foreach my $mod (sort keys %imports)
{
next unless @{$imports{$mod}};
my $count = 0;
my $dep = sprintf("%s:", $directories{$mod});
$dep .= " " x (8-length($directories{$mod}));
foreach my $i (@{$imports{$mod}})
{
if ($count++ >= 4)
{
$count = 1;
$dep .= " \\\n" . " " x 9;
}
$dep .= sprintf(" %s\$(DLLEXT)", $i);
}
foreach my $i (@{$linked_dlls{$mod}})
{
if ($count++ >= 4)
{
$count = 1;
$dep .= " \\\n" . " " x 9;
}
$dep .= sprintf(" lib%s.\$(LIBEXT)", $i);
}
push @depends, $dep . "\n";
}
print NEWMAKE sort @depends;
################################################################ ################################################################
# output the linkable dlls special links # output the linkable dlls special links
...@@ -268,11 +278,19 @@ foreach my $mod (keys %linkable_dlls) ...@@ -268,11 +278,19 @@ foreach my $mod (keys %linkable_dlls)
printf NEWMAKE "\t\$(RM) \$@ && \$(LN_S) %s/%s\$(DLLEXT) \$@\n\n", $directories{$mod}, $mod; printf NEWMAKE "\t\$(RM) \$@ && \$(LN_S) %s/%s\$(DLLEXT) \$@\n\n", $directories{$mod}, $mod;
} }
foreach my $mod (keys %imports)
{
my $deps = "";
foreach my $i (@{$linked_dlls{$mod}}) { $deps .= " lib$i.\$(LIBEXT)"; }
if ($deps) { printf NEWMAKE "%s:%s\n", $directories{$mod}, $deps; }
}
print NEWMAKE <<EOF; print NEWMAKE <<EOF;
uninstall:: uninstall::
\$(RM) \$(LINKABLE_DLLS:%=\$(libdir)/lib%.\$(LIBEXT)) \$(RM) \$(LINKABLE_DLLS:%=\$(libdir)/lib%.\$(LIBEXT))
install:: install install-lib::
\$(RM) \$(LINKABLE_DLLS:%=\$(libdir)/lib%.\$(LIBEXT)) \$(RM) \$(LINKABLE_DLLS:%=\$(libdir)/lib%.\$(LIBEXT))
cd \$(libdir) && if [ "\$(dlldir)" = "\$(libdir)/wine" ]; \\ cd \$(libdir) && if [ "\$(dlldir)" = "\$(libdir)/wine" ]; \\
then \\ then \\
...@@ -294,9 +312,19 @@ print NEWMAKE "\tfi\n\n"; ...@@ -294,9 +312,19 @@ print NEWMAKE "\tfi\n\n";
print NEWMAKE <<EOF; print NEWMAKE <<EOF;
# Misc rules # Misc rules
install install-dev:: \$(IMPORT_LIBS)
\$(MKINSTALLDIRS) \$(dlldir)
for f in \$(IMPORT_LIBS); do \$(INSTALL_DATA) \$\$f \$(dlldir)/\$\$f; done
install install-lib:: \$(INSTALLSUBDIRS:%=%/__install__)
uninstall:: uninstall::
\$(RM) \$(IMPORT_LIBS:%=\$(dlldir)/%)
-rmdir \$(dlldir) -rmdir \$(dlldir)
clean::
\$(RM) \$(IMPORT_LIBS)
check test:: \$(BUILDSUBDIRS:%=%/__test__) check test:: \$(BUILDSUBDIRS:%=%/__test__)
crosstest:: \$(BUILDSUBDIRS:%=%/__crosstest__) crosstest:: \$(BUILDSUBDIRS:%=%/__crosstest__)
......
...@@ -3,7 +3,7 @@ TOPOBJDIR = ../.. ...@@ -3,7 +3,7 @@ TOPOBJDIR = ../..
SRCDIR = @srcdir@ SRCDIR = @srcdir@
VPATH = @srcdir@ VPATH = @srcdir@
MODULE = wineps.dll MODULE = wineps.dll
IMPORTS = user32 gdi32 winspool.drv advapi32 kernel32 IMPORTS = user32 gdi32 winspool advapi32 kernel32
ALTNAMES = wineps16.dll ALTNAMES = wineps16.dll
EXTRAINCL = @FREETYPEINCL@ EXTRAINCL = @FREETYPEINCL@
......
...@@ -34,7 +34,7 @@ ...@@ -34,7 +34,7 @@
struct func struct func
{ {
const char *name; /* function name */ char *name; /* function name */
int ordinal; /* function ordinal */ int ordinal; /* function ordinal */
int ord_only; /* non-zero if function is imported by ordinal */ int ord_only; /* non-zero if function is imported by ordinal */
}; };
...@@ -150,7 +150,7 @@ inline static struct func *find_export( const char *name, struct func *table, in ...@@ -150,7 +150,7 @@ inline static struct func *find_export( const char *name, struct func *table, in
{ {
struct func func, *res = NULL; struct func func, *res = NULL;
func.name = name; func.name = (char *)name;
func.ordinal = -1; func.ordinal = -1;
if (table) res = bsearch( &func, table, size, sizeof(*table), func_cmp ); if (table) res = bsearch( &func, table, size, sizeof(*table), func_cmp );
return res; return res;
...@@ -163,12 +163,37 @@ inline static void sort_symbols( char **table, int size ) ...@@ -163,12 +163,37 @@ inline static void sort_symbols( char **table, int size )
qsort( table, size, sizeof(*table), name_cmp ); qsort( table, size, sizeof(*table), name_cmp );
} }
/* free an import structure */
static void free_imports( struct import *imp )
{
int i;
for (i = 0; i < imp->nb_exports; i++) free( imp->exports[i].name );
for (i = 0; i < imp->nb_imports; i++) free( imp->imports[i].name );
free( imp->exports );
free( imp->imports );
free( imp->dll );
free( imp );
}
/* remove the temp file at exit */ /* remove the temp file at exit */
static void remove_ld_tmp_file(void) static void remove_ld_tmp_file(void)
{ {
if (ld_tmp_file) unlink( ld_tmp_file ); if (ld_tmp_file) unlink( ld_tmp_file );
} }
/* check whether a given dll has already been imported */
static int is_already_imported( const char *name )
{
int i;
for (i = 0; i < nb_imports; i++)
{
if (!strcmp( dll_imports[i]->dll, name )) return 1;
}
return 0;
}
/* open the .so library for a given dll in a specified path */ /* open the .so library for a given dll in a specified path */
static char *try_library_path( const char *path, const char *name ) static char *try_library_path( const char *path, const char *name )
{ {
...@@ -176,8 +201,8 @@ static char *try_library_path( const char *path, const char *name ) ...@@ -176,8 +201,8 @@ static char *try_library_path( const char *path, const char *name )
int fd; int fd;
buffer = xmalloc( strlen(path) + strlen(name) + 9 ); buffer = xmalloc( strlen(path) + strlen(name) + 9 );
sprintf( buffer, "%s/%s", path, name ); sprintf( buffer, "%s/lib%s.def", path, name );
strcat( buffer, ".so" );
/* check if the file exists */ /* check if the file exists */
if ((fd = open( buffer, O_RDONLY )) != -1) if ((fd = open( buffer, O_RDONLY )) != -1)
{ {
...@@ -199,66 +224,124 @@ static char *open_library( const char *name ) ...@@ -199,66 +224,124 @@ static char *open_library( const char *name )
if ((fullname = try_library_path( lib_path[i], name ))) return fullname; if ((fullname = try_library_path( lib_path[i], name ))) return fullname;
} }
if (!(fullname = try_library_path( ".", name ))) if (!(fullname = try_library_path( ".", name )))
fatal_error( "could not open .so file for %s\n", name ); fatal_error( "could not open .def file for %s\n", name );
return fullname; return fullname;
} }
/* read in the list of exported symbols of a .so */ /* skip whitespace until the next token */
static void read_exported_symbols( const char *name, struct import *imp ) static char *skip_whitespace( char *p )
{
while (*p && isspace(*p)) p++;
if (!*p || *p == ';') p = NULL;
return p;
}
/* skip to the start of the next token, null terminating the current one */
static char *next_token( char *p )
{
while (*p && !isspace(*p)) p++;
if (*p) *p++ = 0;
return skip_whitespace( p );
}
/* remove the @nn suffix from stdcall names */
static char *remove_stdcall_decoration( char *buffer )
{
char *p = buffer + strlen(buffer) - 1;
while (p > buffer && isdigit(*p)) p--;
if (p > buffer && *p == '@') *p = 0;
return buffer;
}
/* read in the list of exported symbols of an import library */
static int read_import_lib( const char *name, struct import *imp )
{ {
FILE *f; FILE *f;
char buffer[1024], prefix[80], ord_prefix[80]; char buffer[1024];
char *fullname, *cmdline; char *fullname;
int size, err; int size;
imp->exports = NULL; imp->exports = NULL;
imp->nb_exports = size = 0; imp->nb_exports = size = 0;
if (!(fullname = open_library( name ))) return; fullname = open_library( name );
cmdline = xmalloc( strlen(fullname) + 7 ); f = open_input_file( NULL, fullname );
sprintf( cmdline, "nm -D %s", fullname );
free( fullname ); free( fullname );
if (!(f = popen( cmdline, "r" )))
fatal_error( "Cannot execute '%s'\n", cmdline );
sprintf( prefix, "__wine_dllexport_%s_", make_c_identifier(name) );
sprintf( ord_prefix, "__wine_ordexport_%s_", make_c_identifier(name) );
while (fgets( buffer, sizeof(buffer), f )) while (fgets( buffer, sizeof(buffer), f ))
{ {
char *name, *flags;
int ordinal = 0, ord_only = 0; int ordinal = 0, ord_only = 0;
char *p = buffer + strlen(buffer) - 1; char *p = buffer + strlen(buffer) - 1;
if (p < buffer) continue; if (p < buffer) goto next;
if (*p == '\n') *p-- = 0; if (*p == '\n') *p-- = 0;
if (!(p = strstr( buffer, prefix )))
p = buffer;
if (!(p = skip_whitespace(p))) goto next;
name = p;
p = next_token( name );
if (!strcmp( name, "LIBRARY" ))
{
if (!p) fatal_error( "Expected name after LIBRARY\n" );
name = p;
p = next_token( name );
if (p) fatal_error( "Garbage after LIBRARY statement\n" );
if (is_already_imported( name ))
{
close_input_file( f );
return 0; /* ignore this dll */
}
free( imp->dll );
imp->dll = xstrdup( name );
goto next;
}
if (!strcmp( name, "EXPORTS" )) goto next;
/* check for ordinal */
if (!p) fatal_error( "Expected ordinal after function name\n" );
if (*p != '@' || !isdigit(p[1]))
fatal_error( "Expected ordinal after function name '%s'\n", name );
ordinal = strtol( p+1, &p, 10 );
if (ordinal >= MAX_ORDINALS) fatal_error( "Invalid ordinal number %d\n", ordinal );
/* check for optional flags */
while (p && (p = skip_whitespace(p)))
{
flags = p;
p = next_token( flags );
if (!strcmp( flags, "NONAME" ))
{ {
if (!(p = strstr( buffer, ord_prefix ))) continue;
ord_only = 1; ord_only = 1;
if (!ordinal) fatal_error( "Invalid ordinal number %d\n", ordinal );
} }
p += strlen(prefix); else if (!strcmp( flags, "CONSTANT" ) || !strcmp( flags, "DATA" ))
if (isdigit(*p))
{ {
ordinal = strtol( p, &p, 10 ); /* we don't support importing non-function entry points */
if (*p++ != '_') continue; goto next;
if (ordinal >= MAX_ORDINALS) continue; }
else fatal_error( "Garbage after ordinal declaration\n" );
} }
if (ord_only && !ordinal) continue;
if (imp->nb_exports == size) if (imp->nb_exports == size)
{ {
size += 128; size += 128;
imp->exports = xrealloc( imp->exports, size * sizeof(*imp->exports) ); imp->exports = xrealloc( imp->exports, size * sizeof(*imp->exports) );
} }
imp->exports[imp->nb_exports].name = xstrdup( p ); if ((p = strchr( name, '=' ))) *p = 0;
remove_stdcall_decoration( name );
imp->exports[imp->nb_exports].name = xstrdup( name );
imp->exports[imp->nb_exports].ordinal = ordinal; imp->exports[imp->nb_exports].ordinal = ordinal;
imp->exports[imp->nb_exports].ord_only = ord_only; imp->exports[imp->nb_exports].ord_only = ord_only;
imp->nb_exports++; imp->nb_exports++;
next:
current_line++;
} }
if ((err = pclose( f ))) fatal_error( "%s error %d\n", cmdline, err ); close_input_file( f );
free( cmdline );
if (imp->nb_exports) if (imp->nb_exports)
qsort( imp->exports, imp->nb_exports, sizeof(*imp->exports), func_cmp ); qsort( imp->exports, imp->nb_exports, sizeof(*imp->exports), func_cmp );
return 1;
} }
/* add a dll to the list of imports */ /* add a dll to the list of imports */
...@@ -266,21 +349,17 @@ void add_import_dll( const char *name, int delay ) ...@@ -266,21 +349,17 @@ void add_import_dll( const char *name, int delay )
{ {
struct import *imp; struct import *imp;
char *fullname; char *fullname;
int i;
fullname = xmalloc( strlen(name) + 5 ); fullname = xmalloc( strlen(name) + 5 );
strcpy( fullname, name ); strcpy( fullname, name );
if (!strchr( fullname, '.' )) strcat( fullname, ".dll" ); if (!strchr( fullname, '.' )) strcat( fullname, ".dll" );
/* check if we already imported it */ /* check if we already imported it */
for (i = 0; i < nb_imports; i++) if (is_already_imported( fullname ))
{
if (!strcmp( dll_imports[i]->dll, fullname ))
{ {
free( fullname ); free( fullname );
return; return;
} }
}
imp = xmalloc( sizeof(*imp) ); imp = xmalloc( sizeof(*imp) );
imp->dll = fullname; imp->dll = fullname;
...@@ -289,10 +368,13 @@ void add_import_dll( const char *name, int delay ) ...@@ -289,10 +368,13 @@ void add_import_dll( const char *name, int delay )
imp->nb_imports = 0; imp->nb_imports = 0;
if (delay) nb_delayed++; if (delay) nb_delayed++;
read_exported_symbols( fullname, imp );
if (read_import_lib( name, imp ))
{
dll_imports = xrealloc( dll_imports, (nb_imports+1) * sizeof(*dll_imports) ); dll_imports = xrealloc( dll_imports, (nb_imports+1) * sizeof(*dll_imports) );
dll_imports[nb_imports++] = imp; dll_imports[nb_imports++] = imp;
}
else free_imports( imp );
} }
/* initialize the list of ignored symbols */ /* initialize the list of ignored symbols */
......
...@@ -129,7 +129,6 @@ static int output_debug( FILE *outfile ) ...@@ -129,7 +129,6 @@ static int output_debug( FILE *outfile )
static int output_exports( FILE *outfile, int nr_exports ) static int output_exports( FILE *outfile, int nr_exports )
{ {
int i, fwd_size = 0, total_size = 0; int i, fwd_size = 0, total_size = 0;
char *p;
if (!nr_exports) return 0; if (!nr_exports) return 0;
...@@ -296,39 +295,6 @@ static int output_exports( FILE *outfile, int nr_exports ) ...@@ -296,39 +295,6 @@ static int output_exports( FILE *outfile, int nr_exports )
} }
} }
/* output __wine_dllexport symbols */
for (i = 0; i < nb_names; i++)
{
/* check for invalid characters in the name */
for (p = Names[i]->name; *p; p++)
if (!isalnum(*p) && *p != '_' && *p != '.') break;
if (*p) continue;
fprintf( outfile, " \"\\t.globl " __ASM_NAME("__wine_dllexport_%s_%d_%s") "\\n\"\n",
make_c_identifier(DLLFileName), i, Names[i]->name );
fprintf( outfile, " \"" __ASM_NAME("__wine_dllexport_%s_%d_%s") ":\\n\"\n",
make_c_identifier(DLLFileName), i, Names[i]->name );
}
/* output ordinal exports */
for (i = 0; i < nb_entry_points; i++)
{
ORDDEF *odp = EntryPoints[i];
if (odp->name || !odp->export_name) continue;
/* check for invalid characters in the name */
for (p = odp->export_name; *p; p++)
if (!isalnum(*p) && *p != '_' && *p != '.') break;
if (*p) continue;
fprintf( outfile, " \"\\t.globl " __ASM_NAME("__wine_ordexport_%s_%d_%s") "\\n\"\n",
make_c_identifier(DLLFileName), odp->ordinal, odp->export_name );
fprintf( outfile, " \"" __ASM_NAME("__wine_ordexport_%s_%d_%s") ":\\n\"\n",
make_c_identifier(DLLFileName), odp->ordinal, odp->export_name );
}
fprintf( outfile, " \"\\t.long 0xffffffff\\n\"\n" );
/* output variables */ /* output variables */
for (i = 0; i < nb_entry_points; i++) for (i = 0; i < nb_entry_points; i++)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment