File: lt-compile-resource

package info (click to toggle)
gtkgl2 1.99.0-2
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 1,104 kB
  • ctags: 330
  • sloc: sh: 6,744; ansic: 3,173; makefile: 125
file content (47 lines) | stat: -rwxr-xr-x 1,259 bytes parent folder | download | duplicates (3)
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
#!/bin/bash

# Script to compile a resource file for a DLL in the same way that
# libtool would, if it knew about .rc files.

# This kinda sucks, but the alternative would be to teach autoconf,
# automake, and libtool about compiling .rc files.  That would be
# doable, but waiting for those changes to propagate to official
# versions of those tools would take some time.

# The command line arguments are:
# $1: the name of the .rc file to compile if it exists
# $2: the name of the resource libtool object file to produce

# Check if we have a resource file for this DLL.
rcfile=$1
lo=$2
case "$lo" in
*.lo) 
    resfile=.libs/`basename $lo .lo`.o
    ;;
*)
    echo libtool object name should end with .lo
    exit 1
    ;;
esac
d=`dirname $0`

# Create .libs if not there already
[ ! -d .libs ] && mkdir .libs

# Try to compile resource file
$d/compile-resource $rcfile $resfile && {
    # Handcraft a libtool object
    # libtool checks for a second line matching "Generated by .* libtool"!
    (echo "# $lo"
    echo "# Generated by lt-compile-resource, compatible with libtool"
    echo "pic_object=$resfile"
    echo "non_pic_object=none") >$lo

    # Success
    exit 0
}

# If unsuccessful (no .rc file, or some error in it) return failure

exit 1