Add dependency.
[geda-gaf/berndj.git] / README.win32
blob259482359d41f40efd89f2f2910d309a672c1a76
1 gEDA / gaf - MinGW
3 GPL Electronic Design Automation  
4 --------------------------------------------------------------------------
5 To run the binary distribution of gEDA/gaf - MinGW:
7 Remove any previous version of gEDA/gaf - Cygwin (or older build of the
8 mingw version).
10 You should not have to install anything else other than the .zip or .exe for 
11 gEDA/gaf.  gEDA/gaf - MinGW is fairly self contained.
13 1) Grab geda-mingw32-VERSION.zip and unzip it into c:\   At this stage
14    in the game, it really should be in c:\  Unzipping the zip file
15    should create a directory called "geda" (c:\geda)
17 2) Set the following environment variables:
18         TMP     (some temp directory, say C:\TEMP , make sure this dir exists)
19         HOME    (some home directory, say C:\ , make sure this dir exists)
21 3) Add c:\geda\bin to your PATH variable
23 4) Run gschem by typing: gschem  in a cmd window.  It should run.  If not
24    please e-mail ahvezda@geda.seul.org with the error message.  You can
25    also create a shortcut on the desktop to the binary, just change the
26    Run option to run "minimized" if you don't want to see the console.
28 Please keep in mind that this port is really new and may do really
29 stupid things.  PLEASE BACKUP ANY DATA YOU VALUE.  gEDA/gaf - MinGW
30 (or any gEDA software) comes with NO WARRANTY (I hate having to say this).
31 Please let me know if there are any problems.
33 ---------------------------------------------------------------------------
34 Recommended (but optional if you install into c:\geda)
35 Required (if you install into some other directory than c:\geda)
37 If you want to put the geda directory somewhere else, then you can do
38 that too, but you will need to set the environment variable:
40 GEDADATA 
41 to 
42 [new_path_to_geda]\geda\share\gEDA       
44 Examples:
45 set GEDADATA=c:\gnu\geda\share\gEDA
46 set GEDADATA=d:\geda\share\gEDA
48 Do not forget to put [new_path_to_geda]\geda\bin into 
49 your PATH.  You also need to set: 
51 GUILE_LOAD_PATH 
52 to 
53 [new_path_to_geda]\geda\share\guile\1.4.1
55 Getting these environment variables right is best done by trial and error.
56 You will know when you got it right when 1) gschem starts and doesn't 
57 complain, and 2) you can place components (via Add/Component...).
59 --------------------------------------------------------------------------
60 The rest of this readme describes how to build gEDA/gaf (gschem and
61 friends) on a win32 machine (WinNT/Win2K/WinXP).  It uses mingw32 as the
62 layer between win32 and the unix world (ie gcc, make etc...).
63 A useful reference to various porting issues is:
64 http://gnuwin32.sourceforge.net/compile.html
66 gEDA/gaf should build and run out of the box if you follow these
67 instructions.  
69 * If any part of this document is unclear, please post on geda-dev. 
70 * If any part of this document is wrong, please post on geda-dev. 
71 * If you are not familiar with compiling programs, please use a 
72   binary distribution of gEDA/gaf - MinGW.
74 It is recommend that gEDA/gaf and all libraries are installed into c:/geda
75 If you want an alternative location, make sure all dependancies are installed
76 into the new location as well.
78 For this doc, a "%" is the bash shell prompt from msys.
79 Build instructions for gEDA/gaf - MinGW (gEDA running on Win32 machines)
81 But first an important warning:
83 These instructions assume the user has a significant amount of knowledge
84 of build unix programs under mingw32.  You need to be familiar with
85 the ./configure process, installing mingw32 properly, and resolving the
86 occasional build bug.
88 --------------------------------------------------------------------------
90 1) Download:
92    Build environment
93         * MSYS-1.0.7-i686-2.exe (http://www.mingw.org)
94                                 (use the proper ?86 version for your CPU!)
95         * MinGW-1.1.tar.gz      (http://www.mingw.org)
97    External libraries part of build environment
98         * zlib-1.1.3-1.zip      (https://sourceforge.net/projects/mingwrep/)
99         * readline-4.2-20010727.zip
100         * regex-0.12-20010123.zip
101         * rx-1.5-20010502.zip
102         * libpng-1.0.6-20000724.zip 
103         * libpng-devel-1.0.6-20000724.zip
104                   ---OR---
105         Grab the corresponding .tar.gz files for the above .zips from:
106         http://www.geda.seul.org/devel/win32/build
107         
108   gEDA/gaf guile library (from http://www.geda.seul.org/devel/win32/mingw)
109         guile-1.4.1-gaf.tar.gz  
111   gEDA/gaf gtk/glib libs (from http://www.geda.seul.org/devel/win32/mingw)
112         gtk+-1.3.0-20020313-gaf.tar.gz  
114   gEDA/gaf itself (http://www.geda.seul.org/devel)
115         geda-gnetlist-VERSION.tar.gz
116         geda-gschem-VERSION.tar.gz
117         geda-gsymcheck-VERSION.tar.gz
118         geda-symbols-VERSION.tar.gz
119         geda-utils-VERSION.tar.gz
120         libgeda-VERSION.tar.gz
121         Makefile
123   gEDA/gaf optional libraries (http://www.geda.seul.org/dist)
124         libstroke-0.5.1.tar.gz  
125         libgdgeda-1.8.tar.gz 
127   Any VERSION >= 20020527 should build under MinGW.
129 2) Install MSYS by running:
131         MSYS-1.0.7-i686-2.exe
133 3) Double click on the Msys icon on the desktop to get a shell (bash prompt)
135 4) Install Mingw (the compilers, development environment, and libraries)
136         % cd /
137         % mkdir mingw
138         % cd mingw      !! This step is important; do not untar in / !!
139         % tar xvfz MinGW-1.1.tar.gz
141    Unzip the other .zip files using winzip or use the .tar.gz I provided.
142    If you decide to unzip the .zip files, then unzip directly into
143    c:/msys/1.0/mingw (the mingw directory).
145         % cd /mingw     !! This step is important; do not untar into / !!
146         % tar xvfz zlib-1.1.3-1.tar.gz
147         % tar xvfz readline-4.2-20010727.tar.gz
148         % tar xvfz regex-0.12-20010123.tar.gz
149         % tar xvfz rx-1.5-20010502.tar.gz
150         % tar xvfz libpng-1.0.6-20000724.tar.gz 
151         % tar xvfz libpng-devel-1.0.6-20000724.tar.gz
152         % cd bin
153         % mv make.exe makeold.exe
155    Doing the last step is very important.  The make.exe in /mingw/bin is 
156 quite pathetic.
158    You may see an error message like doing the untar operations:
160 tar: Child died with signal 13
161 tar: Error exit delayed from previous errors
163    I checked and all the files untarred okay, your milage may vary.
165 5) Build a test program (like hellow) to test the compilers
166    You can use vi to input the code or your favorite editor.
168 --- Cut here for hellow.c ---
169 #include <stdio.h>
172 main(int argc, char **argv)
174    printf("Hello World!\n");
175    return 0;
177 --- Cut here for hellow.c ---
179    Build it like this: 
180         % gcc -o hellow hellow.c
181    Run it: 
182         % ./hellow  
184    If this does not work.  Do not continue until you have fixed any problems.
186 6) Create the destination install directory
187         % mkdir c:/geda
188         % ls c:/geda
190 7) Add c:/geda/bin to your path in your msys shell
192         % export PATH=/c/geda/bin:$PATH
194         Use /c/... not c:/...
196 8) Build guile-1.4.1-gaf
198    guile-1.4.1-gaf is a hacked version of guile-1.4.1 for gEDA/gaf 
199    and the Mingw port.  Please don't use it unless you are building gEDA/gaf.
200    For the real thing (real guile), please see http://www.gnu.org
202    Make sure you have installed all the *.tar.gz library files mentioned
203    above before doing this step. 
205         % cd
206         % tar xvfz guile-1.4.1-gaf.tar.gz
207         % cd guile-1.4.1-gaf
208         % ./configure --prefix=c:/geda --enable-posix --enable-regex --without-modules --enable-guile-debug --without-threads --disable-networking --enable-ltdl-convenience 
209         % cd libltdl 
211         Edit the Makefile in libltdl searching for -I. change one of these to
212         -I.. (two periods, parent directory; this fixes the "cannot find 
213         libguile.h").
215         % make
216         % cd ../ice-9
217         % make install
219         You might get an error about and-let-star.scm or and-let-*.scm; 
220         I ignored it.
222         % cd ../guile-config
223         % cp guile-config.geda guile-config
224         % cd ../libguile
225         % make libpath.h
226         % make -f Makefile.Win32 install
228    Guile errors and workarounds.  You may or may not see these.
230         * ./configure error:
232 checking whether make sets ${MAKE}..... ./configure: eval: line 1: unexpected EOF while looking for matching `"'
233 ./configure: eval: line 2: syntax error: unexpected end of file
235         I ignored it. :-)
236         
237 9) Post guile install steps and test
239    Copy a few dlls into c:\geda\bin
240         
241         % cd /mingw/bin
242         % cp librx.dll c:/geda/bin
243         % cp libreadline.dll c:/geda/bin
244         % cp libregex.dll c:/geda/bin
245         % cp libz.dll c:/geda/bin
246         % cp libpng.2.1.dll c:/geda/bin 
248         Make sure that libguile.dll got installed in c:\geda\bin
250    Open up a cmd shell (dos command box) and do the following:
252         Add c:/geda/bin to your path:
253         c:\> set PATH=%PATH%;c:\geda\bin 
254         c:\> guile.exe
256    At this point you should see a guile> prompt.
257   
258         guile> (display "Hello World!") (newline)
259         guile> (quit)
261    Try building a very basic guile program:
263 -- Cut here for gtest.c --
264 #include <guile/gh.h>
266 void main_prog(int argc, char *argv[])
268   scm_shell(argc, argv);
272 main(int argc, char **argv)
274   gh_enter(argc, argv, main_prog);
275   return 0;
278 -- Cut here for gtest.c --
280    Build it like this:
282    % gcc -o gtest gtest.c `guile-config compile` `guile-config link`
284    Run it:
286    % ./gtest
287    guile> (display "gtest") (newline)
288    guile> (quit)
290    If the above steps do not work, please go back and get this working,
291    otherwise the following steps will not work either.
294 10) Untar gtk
296         % cd $HOME
297         % tar xvfz gtk+-1.3.0-20020313-gaf.tar.gz
299    This will create $HOME/gtk.  If you untar in a different location you 
300    will need to change gtk/bin/gtk-config and gtk/bin/glib-config. 
302    gtk+-1.3.0-20020313-gaf.tar.gz is a repackaged version of Tor Lillqvist's 
303    "gtk+ for Win32".  I (Ales) repackaged to make build life easier for
304    gEDA/gaf users.  Without Tor's work, gEDA/gaf - MinGW would NOT
305    be possible.
307         % cd gtk/lib
308         % cp *.dll c:/geda/bin
309         % cd ../bin
310         % cp gtk-config glib-config c:/geda/bin
312 11) Test gtk
314         Use the following test program (ghellow.c) to test gtk on your system.
315 (This test program came from the gtk-1.2 tutorial, helloworld.c)  You can
316 find ghellow.c in $HOME/gtk. 
318 -- Cut here for ghellow.c -- 
319       #include <gtk/gtk.h>
321       /* This is a callback function. The data arguments are ignored
322        * in this example. More on callbacks below. */
323       void hello( GtkWidget *widget,
324                   gpointer   data )
325       {
326           g_print ("Hello World\n");
327       }
329       gint delete_event( GtkWidget *widget,
330                          GdkEvent  *event,
331                          gpointer   data )
332       {
333           /* If you return FALSE in the "delete_event" signal handler,
334            * GTK will emit the "destroy" signal. Returning TRUE means
335            * you don't want the window to be destroyed.
336            * This is useful for popping up 'are you sure you want to quit?'
337            * type dialogs. */
339           g_print ("delete event occurred\n");
341           /* Change TRUE to FALSE and the main window will be destroyed with
342            * a "delete_event". */
344           return(TRUE);
345       }
347       /* Another callback */
348       void destroy( GtkWidget *widget,
349                     gpointer   data )
350       {
351           gtk_main_quit();
352       }
354       int main( int   argc,
355                 char *argv[] )
356       {
357           /* GtkWidget is the storage type for widgets */
358           GtkWidget *window;
359           GtkWidget *button;
360           
361           /* This is called in all GTK applications. Arguments are parsed
362            * from the command line and are returned to the application. */
363           gtk_init(&argc, &argv);
364           
365           /* create a new window */
366           window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
367           
368           /* When the window is given the "delete_event" signal (this is given
369            * by the window manager, usually by the "close" option, or on the
370            * titlebar), we ask it to call the delete_event () function
371            * as defined above. The data passed to the callback
372            * function is NULL and is ignored in the callback function. */
373           gtk_signal_connect (GTK_OBJECT (window), "delete_event",
374                               GTK_SIGNAL_FUNC (delete_event), NULL);
375           
376           /* Here we connect the "destroy" event to a signal handler.  
377            * This event occurs when we call gtk_widget_destroy() on the window,
378            * or if we return FALSE in the "delete_event" callback. */
379           gtk_signal_connect (GTK_OBJECT (window), "destroy",
380                               GTK_SIGNAL_FUNC (destroy), NULL);
381           
382           /* Sets the border width of the window. */
383           gtk_container_set_border_width (GTK_CONTAINER (window), 10);
384           
385           /* Creates a new button with the label "Hello World". */
386           button = gtk_button_new_with_label ("Hello World");
387           
388           /* When the button receives the "clicked" signal, it will call the
389            * function hello() passing it NULL as its argument.  The hello()
390            * function is defined above. */
391           gtk_signal_connect (GTK_OBJECT (button), "clicked",
392                               GTK_SIGNAL_FUNC (hello), NULL);
393           
394           /* This will cause the window to be destroyed by calling
395            * gtk_widget_destroy(window) when "clicked".  Again, the destroy
396            * signal could come from here, or the window manager. */
397           gtk_signal_connect_object (GTK_OBJECT (button), "clicked",
398                                      GTK_SIGNAL_FUNC (gtk_widget_destroy),
399                                      GTK_OBJECT (window));
400           
401           /* This packs the button into the window (a gtk container). */
402           gtk_container_add (GTK_CONTAINER (window), button);
403           
404           /* The final step is to display this newly created widget. */
405           gtk_widget_show (button);
406           
407           /* and the window */
408           gtk_widget_show (window);
409           
410           /* All GTK applications must have a gtk_main(). Control ends here
411            * and waits for an event to occur (like a key press or
412            * mouse event). */
413           gtk_main ();
414           
415           return(0);
416       }
417 -- Cut here for ghellow.c -- 
419    Build it:
421         % gcc -o ghellow ghellow.c `gtk-config --cflags --libs`
423    Run it:
424         
425         % ./hellow
427    If it fails to run, the fix the problem before continuing.  As usual, if
428    the test program does not link and run, then you will NOT be able to build
429    and run gEDA/gaf.
431 12) Build and install libstroke into /mingw
433     Build and install libstroke if you want stroke support in gschem.
435         % tar xvfz libstroke-0.5.1.tar.gz
436         % cd libstroke-0.5.1
438         Edit configure script commenting out the following:
440 #if test "$X11LIB" = no; then
441 #        { echo "configure: error: Cannot find -lX11 library" 1>&2; exit 1; }
444         % ./configure --prefix=/mingw --disable-gtktest --disable-tcl
445         % cd libstroke
446         % make install
448         Install libstroke into /mingw and not c:/geda since it will make 
449 gEDA/gaf's build much easier.
451 13) Build and install libgdgeda into c:/geda
453     Build and install libgdgeda if you want the ability to generate png images
454 from schematics in gschem.
456         % tar xvfz libgdgeda-1.8.tar.gz
458         Edit the Makefile to change:
459         ln -sf include gdgeda
460         to:
461         cp -rp include gdgeda
463         Edit configure script changing the string png_read_init to 
464         png_get_copyright
466 Example:
467 int main() {
468 png_get_copyright()
469 ; return 0; }
471         % ./configure --prefix=c:/geda
472         % make
473         % cd include
474         % make install
475         % cd ../src
476         % make install
477         % cd ..
478         % cp libgdgeda-config c:/geda/bin
480 14) Build/install gEDA/gaf itself
482     Untar all of the gEDA/gaf tarballs into a directory.
483     Put that Makefile into this toplevel directory.
485     Edit the Makefile so that: 
487 CD_VERSION=-$(VERSION)
488 DIR_PREFIX=geda-
490     is commented in.  And that the prefix in the Makefile is set to:
492 prefix=c:/geda
494     Also make sure the VERSION variable is correct.
496     Start the build:
498         % make install
500     You may see the following errors:
502         * ./configure error:
504 checking whether make sets ${MAKE}..... ./configure: eval: line 1: unexpected EOF while looking for matching `"'
505 ./configure: eval: line 2: syntax error: unexpected end of file
507         I ignored it everytime.
508         
509    The symbols are installed twice for some odd reason.
511    If everything completes okay (no FATAL errors), then 
512 gEDA/gaf - MinGW has build successfully.  Congratulations.
515 --------------------------------------------------------------------------
516    The MinGW port has been brought to you by many many months of work, 
517 several crashed Windows machines (seriously), and a few close calls where
518 I almost gave up on the port. :->