summaryrefslogtreecommitdiff
path: root/autogen.sh
diff options
context:
space:
mode:
authorPete Batard <pbatard@gmail.com>2010-08-05 01:33:49 +0100
committerPete Batard <pbatard@gmail.com>2010-08-05 01:33:49 +0100
commit30b42bc6544e2c6a8e1809cb6819f670dc206904 (patch)
treec16471c7570a5116d8b8de1f39d63dfbc9e9662b /autogen.sh
parentd91b872c4c87297d4df0f4e0220be04c223b2fdb (diff)
downloadlibusb-30b42bc6544e2c6a8e1809cb6819f670dc206904.tar.gz
creates MinGW and MS DLLs that are fully interchangeablepbr293
1. because we use WINAPI, the def file MUST have the @n aliases - there's no way around as MinGW's .o use decoration always for __stdcall, and this can't be turned off 2. our "dumb" autogen create_def() script simply creates the whole range of aliases (we might improve on this in the future) 3. dlltool must be called manually to create the import lib from the def, *with the --kill-at option* 4. a CREATE_IMPORT_LIB autotools variable is introduced to selectively run dlltool or not
Diffstat (limited to 'autogen.sh')
-rwxr-xr-xautogen.sh10
1 files changed, 10 insertions, 0 deletions
diff --git a/autogen.sh b/autogen.sh
index 8c6dd32..5a26ef1 100755
--- a/autogen.sh
+++ b/autogen.sh
@@ -7,6 +7,16 @@ create_def()
echo "LIBRARY" > libusb/libusb-1.0.def
echo "EXPORTS" >> libusb/libusb-1.0.def
sed -n -e "s/.*API_EXPORTED.*\([[:blank:]]\)\(.*\)(.*/ \2/p" libusb/*.c >> libusb/libusb-1.0.def
+ # We need to manually define a whole set of DLL aliases if we want the MS
+ # DLLs to be usable with dynamically linked MinGW executables. This is
+ # because it is not possible to avoid the @ decoration from import WINAPI
+ # calls in MinGW generated objects, and .def based MS generated DLLs don't
+ # have such a decoration => linking to MS DLL will fail without aliases.
+ # Currently, the maximum size is 32 and all sizes are multiples of 4
+ for i in 4 8 12 16 20 24 28 32
+ do
+ sed -n -e "s/.*API_EXPORTED.*\([[:blank:]]\)\(.*\)(.*/ \2@$i = \2/p" libusb/*.c >> libusb/libusb-1.0.def
+ done
}
# use glibtoolize if it is available (darwin)