mklibs.sh 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. #!/bin/sh
  2. set -e
  3. if [ "$CI" ] ; then
  4. # dumpbin in GH actions moved to sub-directory
  5. export PATH="$PATH:$(cygpath -ua 'C:/Program Files (x86)\Microsoft Visual Studio/2019/Enterprise/VC/Tools/MSVC/14.29.30133/bin/HostX64/x64/')"
  6. # dumpbin in GH actions does not support options starting with "-"
  7. DUMPBIN_EXPORT="/EXPORTS"
  8. else
  9. DUMPBIN_EXPORT="-exports"
  10. fi
  11. [ -d mswindows/osgeo4w/vc ] || mkdir mswindows/osgeo4w/vc
  12. if [ -n "$VCPATH" ]; then
  13. PATH=$PATH:$VCPATH
  14. fi
  15. for dllfile in "$@"; do
  16. dlldir=${dllfile%/*}
  17. dllfile=${dllfile##*/}
  18. dllbase=${dllfile%.dll}
  19. dllname=${dllbase#lib}
  20. dllname=${dllname%.$VERSION}
  21. defname=$dllname.def
  22. libname=$dllname.lib
  23. echo "$dllfile => $dllname"
  24. (cd $dlldir; dumpbin "$DUMPBIN_EXPORT" $dllfile) |
  25. sed -nf mswindows/osgeo4w/mklibs.sed |
  26. egrep -v "^[ ]*(_+IMPORT_DESCRIPTOR_.*|_+NULL_IMPORT_DESCRIPTOR)$" >mswindows/osgeo4w/vc/${defname%$VERSION}
  27. (cd mswindows/osgeo4w/vc ;
  28. lib -nologo -def:${defname} -subsystem:windows -machine:x64
  29. lib -nologo $libname || exit)
  30. done