source: trunk/essentials/sys-apps/gawk/README_d/README.cygwin-dynamic@ 3174

Last change on this file since 3174 was 3076, checked in by bird, 19 years ago

gawk 3.1.5

File size: 3.4 KB
Line 
1From: [email protected]
2Newsgroups: comp.lang.awk
3Subject: Re: Compiling gawk extensions under Cygwin
4Date: 14 Mar 2005 20:47:09 -0800
5Organization: http://groups.google.com
6Lines: 67
7Message-ID: <[email protected]>
8References: <[email protected]>
9 <[email protected]>
10NNTP-Posting-Host: 194.237.142.24
11Mime-Version: 1.0
12Content-Type: text/plain; charset="iso-8859-1"
13X-Trace: posting.google.com 1110862033 8921 127.0.0.1 (15 Mar 2005 04:47:13 GMT)
14X-Complaints-To: [email protected]
15NNTP-Posting-Date: Tue, 15 Mar 2005 04:47:13 +0000 (UTC)
16User-Agent: G2/0.2
17Complaints-To: [email protected]
18Injection-Info: o13g2000cwo.googlegroups.com; posting-host=194.237.142.24;
19 posting-account=Iz4C5wwAAABx1yG_ft8eEAI99Wu1Tku1
20Path: news.012.net.il!seanews2.seabone.net!newsfeed.albacom.net!news.mailgate.org!newsfeed.stueberl.de!proxad.net!64.233.160.134.MISMATCH!postnews.google.com!o13g2000cwo.googlegroups.com!not-for-mail
21Xref: news.012.net.il comp.lang.awk:21835
22
23Thanks for your help there Michael. I wouldn't have thought of that one
24myself without your help :-)
25
26Anyway - for those who must stick with Cygwin here's a method that
27works using the mingw32 makefiles and some modifications:
28
29Basically you need to extract all exportable symbol names from the
30gawk.exe file into a text file and then create a dummy library file
31which we can link against on Cygwin. You then throw the library file
32away because in reality we use the gawk.exe file as the provider of
33those functions.
34
351. First grab the gawk source, e.g. gawk-3.1.4.tar.bz2 and decompress
36it.
372. Move to the gawk-3.1.4 directory you just created.
383. cp pc/* . (copy the pc directory into the main one)
394. edit makefile - uncomment lines "DYN_FLAGS", "DYN_EXP", "DYN_OBJ"
40and "DYN_MAKEXP=$(DMEmingw32)
415. make mingw32 (make a gawk.exe)
426. run "gcc -o gawk.exe array.o builtin.o eval.o field.o gawkmisc.o
43io.o main.o ext.o msg.o node.o profile.o re.o version.o dlfcn.o
44gawk.exp awkgram.o getid.o popen.o getopt.o getopt1.o dfa.o regex.o
45random.o" (i.e. remove the -s from the compile command from the
46makefile so the symbols are left in gawk.exe)
47
48now export all symbols from gawk.exe into foo.def so that we can put
49these in our library
507. echo EXPORTS > foo.def
518. nm gawk.exe | grep -E ' [TBD] _' | sed 's/.* [TBD] _//' >> foo.def
529. cp foo.def gawkw32.def
53
54build the new library with all symbols included
5510. make mingw32
56
57Now you will see a file "libgawk.a" which you can link against to
58create extensions. For example to build an extension called "file" run:
59
60gcc -shared -dll -DHAVE_CONFIG_H -I . extension/file.c -o file.dll -L .
61-lgawk
62
63Then you can load it in gawk using the expression:
64
65extension("./file.dll", "dlload");
66
67You must use the gawk you compiled from source though. It won't work
68with any other gawk unfortunately :-( But that's OK because the
69stripped gawk is not too big in size.
70
71Cheers,
72Dave.
73
74Michael Heiming wrote:
75> In comp.lang.awk David Smith <[email protected]>:
76> > Has anyone managed to compile gawk extensions (such as "filefuncs")
77> > under Cygwin?
78>
79> Solution is pretty simple, install a real OS, Linux/*BSD or any
80> other unix and this and further problems won't happen.
81>
82> Good luck
83>
84> --
85> Michael Heiming (X-PGP-Sig > GPG-Key ID: EDD27B94)
86> mail: echo [email protected] | perl -pe 'y/a-z/n-za-m/'
87> #bofh excuse 242: Software uses US measurements, but the OS
88> is in metric...
Note: See TracBrowser for help on using the repository browser.