annotate tools/make-shared-from-static @ 7186:19a46de50b18 default tip @

* src/jasper.mk: update to v4.2.4
author John Donoghue <john.donoghue@ieee.org>
date Thu, 02 May 2024 09:22:30 -0400
parents 5f4998342dca
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2858
7c6b29399d05 New script to make shared libraries from static libraries. This
John W. Eaton <jwe@octave.org>
parents:
diff changeset
1 #!/usr/bin/env bash
7c6b29399d05 New script to make shared libraries from static libraries. This
John W. Eaton <jwe@octave.org>
parents:
diff changeset
2
7c6b29399d05 New script to make shared libraries from static libraries. This
John W. Eaton <jwe@octave.org>
parents:
diff changeset
3 set -e
7c6b29399d05 New script to make shared libraries from static libraries. This
John W. Eaton <jwe@octave.org>
parents:
diff changeset
4
7c6b29399d05 New script to make shared libraries from static libraries. This
John W. Eaton <jwe@octave.org>
parents:
diff changeset
5 LD=
7c6b29399d05 New script to make shared libraries from static libraries. This
John W. Eaton <jwe@octave.org>
parents:
diff changeset
6 AR=
2997
4f9b72cf7ee7 allow native builds too
John W. Eaton <jwe@octave.org>
parents: 2868
diff changeset
7 INSTALL=
2858
7c6b29399d05 New script to make shared libraries from static libraries. This
John W. Eaton <jwe@octave.org>
parents:
diff changeset
8 infile=
7c6b29399d05 New script to make shared libraries from static libraries. This
John W. Eaton <jwe@octave.org>
parents:
diff changeset
9 outfile=
2997
4f9b72cf7ee7 allow native builds too
John W. Eaton <jwe@octave.org>
parents: 2868
diff changeset
10 libdir=
4f9b72cf7ee7 allow native builds too
John W. Eaton <jwe@octave.org>
parents: 2868
diff changeset
11 bindir=
4f9b72cf7ee7 allow native builds too
John W. Eaton <jwe@octave.org>
parents: 2868
diff changeset
12 install=false
4f9b72cf7ee7 allow native builds too
John W. Eaton <jwe@octave.org>
parents: 2868
diff changeset
13 windowsdll=false
3062
4c047285ea8a Make BLAS compilable with MSVC.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 2997
diff changeset
14 msvc=false
3073
a46b4b6fc26f [MSVC] enable ARPACK compilation
Michael Goffioul <michael.goffioul@gmail.com>
parents: 3070
diff changeset
15 msvclibmode=false
3062
4c047285ea8a Make BLAS compilable with MSVC.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 2997
diff changeset
16 libprefix=
4c047285ea8a Make BLAS compilable with MSVC.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 2997
diff changeset
17 libsuffix=
2858
7c6b29399d05 New script to make shared libraries from static libraries. This
John W. Eaton <jwe@octave.org>
parents:
diff changeset
18 LIBS=
7c6b29399d05 New script to make shared libraries from static libraries. This
John W. Eaton <jwe@octave.org>
parents:
diff changeset
19
7c6b29399d05 New script to make shared libraries from static libraries. This
John W. Eaton <jwe@octave.org>
parents:
diff changeset
20 topdir=$(pwd)
7c6b29399d05 New script to make shared libraries from static libraries. This
John W. Eaton <jwe@octave.org>
parents:
diff changeset
21 tmpdir=$topdir/make-shared-from-static.$$
7c6b29399d05 New script to make shared libraries from static libraries. This
John W. Eaton <jwe@octave.org>
parents:
diff changeset
22
2997
4f9b72cf7ee7 allow native builds too
John W. Eaton <jwe@octave.org>
parents: 2868
diff changeset
23 #trap "cd $topdir; rm -rf $tmpdir" 1 2 15
2858
7c6b29399d05 New script to make shared libraries from static libraries. This
John W. Eaton <jwe@octave.org>
parents:
diff changeset
24
7c6b29399d05 New script to make shared libraries from static libraries. This
John W. Eaton <jwe@octave.org>
parents:
diff changeset
25 for arg
7c6b29399d05 New script to make shared libraries from static libraries. This
John W. Eaton <jwe@octave.org>
parents:
diff changeset
26 do
7c6b29399d05 New script to make shared libraries from static libraries. This
John W. Eaton <jwe@octave.org>
parents:
diff changeset
27 case "$1" in
2997
4f9b72cf7ee7 allow native builds too
John W. Eaton <jwe@octave.org>
parents: 2868
diff changeset
28 --install)
4f9b72cf7ee7 allow native builds too
John W. Eaton <jwe@octave.org>
parents: 2868
diff changeset
29 install=true
4f9b72cf7ee7 allow native builds too
John W. Eaton <jwe@octave.org>
parents: 2868
diff changeset
30 shift
4f9b72cf7ee7 allow native builds too
John W. Eaton <jwe@octave.org>
parents: 2868
diff changeset
31 if [ $# -gt 0 ]; then
4f9b72cf7ee7 allow native builds too
John W. Eaton <jwe@octave.org>
parents: 2868
diff changeset
32 INSTALL="$1"
4f9b72cf7ee7 allow native builds too
John W. Eaton <jwe@octave.org>
parents: 2868
diff changeset
33 shift
4f9b72cf7ee7 allow native builds too
John W. Eaton <jwe@octave.org>
parents: 2868
diff changeset
34 else
4f9b72cf7ee7 allow native builds too
John W. Eaton <jwe@octave.org>
parents: 2868
diff changeset
35 echo "make-shared-from-static: expecting argument for --install option" 1>&2
4f9b72cf7ee7 allow native builds too
John W. Eaton <jwe@octave.org>
parents: 2868
diff changeset
36 exit 1
4f9b72cf7ee7 allow native builds too
John W. Eaton <jwe@octave.org>
parents: 2868
diff changeset
37 fi
4f9b72cf7ee7 allow native builds too
John W. Eaton <jwe@octave.org>
parents: 2868
diff changeset
38 ;;
4f9b72cf7ee7 allow native builds too
John W. Eaton <jwe@octave.org>
parents: 2868
diff changeset
39 --windowsdll)
4f9b72cf7ee7 allow native builds too
John W. Eaton <jwe@octave.org>
parents: 2868
diff changeset
40 shift
4f9b72cf7ee7 allow native builds too
John W. Eaton <jwe@octave.org>
parents: 2868
diff changeset
41 windowsdll=true
4f9b72cf7ee7 allow native builds too
John W. Eaton <jwe@octave.org>
parents: 2868
diff changeset
42 ;;
3062
4c047285ea8a Make BLAS compilable with MSVC.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 2997
diff changeset
43 --msvc)
4c047285ea8a Make BLAS compilable with MSVC.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 2997
diff changeset
44 shift
4c047285ea8a Make BLAS compilable with MSVC.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 2997
diff changeset
45 msvc=true
4c047285ea8a Make BLAS compilable with MSVC.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 2997
diff changeset
46 ;;
2997
4f9b72cf7ee7 allow native builds too
John W. Eaton <jwe@octave.org>
parents: 2868
diff changeset
47 --bindir)
4f9b72cf7ee7 allow native builds too
John W. Eaton <jwe@octave.org>
parents: 2868
diff changeset
48 shift
4f9b72cf7ee7 allow native builds too
John W. Eaton <jwe@octave.org>
parents: 2868
diff changeset
49 if [ $# -gt 0 ]; then
4f9b72cf7ee7 allow native builds too
John W. Eaton <jwe@octave.org>
parents: 2868
diff changeset
50 bindir="$1"
4f9b72cf7ee7 allow native builds too
John W. Eaton <jwe@octave.org>
parents: 2868
diff changeset
51 shift
4f9b72cf7ee7 allow native builds too
John W. Eaton <jwe@octave.org>
parents: 2868
diff changeset
52 else
4f9b72cf7ee7 allow native builds too
John W. Eaton <jwe@octave.org>
parents: 2868
diff changeset
53 echo "make-shared-from-static: expecting argument for --bindir option" 1>&2
4f9b72cf7ee7 allow native builds too
John W. Eaton <jwe@octave.org>
parents: 2868
diff changeset
54 exit 1
4f9b72cf7ee7 allow native builds too
John W. Eaton <jwe@octave.org>
parents: 2868
diff changeset
55 fi
4f9b72cf7ee7 allow native builds too
John W. Eaton <jwe@octave.org>
parents: 2868
diff changeset
56 ;;
4f9b72cf7ee7 allow native builds too
John W. Eaton <jwe@octave.org>
parents: 2868
diff changeset
57 --libdir)
4f9b72cf7ee7 allow native builds too
John W. Eaton <jwe@octave.org>
parents: 2868
diff changeset
58 shift
4f9b72cf7ee7 allow native builds too
John W. Eaton <jwe@octave.org>
parents: 2868
diff changeset
59 if [ $# -gt 0 ]; then
4f9b72cf7ee7 allow native builds too
John W. Eaton <jwe@octave.org>
parents: 2868
diff changeset
60 libdir="$1"
4f9b72cf7ee7 allow native builds too
John W. Eaton <jwe@octave.org>
parents: 2868
diff changeset
61 shift
4f9b72cf7ee7 allow native builds too
John W. Eaton <jwe@octave.org>
parents: 2868
diff changeset
62 else
4f9b72cf7ee7 allow native builds too
John W. Eaton <jwe@octave.org>
parents: 2868
diff changeset
63 echo "make-shared-from-static: expecting argument for --libdir option" 1>&2
4f9b72cf7ee7 allow native builds too
John W. Eaton <jwe@octave.org>
parents: 2868
diff changeset
64 exit 1
4f9b72cf7ee7 allow native builds too
John W. Eaton <jwe@octave.org>
parents: 2868
diff changeset
65 fi
4f9b72cf7ee7 allow native builds too
John W. Eaton <jwe@octave.org>
parents: 2868
diff changeset
66 ;;
2858
7c6b29399d05 New script to make shared libraries from static libraries. This
John W. Eaton <jwe@octave.org>
parents:
diff changeset
67 --ld)
7c6b29399d05 New script to make shared libraries from static libraries. This
John W. Eaton <jwe@octave.org>
parents:
diff changeset
68 shift
7c6b29399d05 New script to make shared libraries from static libraries. This
John W. Eaton <jwe@octave.org>
parents:
diff changeset
69 if [ $# -gt 0 ]; then
7c6b29399d05 New script to make shared libraries from static libraries. This
John W. Eaton <jwe@octave.org>
parents:
diff changeset
70 LD="$1"
7c6b29399d05 New script to make shared libraries from static libraries. This
John W. Eaton <jwe@octave.org>
parents:
diff changeset
71 shift
7c6b29399d05 New script to make shared libraries from static libraries. This
John W. Eaton <jwe@octave.org>
parents:
diff changeset
72 else
7c6b29399d05 New script to make shared libraries from static libraries. This
John W. Eaton <jwe@octave.org>
parents:
diff changeset
73 echo "make-shared-from-static: expecting argument for --ld option" 1>&2
7c6b29399d05 New script to make shared libraries from static libraries. This
John W. Eaton <jwe@octave.org>
parents:
diff changeset
74 exit 1
7c6b29399d05 New script to make shared libraries from static libraries. This
John W. Eaton <jwe@octave.org>
parents:
diff changeset
75 fi
7c6b29399d05 New script to make shared libraries from static libraries. This
John W. Eaton <jwe@octave.org>
parents:
diff changeset
76 ;;
7c6b29399d05 New script to make shared libraries from static libraries. This
John W. Eaton <jwe@octave.org>
parents:
diff changeset
77 --ar)
7c6b29399d05 New script to make shared libraries from static libraries. This
John W. Eaton <jwe@octave.org>
parents:
diff changeset
78 shift
7c6b29399d05 New script to make shared libraries from static libraries. This
John W. Eaton <jwe@octave.org>
parents:
diff changeset
79 if [ $# -gt 0 ]; then
7c6b29399d05 New script to make shared libraries from static libraries. This
John W. Eaton <jwe@octave.org>
parents:
diff changeset
80 AR="$1"
7c6b29399d05 New script to make shared libraries from static libraries. This
John W. Eaton <jwe@octave.org>
parents:
diff changeset
81 shift
7c6b29399d05 New script to make shared libraries from static libraries. This
John W. Eaton <jwe@octave.org>
parents:
diff changeset
82 else
7c6b29399d05 New script to make shared libraries from static libraries. This
John W. Eaton <jwe@octave.org>
parents:
diff changeset
83 echo "make-shared-from-static: expecting argument for --ar option" 1>&2
7c6b29399d05 New script to make shared libraries from static libraries. This
John W. Eaton <jwe@octave.org>
parents:
diff changeset
84 exit 1
7c6b29399d05 New script to make shared libraries from static libraries. This
John W. Eaton <jwe@octave.org>
parents:
diff changeset
85 fi
7c6b29399d05 New script to make shared libraries from static libraries. This
John W. Eaton <jwe@octave.org>
parents:
diff changeset
86 ;;
3062
4c047285ea8a Make BLAS compilable with MSVC.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 2997
diff changeset
87 --libprefix)
4c047285ea8a Make BLAS compilable with MSVC.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 2997
diff changeset
88 shift
4c047285ea8a Make BLAS compilable with MSVC.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 2997
diff changeset
89 if [ $# -gt 0 ]; then
4c047285ea8a Make BLAS compilable with MSVC.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 2997
diff changeset
90 libprefix="$1"
4c047285ea8a Make BLAS compilable with MSVC.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 2997
diff changeset
91 shift
4c047285ea8a Make BLAS compilable with MSVC.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 2997
diff changeset
92 else
4c047285ea8a Make BLAS compilable with MSVC.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 2997
diff changeset
93 echo "make-shared-from-static: expecting argument for --libprefix option" 1>&2
4c047285ea8a Make BLAS compilable with MSVC.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 2997
diff changeset
94 exit 1
4c047285ea8a Make BLAS compilable with MSVC.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 2997
diff changeset
95 fi
4c047285ea8a Make BLAS compilable with MSVC.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 2997
diff changeset
96 ;;
4c047285ea8a Make BLAS compilable with MSVC.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 2997
diff changeset
97 --libsuffix)
4c047285ea8a Make BLAS compilable with MSVC.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 2997
diff changeset
98 shift
4c047285ea8a Make BLAS compilable with MSVC.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 2997
diff changeset
99 if [ $# -gt 0 ]; then
4c047285ea8a Make BLAS compilable with MSVC.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 2997
diff changeset
100 libsuffix="$1"
4c047285ea8a Make BLAS compilable with MSVC.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 2997
diff changeset
101 shift
4c047285ea8a Make BLAS compilable with MSVC.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 2997
diff changeset
102 else
4c047285ea8a Make BLAS compilable with MSVC.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 2997
diff changeset
103 echo "make-shared-from-static: expecting argument for --libsuffix option" 1>&2
4c047285ea8a Make BLAS compilable with MSVC.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 2997
diff changeset
104 exit 1
4c047285ea8a Make BLAS compilable with MSVC.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 2997
diff changeset
105 fi
4c047285ea8a Make BLAS compilable with MSVC.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 2997
diff changeset
106 ;;
2858
7c6b29399d05 New script to make shared libraries from static libraries. This
John W. Eaton <jwe@octave.org>
parents:
diff changeset
107 -l*)
7c6b29399d05 New script to make shared libraries from static libraries. This
John W. Eaton <jwe@octave.org>
parents:
diff changeset
108 LIBS="$LIBS $1"
7c6b29399d05 New script to make shared libraries from static libraries. This
John W. Eaton <jwe@octave.org>
parents:
diff changeset
109 shift
7c6b29399d05 New script to make shared libraries from static libraries. This
John W. Eaton <jwe@octave.org>
parents:
diff changeset
110 ;;
7c6b29399d05 New script to make shared libraries from static libraries. This
John W. Eaton <jwe@octave.org>
parents:
diff changeset
111 *.a)
7c6b29399d05 New script to make shared libraries from static libraries. This
John W. Eaton <jwe@octave.org>
parents:
diff changeset
112 if [ -z "$infile" ]; then
7c6b29399d05 New script to make shared libraries from static libraries. This
John W. Eaton <jwe@octave.org>
parents:
diff changeset
113 case "$1" in
7c6b29399d05 New script to make shared libraries from static libraries. This
John W. Eaton <jwe@octave.org>
parents:
diff changeset
114 /*)
7c6b29399d05 New script to make shared libraries from static libraries. This
John W. Eaton <jwe@octave.org>
parents:
diff changeset
115 infile="$1"
7c6b29399d05 New script to make shared libraries from static libraries. This
John W. Eaton <jwe@octave.org>
parents:
diff changeset
116 ;;
7c6b29399d05 New script to make shared libraries from static libraries. This
John W. Eaton <jwe@octave.org>
parents:
diff changeset
117 *)
7c6b29399d05 New script to make shared libraries from static libraries. This
John W. Eaton <jwe@octave.org>
parents:
diff changeset
118 infile=$(pwd)/$1
7c6b29399d05 New script to make shared libraries from static libraries. This
John W. Eaton <jwe@octave.org>
parents:
diff changeset
119 ;;
7c6b29399d05 New script to make shared libraries from static libraries. This
John W. Eaton <jwe@octave.org>
parents:
diff changeset
120 esac
7c6b29399d05 New script to make shared libraries from static libraries. This
John W. Eaton <jwe@octave.org>
parents:
diff changeset
121 shift
7c6b29399d05 New script to make shared libraries from static libraries. This
John W. Eaton <jwe@octave.org>
parents:
diff changeset
122 else
7c6b29399d05 New script to make shared libraries from static libraries. This
John W. Eaton <jwe@octave.org>
parents:
diff changeset
123 echo "make-shared-from-static: only one input file allowed" 1>&2
7c6b29399d05 New script to make shared libraries from static libraries. This
John W. Eaton <jwe@octave.org>
parents:
diff changeset
124 exit 1
7c6b29399d05 New script to make shared libraries from static libraries. This
John W. Eaton <jwe@octave.org>
parents:
diff changeset
125 fi
7c6b29399d05 New script to make shared libraries from static libraries. This
John W. Eaton <jwe@octave.org>
parents:
diff changeset
126 ;;
7c6b29399d05 New script to make shared libraries from static libraries. This
John W. Eaton <jwe@octave.org>
parents:
diff changeset
127 esac
7c6b29399d05 New script to make shared libraries from static libraries. This
John W. Eaton <jwe@octave.org>
parents:
diff changeset
128 done
7c6b29399d05 New script to make shared libraries from static libraries. This
John W. Eaton <jwe@octave.org>
parents:
diff changeset
129
2997
4f9b72cf7ee7 allow native builds too
John W. Eaton <jwe@octave.org>
parents: 2868
diff changeset
130 if [ -n "$infile" ]; then
4f9b72cf7ee7 allow native builds too
John W. Eaton <jwe@octave.org>
parents: 2868
diff changeset
131 base_infile=$(basename $infile)
4f9b72cf7ee7 allow native builds too
John W. Eaton <jwe@octave.org>
parents: 2868
diff changeset
132 if $windowsdll; then
3062
4c047285ea8a Make BLAS compilable with MSVC.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 2997
diff changeset
133 if $msvc; then
4c047285ea8a Make BLAS compilable with MSVC.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 2997
diff changeset
134 base_name=`echo $base_infile | sed -n -e 's/^lib\(.*\)\.a$/\1/p'`
4c047285ea8a Make BLAS compilable with MSVC.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 2997
diff changeset
135 outfile="${libprefix}${base_name}${libsuffix}.dll"
4c047285ea8a Make BLAS compilable with MSVC.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 2997
diff changeset
136 implibfile="$base_name.lib"
3073
a46b4b6fc26f [MSVC] enable ARPACK compilation
Michael Goffioul <michael.goffioul@gmail.com>
parents: 3070
diff changeset
137 # Modern libtool won't create .a files, but will create directly .lib files.
a46b4b6fc26f [MSVC] enable ARPACK compilation
Michael Goffioul <michael.goffioul@gmail.com>
parents: 3070
diff changeset
138 # If the .a file does not exist, check for an existing .lib file.
a46b4b6fc26f [MSVC] enable ARPACK compilation
Michael Goffioul <michael.goffioul@gmail.com>
parents: 3070
diff changeset
139 if [ ! -f "$infile" ]; then
3284
5f4998342dca * tools/make-shared-from-static: Look for libXXX.lib and XXX.lib in MSVC mode.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 3073
diff changeset
140 msvc_infiles="`echo $infile | sed -e 's/\.a$/.lib/'` \
5f4998342dca * tools/make-shared-from-static: Look for libXXX.lib and XXX.lib in MSVC mode.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 3073
diff changeset
141 `dirname \"$infile\"`/`echo $base_infile | sed -e 's/\.a$/.lib/' -e 's/^lib//'`"
5f4998342dca * tools/make-shared-from-static: Look for libXXX.lib and XXX.lib in MSVC mode.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 3073
diff changeset
142 for msvc_infile in $msvc_infiles; do
5f4998342dca * tools/make-shared-from-static: Look for libXXX.lib and XXX.lib in MSVC mode.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 3073
diff changeset
143 if [ -f "$msvc_infile" ]; then
5f4998342dca * tools/make-shared-from-static: Look for libXXX.lib and XXX.lib in MSVC mode.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 3073
diff changeset
144 infile="$msvc_infile"
5f4998342dca * tools/make-shared-from-static: Look for libXXX.lib and XXX.lib in MSVC mode.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 3073
diff changeset
145 msvclibmode=true
5f4998342dca * tools/make-shared-from-static: Look for libXXX.lib and XXX.lib in MSVC mode.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 3073
diff changeset
146 break
5f4998342dca * tools/make-shared-from-static: Look for libXXX.lib and XXX.lib in MSVC mode.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 3073
diff changeset
147 fi
5f4998342dca * tools/make-shared-from-static: Look for libXXX.lib and XXX.lib in MSVC mode.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 3073
diff changeset
148 done
3073
a46b4b6fc26f [MSVC] enable ARPACK compilation
Michael Goffioul <michael.goffioul@gmail.com>
parents: 3070
diff changeset
149 fi
3062
4c047285ea8a Make BLAS compilable with MSVC.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 2997
diff changeset
150 else
4c047285ea8a Make BLAS compilable with MSVC.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 2997
diff changeset
151 outfile=$(echo $base_infile | sed 's/\.a$/.dll/')
4c047285ea8a Make BLAS compilable with MSVC.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 2997
diff changeset
152 implibfile="$outfile.a"
4c047285ea8a Make BLAS compilable with MSVC.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 2997
diff changeset
153 fi
2997
4f9b72cf7ee7 allow native builds too
John W. Eaton <jwe@octave.org>
parents: 2868
diff changeset
154 else
4f9b72cf7ee7 allow native builds too
John W. Eaton <jwe@octave.org>
parents: 2868
diff changeset
155 outfile=$(echo $base_infile | sed 's/\.a$/.so/')
4f9b72cf7ee7 allow native builds too
John W. Eaton <jwe@octave.org>
parents: 2868
diff changeset
156 fi
4f9b72cf7ee7 allow native builds too
John W. Eaton <jwe@octave.org>
parents: 2868
diff changeset
157 else
4f9b72cf7ee7 allow native builds too
John W. Eaton <jwe@octave.org>
parents: 2868
diff changeset
158 echo "make-shared-from-static: no input file specified" 1>&2
2858
7c6b29399d05 New script to make shared libraries from static libraries. This
John W. Eaton <jwe@octave.org>
parents:
diff changeset
159 exit 1
7c6b29399d05 New script to make shared libraries from static libraries. This
John W. Eaton <jwe@octave.org>
parents:
diff changeset
160 fi
7c6b29399d05 New script to make shared libraries from static libraries. This
John W. Eaton <jwe@octave.org>
parents:
diff changeset
161
3062
4c047285ea8a Make BLAS compilable with MSVC.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 2997
diff changeset
162 NM=nm
4c047285ea8a Make BLAS compilable with MSVC.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 2997
diff changeset
163 SED=sed
4c047285ea8a Make BLAS compilable with MSVC.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 2997
diff changeset
164 global_symbol_pipe="sed -n -e 's/^.*[ ]\\([ABCDGIRSTW][ABCDGIRSTW]*\\)[ ][ ]*_\\([_A-Za-z][_A-iZa-z0-9]*\\)\\{0,1\\}\$/\\1 _\\2 \\2/p' | sed '/ __gnu_lto/d'"
3070
d89eccc2edd3 [MSVC] enable zlib compilation
Michael Goffioul <michael.goffioul@gmail.com>
parents: 3062
diff changeset
165 # Ignore DATA symbols for now. They should be be properly exported from
d89eccc2edd3 [MSVC] enable zlib compilation
Michael Goffioul <michael.goffioul@gmail.com>
parents: 3062
diff changeset
166 # the source code using dllexport. They can't be re-exported manually like
d89eccc2edd3 [MSVC] enable zlib compilation
Michael Goffioul <michael.goffioul@gmail.com>
parents: 3062
diff changeset
167 # this using MSVC.
d89eccc2edd3 [MSVC] enable zlib compilation
Michael Goffioul <michael.goffioul@gmail.com>
parents: 3062
diff changeset
168 #export_symbols_cmds="\$NM \$libobjs \$convenience | \$global_symbol_pipe | \$SED -e '/^[BCDGRS][ ]/s/.*[ ]\\\\([^ ]*\\\\)/\\\\1,DATA/' | \$SED -e '/^[AITW][ ]/s/.*[ ]//' | sort | uniq >> \$export_symbols"
d89eccc2edd3 [MSVC] enable zlib compilation
Michael Goffioul <michael.goffioul@gmail.com>
parents: 3062
diff changeset
169 export_symbols_cmds="\$NM \$libobjs \$convenience | \$global_symbol_pipe | \$SED -e '/^[BCDGRS][ ]/d' | \$SED -e '/^[AITW][ ]/s/.*[ ]//' | sort | uniq >> \$export_symbols"
3062
4c047285ea8a Make BLAS compilable with MSVC.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 2997
diff changeset
170
2858
7c6b29399d05 New script to make shared libraries from static libraries. This
John W. Eaton <jwe@octave.org>
parents:
diff changeset
171 mkdir $tmpdir
7c6b29399d05 New script to make shared libraries from static libraries. This
John W. Eaton <jwe@octave.org>
parents:
diff changeset
172
7c6b29399d05 New script to make shared libraries from static libraries. This
John W. Eaton <jwe@octave.org>
parents:
diff changeset
173 (
7c6b29399d05 New script to make shared libraries from static libraries. This
John W. Eaton <jwe@octave.org>
parents:
diff changeset
174 cd $tmpdir
7c6b29399d05 New script to make shared libraries from static libraries. This
John W. Eaton <jwe@octave.org>
parents:
diff changeset
175
3073
a46b4b6fc26f [MSVC] enable ARPACK compilation
Michael Goffioul <michael.goffioul@gmail.com>
parents: 3070
diff changeset
176 $msvclibmode || $AR x $infile
2858
7c6b29399d05 New script to make shared libraries from static libraries. This
John W. Eaton <jwe@octave.org>
parents:
diff changeset
177
2997
4f9b72cf7ee7 allow native builds too
John W. Eaton <jwe@octave.org>
parents: 2868
diff changeset
178 LIBDIR_ARGS=
4f9b72cf7ee7 allow native builds too
John W. Eaton <jwe@octave.org>
parents: 2868
diff changeset
179 if [ -n "$libdir" ]; then
4f9b72cf7ee7 allow native builds too
John W. Eaton <jwe@octave.org>
parents: 2868
diff changeset
180 LIBDIR_ARGS="-L$libdir"
4f9b72cf7ee7 allow native builds too
John W. Eaton <jwe@octave.org>
parents: 2868
diff changeset
181 fi
4f9b72cf7ee7 allow native builds too
John W. Eaton <jwe@octave.org>
parents: 2868
diff changeset
182
4f9b72cf7ee7 allow native builds too
John W. Eaton <jwe@octave.org>
parents: 2868
diff changeset
183 if $windowsdll; then
3062
4c047285ea8a Make BLAS compilable with MSVC.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 2997
diff changeset
184 if $msvc; then
4c047285ea8a Make BLAS compilable with MSVC.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 2997
diff changeset
185 export_symbols="$base_name.def"
4c047285ea8a Make BLAS compilable with MSVC.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 2997
diff changeset
186 echo EXPORTS > $export_symbols
3073
a46b4b6fc26f [MSVC] enable ARPACK compilation
Michael Goffioul <michael.goffioul@gmail.com>
parents: 3070
diff changeset
187 if $msvclibmode; then
a46b4b6fc26f [MSVC] enable ARPACK compilation
Michael Goffioul <michael.goffioul@gmail.com>
parents: 3070
diff changeset
188 libobjs="$infile"
a46b4b6fc26f [MSVC] enable ARPACK compilation
Michael Goffioul <michael.goffioul@gmail.com>
parents: 3070
diff changeset
189 else
a46b4b6fc26f [MSVC] enable ARPACK compilation
Michael Goffioul <michael.goffioul@gmail.com>
parents: 3070
diff changeset
190 libobjs="*.o"
a46b4b6fc26f [MSVC] enable ARPACK compilation
Michael Goffioul <michael.goffioul@gmail.com>
parents: 3070
diff changeset
191 fi
3062
4c047285ea8a Make BLAS compilable with MSVC.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 2997
diff changeset
192 convenience=
4c047285ea8a Make BLAS compilable with MSVC.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 2997
diff changeset
193 eval cmd=\"$export_symbols_cmds\"
4c047285ea8a Make BLAS compilable with MSVC.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 2997
diff changeset
194 eval "$cmd"
3073
a46b4b6fc26f [MSVC] enable ARPACK compilation
Michael Goffioul <michael.goffioul@gmail.com>
parents: 3070
diff changeset
195 link_args="-Wl,-def:$export_symbols $libobjs"
3062
4c047285ea8a Make BLAS compilable with MSVC.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 2997
diff changeset
196 else
3073
a46b4b6fc26f [MSVC] enable ARPACK compilation
Michael Goffioul <michael.goffioul@gmail.com>
parents: 3070
diff changeset
197 link_args="-Wl,--export-all-symbols -Wl,--enable-auto-import -Wl,--enable-auto-image-base *.o"
3062
4c047285ea8a Make BLAS compilable with MSVC.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 2997
diff changeset
198 fi
3073
a46b4b6fc26f [MSVC] enable ARPACK compilation
Michael Goffioul <michael.goffioul@gmail.com>
parents: 3070
diff changeset
199 $LD -shared $link_args -Wl,--out-implib="$implibfile" -o "$outfile" $LIBDIR_ARGS $LIBS
2997
4f9b72cf7ee7 allow native builds too
John W. Eaton <jwe@octave.org>
parents: 2868
diff changeset
200 else
4f9b72cf7ee7 allow native builds too
John W. Eaton <jwe@octave.org>
parents: 2868
diff changeset
201 $LD -shared -o $outfile *.o $LIBDIR_ARGS $LIBS
4f9b72cf7ee7 allow native builds too
John W. Eaton <jwe@octave.org>
parents: 2868
diff changeset
202 fi
4f9b72cf7ee7 allow native builds too
John W. Eaton <jwe@octave.org>
parents: 2868
diff changeset
203
4f9b72cf7ee7 allow native builds too
John W. Eaton <jwe@octave.org>
parents: 2868
diff changeset
204 if $install; then
4f9b72cf7ee7 allow native builds too
John W. Eaton <jwe@octave.org>
parents: 2868
diff changeset
205 if $windowsdll; then
4f9b72cf7ee7 allow native builds too
John W. Eaton <jwe@octave.org>
parents: 2868
diff changeset
206 $INSTALL -d "$libdir"
4f9b72cf7ee7 allow native builds too
John W. Eaton <jwe@octave.org>
parents: 2868
diff changeset
207 $INSTALL -d "$bindir"
3062
4c047285ea8a Make BLAS compilable with MSVC.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 2997
diff changeset
208 $INSTALL -m755 "$implibfile" "$libdir/$implibfile"
2997
4f9b72cf7ee7 allow native builds too
John W. Eaton <jwe@octave.org>
parents: 2868
diff changeset
209 $INSTALL -m755 "$outfile" "$bindir/$outfile"
4f9b72cf7ee7 allow native builds too
John W. Eaton <jwe@octave.org>
parents: 2868
diff changeset
210 else
4f9b72cf7ee7 allow native builds too
John W. Eaton <jwe@octave.org>
parents: 2868
diff changeset
211 $INSTALL -d "$libdir"
4f9b72cf7ee7 allow native builds too
John W. Eaton <jwe@octave.org>
parents: 2868
diff changeset
212 $INSTALL -m755 "$outfile" "$libdir/$outfile"
4f9b72cf7ee7 allow native builds too
John W. Eaton <jwe@octave.org>
parents: 2868
diff changeset
213 fi
4f9b72cf7ee7 allow native builds too
John W. Eaton <jwe@octave.org>
parents: 2868
diff changeset
214 fi
2858
7c6b29399d05 New script to make shared libraries from static libraries. This
John W. Eaton <jwe@octave.org>
parents:
diff changeset
215 )
7c6b29399d05 New script to make shared libraries from static libraries. This
John W. Eaton <jwe@octave.org>
parents:
diff changeset
216
2868
1c18d3bb1829 Include suitesparse as a dependency of Octave
John W. Eaton <jwe@octave.org>
parents: 2858
diff changeset
217 rm -rf $tmpdir