File: generate_prj.sh

package info (click to toggle)
libgtkada2 2.8.1-6lenny3
  • links: PTS, VCS
  • area: main
  • in suites: lenny
  • size: 13,496 kB
  • ctags: 3,886
  • sloc: ada: 103,189; ansic: 45,411; perl: 5,500; sh: 2,812; makefile: 1,169; xml: 19
file content (110 lines) | stat: -rwxr-xr-x 2,166 bytes parent folder | download | duplicates (2)
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
#!/bin/sh

module=${1:-}
prefix=$2
has_shared="$3"
version=$4

libs=`../src/gtkada-config --libs`

lcmodule=`echo $module | tr A-Z a-z`

if [ "$OS" = "Windows_NT" ]; then
lcversion="-$version"
else
lcversion=""
fi

#### Create the linker page

echo_linker() {
   shared=$1

   echo "   package Linker is"
   echo "      for Linker_Options use ("

   if [ x$lcmodule = xgtkada ]; then
      cpt=0
      for j in $libs; do
         lib="$j"
         if [ x"$lib" = x"-lgtkada" ]; then
            lib=""
         fi

         if [ x"$lib" != x ]; then
            if [ $cpt -eq 1 ]; then
               echo ","
            fi
            cpt=1
            echo -n "        \"$lib\""
         fi
      done

      case `uname` in
         *_NT*)
            echo ","
            echo -n "        \"-luser32\""
         ;;
      esac

   else
      echo -n "        \"$prefix/lib/lib${lcmodule}.a\""
   fi

   echo ");"
   echo "   end Linker;"
}


#### Generate the project file for the relocatable library

generate_shared() {
  uc=$1   # upper-case name
  lc=$2   # lower-case name

  cat <<EOF > ${lc}.gpr
project ${uc} is
   for Source_Dirs use ("../../include/gtkada");
   for Source_List_File use "gtkada/${lcmodule}.lgpr";
   for Library_Dir use "../gtkada";
   for Library_Kind use "relocatable";
   for Library_Name use "${lcmodule}${lcversion}";
   for Externally_Built use "true";
EOF
  echo_linker 1 >> ${lc}.gpr
  cat <<EOF >> ${lc}.gpr
end ${uc};
EOF
}

#### Generate the project file for the static library

generate_static() {
  uc=$1
  lc=$2
  cat <<EOF > ${lc}.gpr
project ${uc} is
   for Source_Dirs use ("../../include/gtkada");
   for Source_List_File use "gtkada/${lcmodule}.lgpr";
   for Library_Dir use "../gtkada";
   for Library_Kind use "static";
   for Library_Name use "${lcmodule}";
   for Externally_Built use "true";
EOF
  echo_linker 0 >> ${lc}.gpr
  cat <<EOF >> ${lc}.gpr
end ${uc};
EOF


}

generate_static ${module}_Static ${lcmodule}_static

if [ x"$has_shared" = xyes ]; then
  generate_shared ${module}_Relocatable ${lcmodule}_relocatable
  generate_shared ${module} ${lcmodule}
else
  generate_static ${module} ${lcmodule}
fi