MAINTAINERCLEANFILES tweaks to remove some of the machine generated files
[geda-gaf.git] / README.win32
blob3deb8e632872b794a8ebbc29651a4004595dc66e
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  
126   Any VERSION >= 20020527 should build under MinGW.
128 2) Install MSYS by running:
130         MSYS-1.0.7-i686-2.exe
132 3) Double click on the Msys icon on the desktop to get a shell (bash prompt)
134 4) Install Mingw (the compilers, development environment, and libraries)
135         % cd /
136         % mkdir mingw
137         % cd mingw      !! This step is important; do not untar in / !!
138         % tar xvfz MinGW-1.1.tar.gz
140    Unzip the other .zip files using winzip or use the .tar.gz I provided.
141    If you decide to unzip the .zip files, then unzip directly into
142    c:/msys/1.0/mingw (the mingw directory).
144         % cd /mingw     !! This step is important; do not untar into / !!
145         % tar xvfz zlib-1.1.3-1.tar.gz
146         % tar xvfz readline-4.2-20010727.tar.gz
147         % tar xvfz regex-0.12-20010123.tar.gz
148         % tar xvfz rx-1.5-20010502.tar.gz
149         % tar xvfz libpng-1.0.6-20000724.tar.gz 
150         % tar xvfz libpng-devel-1.0.6-20000724.tar.gz
151         % cd bin
152         % mv make.exe makeold.exe
154    Doing the last step is very important.  The make.exe in /mingw/bin is 
155 quite pathetic.
157    You may see an error message like doing the untar operations:
159 tar: Child died with signal 13
160 tar: Error exit delayed from previous errors
162    I checked and all the files untarred okay, your milage may vary.
164 5) Build a test program (like hellow) to test the compilers
165    You can use vi to input the code or your favorite editor.
167 --- Cut here for hellow.c ---
168 #include <stdio.h>
171 main(int argc, char **argv)
173    printf("Hello World!\n");
174    return 0;
176 --- Cut here for hellow.c ---
178    Build it like this: 
179         % gcc -o hellow hellow.c
180    Run it: 
181         % ./hellow  
183    If this does not work.  Do not continue until you have fixed any problems.
185 6) Create the destination install directory
186         % mkdir c:/geda
187         % ls c:/geda
189 7) Add c:/geda/bin to your path in your msys shell
191         % export PATH=/c/geda/bin:$PATH
193         Use /c/... not c:/...
195 8) Build guile-1.4.1-gaf
197    guile-1.4.1-gaf is a hacked version of guile-1.4.1 for gEDA/gaf 
198    and the Mingw port.  Please don't use it unless you are building gEDA/gaf.
199    For the real thing (real guile), please see http://www.gnu.org
201    Make sure you have installed all the *.tar.gz library files mentioned
202    above before doing this step. 
204         % cd
205         % tar xvfz guile-1.4.1-gaf.tar.gz
206         % cd guile-1.4.1-gaf
207         % ./configure --prefix=c:/geda --enable-posix --enable-regex --without-modules --enable-guile-debug --without-threads --disable-networking --enable-ltdl-convenience 
208         % cd libltdl 
210         Edit the Makefile in libltdl searching for -I. change one of these to
211         -I.. (two periods, parent directory; this fixes the "cannot find 
212         libguile.h").
214         % make
215         % cd ../ice-9
216         % make install
218         You might get an error about and-let-star.scm or and-let-*.scm; 
219         I ignored it.
221         % cd ../guile-config
222         % cp guile-config.geda guile-config
223         % cd ../libguile
224         % make libpath.h
225         % make -f Makefile.Win32 install
227    Guile errors and workarounds.  You may or may not see these.
229         * ./configure error:
231 checking whether make sets ${MAKE}..... ./configure: eval: line 1: unexpected EOF while looking for matching `"'
232 ./configure: eval: line 2: syntax error: unexpected end of file
234         I ignored it. :-)
235         
236 9) Post guile install steps and test
238    Copy a few dlls into c:\geda\bin
239         
240         % cd /mingw/bin
241         % cp librx.dll c:/geda/bin
242         % cp libreadline.dll c:/geda/bin
243         % cp libregex.dll c:/geda/bin
244         % cp libz.dll c:/geda/bin
245         % cp libpng.2.1.dll c:/geda/bin 
247         Make sure that libguile.dll got installed in c:\geda\bin
249    Open up a cmd shell (dos command box) and do the following:
251         Add c:/geda/bin to your path:
252         c:\> set PATH=%PATH%;c:\geda\bin 
253         c:\> guile.exe
255    At this point you should see a guile> prompt.
256   
257         guile> (display "Hello World!") (newline)
258         guile> (quit)
260    Try building a very basic guile program:
262 -- Cut here for gtest.c --
263 #include <guile/gh.h>
265 void main_prog(int argc, char *argv[])
267   scm_shell(argc, argv);
271 main(int argc, char **argv)
273   gh_enter(argc, argv, main_prog);
274   return 0;
277 -- Cut here for gtest.c --
279    Build it like this:
281    % gcc -o gtest gtest.c `guile-config compile` `guile-config link`
283    Run it:
285    % ./gtest
286    guile> (display "gtest") (newline)
287    guile> (quit)
289    If the above steps do not work, please go back and get this working,
290    otherwise the following steps will not work either.
293 10) Untar gtk
295         % cd $HOME
296         % tar xvfz gtk+-1.3.0-20020313-gaf.tar.gz
298    This will create $HOME/gtk.  If you untar in a different location you 
299    will need to change gtk/bin/gtk-config and gtk/bin/glib-config. 
301    gtk+-1.3.0-20020313-gaf.tar.gz is a repackaged version of Tor Lillqvist's 
302    "gtk+ for Win32".  I (Ales) repackaged to make build life easier for
303    gEDA/gaf users.  Without Tor's work, gEDA/gaf - MinGW would NOT
304    be possible.
306         % cd gtk/lib
307         % cp *.dll c:/geda/bin
308         % cd ../bin
309         % cp gtk-config glib-config c:/geda/bin
311 11) Test gtk
313         Use the following test program (ghellow.c) to test gtk on your system.
314 (This test program came from the gtk-1.2 tutorial, helloworld.c)  You can
315 find ghellow.c in $HOME/gtk. 
317 -- Cut here for ghellow.c -- 
318       #include <gtk/gtk.h>
320       /* This is a callback function. The data arguments are ignored
321        * in this example. More on callbacks below. */
322       void hello( GtkWidget *widget,
323                   gpointer   data )
324       {
325           g_print ("Hello World\n");
326       }
328       gint delete_event( GtkWidget *widget,
329                          GdkEvent  *event,
330                          gpointer   data )
331       {
332           /* If you return FALSE in the "delete_event" signal handler,
333            * GTK will emit the "destroy" signal. Returning TRUE means
334            * you don't want the window to be destroyed.
335            * This is useful for popping up 'are you sure you want to quit?'
336            * type dialogs. */
338           g_print ("delete event occurred\n");
340           /* Change TRUE to FALSE and the main window will be destroyed with
341            * a "delete_event". */
343           return(TRUE);
344       }
346       /* Another callback */
347       void destroy( GtkWidget *widget,
348                     gpointer   data )
349       {
350           gtk_main_quit();
351       }
353       int main( int   argc,
354                 char *argv[] )
355       {
356           /* GtkWidget is the storage type for widgets */
357           GtkWidget *window;
358           GtkWidget *button;
359           
360           /* This is called in all GTK applications. Arguments are parsed
361            * from the command line and are returned to the application. */
362           gtk_init(&argc, &argv);
363           
364           /* create a new window */
365           window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
366           
367           /* When the window is given the "delete_event" signal (this is given
368            * by the window manager, usually by the "close" option, or on the
369            * titlebar), we ask it to call the delete_event () function
370            * as defined above. The data passed to the callback
371            * function is NULL and is ignored in the callback function. */
372           gtk_signal_connect (GTK_OBJECT (window), "delete_event",
373                               GTK_SIGNAL_FUNC (delete_event), NULL);
374           
375           /* Here we connect the "destroy" event to a signal handler.  
376            * This event occurs when we call gtk_widget_destroy() on the window,
377            * or if we return FALSE in the "delete_event" callback. */
378           gtk_signal_connect (GTK_OBJECT (window), "destroy",
379                               GTK_SIGNAL_FUNC (destroy), NULL);
380           
381           /* Sets the border width of the window. */
382           gtk_container_set_border_width (GTK_CONTAINER (window), 10);
383           
384           /* Creates a new button with the label "Hello World". */
385           button = gtk_button_new_with_label ("Hello World");
386           
387           /* When the button receives the "clicked" signal, it will call the
388            * function hello() passing it NULL as its argument.  The hello()
389            * function is defined above. */
390           gtk_signal_connect (GTK_OBJECT (button), "clicked",
391                               GTK_SIGNAL_FUNC (hello), NULL);
392           
393           /* This will cause the window to be destroyed by calling
394            * gtk_widget_destroy(window) when "clicked".  Again, the destroy
395            * signal could come from here, or the window manager. */
396           gtk_signal_connect_object (GTK_OBJECT (button), "clicked",
397                                      GTK_SIGNAL_FUNC (gtk_widget_destroy),
398                                      GTK_OBJECT (window));
399           
400           /* This packs the button into the window (a gtk container). */
401           gtk_container_add (GTK_CONTAINER (window), button);
402           
403           /* The final step is to display this newly created widget. */
404           gtk_widget_show (button);
405           
406           /* and the window */
407           gtk_widget_show (window);
408           
409           /* All GTK applications must have a gtk_main(). Control ends here
410            * and waits for an event to occur (like a key press or
411            * mouse event). */
412           gtk_main ();
413           
414           return(0);
415       }
416 -- Cut here for ghellow.c -- 
418    Build it:
420         % gcc -o ghellow ghellow.c `gtk-config --cflags --libs`
422    Run it:
423         
424         % ./hellow
426    If it fails to run, the fix the problem before continuing.  As usual, if
427    the test program does not link and run, then you will NOT be able to build
428    and run gEDA/gaf.
430 12) Build and install libstroke into /mingw
432     Build and install libstroke if you want stroke support in gschem.
434         % tar xvfz libstroke-0.5.1.tar.gz
435         % cd libstroke-0.5.1
437         Edit configure script commenting out the following:
439 #if test "$X11LIB" = no; then
440 #        { echo "configure: error: Cannot find -lX11 library" 1>&2; exit 1; }
443         % ./configure --prefix=/mingw --disable-gtktest --disable-tcl
444         % cd libstroke
445         % make install
447         Install libstroke into /mingw and not c:/geda since it will make 
448 gEDA/gaf's build much easier.
450 13) Build/install gEDA/gaf itself
452     Untar all of the gEDA/gaf tarballs into a directory.
453     Put that Makefile into this toplevel directory.
455     Edit the Makefile so that: 
457 CD_VERSION=-$(VERSION)
458 DIR_PREFIX=geda-
460     is commented in.  And that the prefix in the Makefile is set to:
462 prefix=c:/geda
464     Also make sure the VERSION variable is correct.
466     Start the build:
468         % make install
470     You may see the following errors:
472         * ./configure error:
474 checking whether make sets ${MAKE}..... ./configure: eval: line 1: unexpected EOF while looking for matching `"'
475 ./configure: eval: line 2: syntax error: unexpected end of file
477         I ignored it everytime.
478         
479    The symbols are installed twice for some odd reason.
481    If everything completes okay (no FATAL errors), then 
482 gEDA/gaf - MinGW has build successfully.  Congratulations.
485 --------------------------------------------------------------------------
486    The MinGW port has been brought to you by many many months of work, 
487 several crashed Windows machines (seriously), and a few close calls where
488 I almost gave up on the port. :->