X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/c6e801d3e6d5c181080d12248aa3fd175c771b09..786c4e23f5d91c319804b4204ebda023b959794c:/src/os2/dllar.sh diff --git a/src/os2/dllar.sh b/src/os2/dllar.sh index 7dba5cdf8d..8f49a04c41 100644 --- a/src/os2/dllar.sh +++ b/src/os2/dllar.sh @@ -86,19 +86,26 @@ CleanUp() { # Kill result in case of failure as there is just to many stupid make/nmake # things out there which doesn't do this. if [ $# -eq 0 ]; then - rm -f $arcFile $defFile $dllFile + rm -f $arcFile $arcFile2 $defFile $dllFile fi } # Print usage and exit script with rc=1. PrintHelp() { - echo 'Usage: dllar [-o[utput] output_file] [-d[escription] "dll descrption"]' - echo ' [-cc "CC"] [-f[lags] "CFLAGS"] [-ord[inals]] -ex[clude] "symbol(s)"' + echo 'Usage: dllar [-o[utput] output_file] [-i[mport] importlib_name]' + echo ' [-d[escription] "dll descrption"] [-cc "CC"] [-f[lags] "CFLAGS"]' + echo ' [-ord[inals]] -ex[clude] "symbol(s)"' echo ' [-libf[lags] "{INIT|TERM}{GLOBAL|INSTANCE}"] [-nocrt[dll]] [-nolxl[ite]]' echo ' [*.o] [*.a]' echo '*> "output_file" should have no extension.' echo ' If it has the .o, .a or .dll extension, it is automatically removed.' - echo ' The import library name is derived from this and is set to "name".a.' + echo ' The import library name is derived from this and is set to "name".a,' + echo ' unless overridden by -import' + echo '*> "importlib_name" should have no extension.' + echo ' If it has the .o, or .a extension, it is automatically removed.' + echo ' This name is used as the import library name and may be longer and' + echo ' more descriptive than the DLL name which has to follow the old ' + echo ' 8.3 convention of FAT.' echo '*> "cc" is used to use another GCC executable. (default: gcc.exe)' echo '*> "flags" should be any set of valid GCC flags. (default: -s -Zcrtdll)' echo ' These flags will be put at the start of GCC command line.' @@ -146,6 +153,7 @@ doCommand() { # setup globals cmdLine=$* outFile="" +outimpFile="" inputFiles="" description="" CC=gcc.exe @@ -175,6 +183,10 @@ while [ $1 ]; do shift outFile=$1 ;; + -i*) + shift + outimpFile=$1 + ;; -d*) shift description=$1 @@ -265,6 +277,7 @@ for file in $inputFiles ; do *.lib) suffix=".lib" AR="emxomfar" + EXTRA_CFLAGS="$EXTRA_CFLAGS -Zomf" ;; *) ;; @@ -281,12 +294,12 @@ for file in $inputFiles ; do doCommand "cd $dirname; $AR x ../$file" cd $curDir found=0; - for subfile in $dirname/*.o ; do + for subfile in $dirname/*.o* ; do if [ -f $subfile ]; then found=1 if [ -s $subfile ]; then # FIXME: This should be: is file size > 32 byte, _not_ > 0! - newInputFiles="$newInputFiles $subname" + newInputFiles="$newInputFiles $subfile" fi fi done @@ -338,8 +351,22 @@ case $outFile in *) ;; esac +case $outimpFile in +*.a) + outimpFile=`basnam $outimpFile .a` + ;; +*.lib) + outimpFile=`basnam $outimpFile .lib` + ;; +*) + ;; +esac +if [ -z $outimpFile ]; then + outimpFile=$outFile +fi defFile="${outFile}.def" -arcFile="${outFile}.a" +arcFile="${outimpFile}.a" +arcFile2="${outimpFile}.lib" #create $dllFile as something matching 8.3 restrictions, dllFile="$outFile" @@ -356,8 +383,13 @@ esac dllFile="`echo $dllFile | sed 's/\.//' | sed 's/_//' | sed 's/-//'`" -if [ $do_backup -ne 0 -a -f $arcFile ] ; then - doCommand "mv $arcFile ${outFile}_s.a" +if [ $do_backup -ne 0 ] ; then + if [ -f $arcFile ] ; then + doCommand "mv $arcFile ${outFile}_s.a" + fi + if [ -f $arcFile2 ] ; then + doCommand "mv $arcFile2 ${outFile}_s.lib" + fi fi # Extract public symbols from all the object files. @@ -377,7 +409,7 @@ done rm -f $defFile echo "LIBRARY `basnam $dllFile` $library_flags" >> $defFile dllFile="$dllFile.dll" -if [ -n $description ]; then +if [ ! -z $description ]; then echo "DESCRIPTION \"${description}\"" >> $defFile fi echo "EXPORTS" >> $defFile