 
Subject
Windows users are at a disadvantage
in the open source environment
becase they are not used to compiling programs. The idea of recompiling
the NT kernel just simply doesn't cross the mind of a typical MCSE.
Programs are usually shipped precompiled. In the *nix world it is
routine to download the source code for a program and compile it.
There is less of a security risk if you can avoid precompiled binaries
and compile your own. Imagine using a precompiled binary of Perl
on a public Web server! Yet this is exactly what the majority of
NT administrators would do in our estimation. Also, when you compile
your own binaries, you have more control over the configuration and features.
sp;
This article will delve into compiling two open source programs available
on the web: VIM, and Perl.
Cygnus has a a most fabulous compiler for win32 called Cygwin.
This is an opensource compiler that is free if you abide by GNU licensing
when distributing apps compiled with cygwin. Another cool thing is that
it comes with a bash shell and other *nix utilities. Download it here:
http://sourceware.cy
gnus.com/cygwin/download.html.
Here is the FAQ on Cygwin:
http://sourceware.cygnus.
com/cygwin/faq/
The newest version of Cygwin is installed via an application you download (se
tup.exe) which then downloads the packages via the internet. We like to then zip up all the packages so we don't have to re-download the packages for different
systems.
We are ready to rock, or have a bash at least. : )
Here is a list of GNU FTP mirrors, where you can get some source code:
http://www.gnu.org/order/ftp.htm
l
First, let's build a nice game
of go:
Let's go out to our Cygwin bash shell and extract/compile. Most
of the source code out there is distributed using tar and gzip. If
you have a compiler and just want tar, gzip, and vim precompiled, here
are some files that fit on one floppy that are completely free and will
install VIM 5.0, tar, gzip, and cwsdpmi on Windows95/98 or NT machines.
Cwsdpmi is for machines without dpmi. Just put a floppy in a: and run install.bat.
cwsdpmi.gz
distfp.tgza href="http://www.coprolite.com/vistuff/i386/tar.gz">tar.gz. When
you are hacking on *nix source files, notepad, in addition to many other
shortfalls, doesn't deal with cr/lf issues the same way, so you end up
with garbled text.
Back to cygwin and the bash shell. ls lists the files in the directory,
the x option for tar extracts the archive, the z option
uses gzip on it first to decompress, and f signifies that a filename
will be specified.
bash-2.03$ cd //d/src
bash-2.03$ ls
gnugo-1_2_tar.gz
bash-2.03$ tar -xzf *.gz
bash-2.03$ ls
gnugo &
nbsp;
gnugo-1_2_tar.gz
bash-2.03$ cd gnugo
bash-2.03$ ls
COPYING endgame.c &
nbsp;
findsavr.c gnugo.mak
patterns.h
ChangeLog eval.c
bsp;
findwinr.c initmark.c sethand.c<
/tt>
Documentation exambord.c fioe.c
;
main.c showbord.c
Makefile findcolr.c
;
genmove.c matchpat.c
showinst.c
README findnext.c &
nbsp;
getij.c objs
bsp;
suicide.c
count.c findopen.c
getmove.c opening.c
countlib.c findpatn.c
gnugo.h openregn.c
bash-2.03$
The README just says to run make, so...
bash-2.03$ make
gcc -O -c count.c -o count.o
gcc -O -c countlib.c -o countlib.o
gcc -O -c endgame.c -o endgame.o
gcc -O -c eval.c -o eval.o
gcc -O -c exambord.c -o exambord.o
gcc -O -c findcolr.c -o findcolr.o
gcc -O -c findnext.c -o findnext.o
gcc -O -c findopen.c -o findopen.o
gcc -O -c findpatn.c -o findpatn.o
gcc -O -c findsavr.c -o findsavr.o
gcc -O -c findwinr.c -o findwinr.o
gcc -O -c fioe.c -o fioe.o
gcc -O -c genmove.c -o genmove.o
gcc -O -c getij.c -o getij.o
gcc -O -c getmove.c -o getmove.o
gcc -O -c initmark.c -o initmark.o
gcc -O -c main.c -o main.o
gcc -O -c matchpat.c -o matchpat.o
gcc -O -c opening.c -o opening.o
gcc -O -c openregn.c -o openregn.o
gcc -O -c sethand.c -o sethand.o gcc -O -c showbord.c -o showbord.o
gcc -O -c showinst.c -o showinst.o
gcc -O -c suicide.c -o suicide.o
gcc count.o countlib.o endgame.o eval.o exambord.o findcolr.o findnext.o fin
dopen.o findpatn.o findsavr.o findwinr.o fioe.o genmove.o getij.o getmove.o init
mark.o main.o matchpat.o opening.o openregn.o sethand.o showbord.o showinst.o su
icide.o -o gnugo
/bin/rm -f *.o
bash-2.03$ ./gnugo.exe
Type ./gnugo.exe to run the compiled program and all is happy.
Most programs terminate with ctrl-c. Here is a "screen shot":
your move? c2
my move: K4
A B C D E F G H J K L M N O P Q R S T
19 - - - - - - - - - - - - - - - - - - -19
18 - - - - - - - - - - - - - - - - - - -18
17 - - - X - - - - - - - - - - - - - - -17
16 - - - X - - - - - O - - - - O + O - -16
Your color: Black X
15 - - - - - - - - - - - - - - - - - - -15
My color: White O 14 - - - - - - - - - - - - - - - - - - -14
13 - - - - - - - - - - - - - - - - - - -13
12 - - - - - - - - - - - - - - - - - - -12
11 - - - - - - - - - - - - - - - - - - -11
You have captured 2 pieces
10 - - - + - - - - - + - - - - - + - - -10
I have captured 0 pieces
9 - - - - - - - - - - - - - - - - - - - 9
8 - - - - - - - - - - - - - - - - - - - 8
7 - - - - - - - - - - - - - - - - - - - 7
6 - - - - - - - - - - - - - - - - - - - 6
5 - - - O - - - - - - - - - - - - - - - 5
4 - - X X - - - - - O - - - - O + - - - 4
3 - X - - X - - - - - - - - - - - - - - 3
2 - - X X - - - - - - - - - - - - - - - 2
1 - - - - - - - - - - - - - - - - - - - 1
A B C D E F G H J K L M N O P Q R S T
your move?
We could really use a nice editor for hacking on our makefiles, etc.
Let's try compiling VIM with Microsoft
Visual C++. I have a distribution of DJGPP
tools, which is why I use ls from the DOS prompt. We need two files:
ftp://ftp.vim.org/pub/vi
m/pc/vim53src.zip
ftp://ftp.vim.org/pub/vim
/pc/vim53rt.zip
D:srcvim-5.3>cd src
D:srcvim-5.3src>ls
Gvim_vc.mak ex_docmd.c
bsp;
if_python.c os_w32dll.c
testdir
INSTALL.pc ex_getln.c
sp;
iid_ole.c os_w32exe.c
;
tools.bmp
Makefile.bcc farsi.c
p;
keymap.h os_win32.c &
nbsp;
typemap
Makefile.bor farsi.h
p; macros.h os_win32.h &
nbsp;
ui.c
Makefile.cyg feature.h
bsp;
main.c proto
bsp;
undo.c
Makefile.djg fileio.c
sp;
mark.c proto.h
version.c
Makefile.dos getchar.c
bsp;
memfile.c quickfix.c
version.h
Makefile.w32 globals.h
bsp;
memline.c regexp.c
bsp;
vim.defmisc1.c screen.c
p;
vim.ico
charset.c gui_w32.c
;
misc2.c search.c
p;
vim.rc
ctags
gui_w32_rc.h multbyte.c
structs.h vim.tlb
digraph.c if_ole.INSTALL
normal.c style
vim_alert.ico
dlldata.c if_ole.cpp
p;
ops.c syntax.c
vim_error.ico
dosinst.c if_ole.h
option.c tag.c
vim_info.ico
edit.c if_ole.idl&
nbsp;
option.h tearoff.bmp
vim_quest.ico
eval.c if_ole_vc.m
ak
os_dos.h term.c
;
vimrun.c
ex_cmds.c if_perl.xs
p;
os_msdos.c term.h
sp;
window.c
ex_cmds.h if_perlsfio.c
os_msdos.h termlib.c
xxd
D:srcvim-5.3src>vcvars32 Setting environment for using Microsoft Visual C++ tools.
D:srcvim-5.3src>nmake -f Makefile.w32
That is all you need to do to compile. You can then run install.exe
to install it. Whatever you like.
We used Microsoft Visual C++ 6.0 to compile Perl, and it was fairly
straightforward. The standard Perl source: http://www.perl.com/CPAN-local/src/stable.tar.gz
At the time of this article, this was 5.005_03. Make sure you read
README.win32. Just edit the Makefile in the win32 subdirectory and
type nmake, then nmake test. You can't compile this on Windows 95/98.
;
You need NT because it's command shell is better. There is a rumor
that the 4DOS shell *will* let you compile on 95/98.
The newest perl source seems to compile just fine on the lastest Cygwin distrib
ution.
There are many ports of *nix programs to cygwin:
http://www.student.uni-koe
ln.de/cygwin/
We really like the Cygwin project and plan on lurking there a lot and
tracking the various ports of software. We hope you enjoyed our romp through compiling gnugo, VIM, and Perl
as much as we did. We tip our hat to Richard
Stallman, who made the GNU world order we see today.
| People: | |
| Places: | |
| Things: | |
| Times: | |
|
|