File: ldcygwin

package info (click to toggle)
swi-prolog 6.6.6-1~bpo70+1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy-backports
  • size: 82,312 kB
  • sloc: ansic: 322,250; perl: 245,822; sh: 6,651; java: 5,254; makefile: 4,423; cpp: 4,153; ruby: 1,594; yacc: 843; xml: 82; sed: 12; sql: 6
file content (52 lines) | stat: -rwxr-xr-x 1,169 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#!/bin/bash
#
# Link SWI-Prolog executable on CygWin.  This is way too complicated,
# but sofar the only thing that works and created the required input
# library libplexp.a for making dlls that can be loaded using
# load_foreign_library/1.

output=pl.exe
implib=libplimp.a
verbose=false

function usage()
{ echo "Usage: ldcygwin [-v] [-o output] input"
  exit 1
}

done=false
while [ $done = false ]; do
  case "$1" in
    -v) verbose=true
        shift
	;;
    -o)	output="$2"
        shift
	shift
	;;
    -export-dynamic|-O*)
	shift
	;;
    -*) usage
        ;;
    *)  done=true
  esac
done

in="$*"
out=`echo $output | sed 's/\.exe//'`

if [ $verbose = true ]; then set -x; fi

dlltool --dllname $out.exe --def $out.def --output-lib $implib
if [ $? != 0 ]; then exit 1; fi
dlltool --dllname $out.exe --output-exp $out.exp --def $out.def
if [ $? != 0 ]; then exit 1; fi
gcc -g -o $out.exe -Wl,--base-file,$out.base $out.exp $in
if [ $? != 0 ]; then exit 1; fi
dlltool --dllname $out.exe --base-file $out.base --output-exp $out.exp --def $out.def
if [ $? != 0 ]; then exit 1; fi
gcc -g -o $out.exe $out.exp $in
if [ $? != 0 ]; then exit 1; fi
rm $out.exp $out.base