понедельник, 9 марта 2009 г.

итак: http://www.elart.it/links/harbourhowto_deb_en.php
-----------------------------------
Clipper on Linux!

Harbour Clipper

Small Debian, Ubuntu, Kubuntu howto: Dec 2008

How to install and compile Harbour on Ubuntu from SVN

Requested deb packages to compile Harbour
From terminal as root user: to get user access type sudo -i and after type the commands below:

apt-get update; apt-get install wget rcs build-essential ncurses-dev libslang2-dev tk8.3-dev libsqlxx-dev unixodbc-dev subversion

Harbour source from SVN trunk
1) - Open a terminal window gain root privileges with the: sudo -i command;
2) - Check the requested packages as specified on top of this page;
3) - Type into the terminal window:
cd /usr/src
svn co https://harbour-project.svn.sourceforge.net/svnroot/harbour-project/trunk harbour
cd /usr/src/harbour/harbour
export HB_BIN_INSTALL=/usr/bin/; export HB_LIB_INSTALL=/usr/lib/; export HB_INC_INSTALL=/usr/include/
chmod 700 make_gnu.sh
hbverfix
sh ./make_gnu.sh clean; sh ./make_gnu.sh; sh ./make_gnu.sh install
harbour -build


How to compile my first .prg?
Type or copy and paste into hello.prg the blue lines below:

function main()
do while .t.
setcolor("w/n")
clear screen
dummy:="N"
quadro(1,1,10,60)
@ 3,3 say "CIAO MONDO" color "w/r"
@ 4,3 say "Sono harbour ;-)" color "w/b"
@ 5,3 say "Vuoi terminare... ? "
@ row(), col()+1 get dummy picture "@K!"
read
if dummy=="S"
clear screen
quit
endif
@ 8,10 say "Ok non vuoi terminare"
inkey(2)
enddo
return nil

// -----------------------------
function quadro(ri,ci,rf,cf)
@ ri,ci clear to rf,cf
dispbox(ri,ci,rf,cf)
return nil

Save the file and after:
# harbour hello.prg -n -gh
a .rbh file will be created
Generating Harbour Portable Object output to 'hello.hrb'... Done.
to run it:
# hbrun hello

To really compile the prog on your Linux system with Harbour will made a simple shell script called bldlin.sh :

#!/bin/bash
# ---------------------------------------------------------------
# Template to build a final Harbour executable, using Harbour
# with the C code generation feature, then calling the proper C
# linker/compiler.
#
# Copyright 1999-2001 Viktor Szakats (viktor.szakats@syenar.hu)
# See doc/license.txt for licensing terms.
# ---------------------------------------------------------------
if [ -z "$HB_ARCHITECTURE" ]; then export HB_ARCHITECTURE=linux; fi
if [ -z "$HB_COMPILER" ]; then export HB_COMPILER=gcc; fi
if [ -z "$HB_GT_LIB" ]; then export HB_GT_LIB=; fi
if [ -z "$HB_BIN_INSTALL" ]; then
export HB_BIN_INSTALL=/usr/bin
fi
if [ -z "$HB_LIB_INSTALL" ]; then
export HB_LIB_INSTALL=/usr/lib/harbour
fi
if [ -z "$HB_INC_INSTALL" ]; then
export HB_INC_INSTALL=/usr/include/harbour
fi
if [ -z "$HB_ARCHITECTURE" ]; then
echo Error: HB_ARCHITECTURE is not set.
fi
if [ -z "$HB_COMPILER" ]; then
echo Error: HB_COMPILER is not set.
fi
if [ -z "$1" ] || [ -z "$HB_ARCHITECTURE" ] || [ -z "$HB_COMPILER" ]; then
echo
echo Usage: bldlin.sh filename
echo
echo Notes:
echo
echo " - 'filename' is the .prg filename *without* extension."
echo " - Don't forget to make a MAIN() function for you application."
echo " - This batch file assumes you are in some directory off the main"
echo " harbour directory."
echo " - Environment variables HB_ARCHITECTURE, HB_COMPILER,HB_GT_LIB"
echo " should be set. Setting HB_GT_LIB is optional."
echo " The following values are currently supported:"
echo
echo " HB_ARCHITECTURE:"
echo " - dos (HB_GT_LIB=gtdos by default)"
echo " - w32 (HB_GT_LIB=gtwin by default)"
echo " - linux (HB_GT_LIB=gtstd by default)"
echo " - os2 (HB_GT_LIB=gtos2 by default)"
echo
read
echo " HB_COMPILER:"
echo " - When HB_ARCHITECTURE=dos"
echo " - bcc16 (Borland C++ 3.x, 4.x, 5.0x, DOS 16-bit)"
echo " - djgpp (Delorie GNU C, DOS 32-bit)"
echo " - rxs32 (EMX/RSXNT/DOS GNU C, DOS 32-bit)"
echo " - watcom (Watcom C++ 9.x, 10.x, 11.x, DOS 32-bit)"
echo " - When HB_ARCHITECTURE=w32"
echo " - bcc32 (Borland C++ 4.x, 5.x, Windows 32-bit)"
echo " - gcc (Cygnus/Cygwin GNU C, Windows 32-bit)"
echo " - mingw32 (Cygnus/Mingw32 GNU C, Windows 32-bit)"
echo " - rxsnt (EMX/RSXNT/Win32 GNU C, Windows 32-bit)"
echo " - icc (IBM Visual Age C++, Windows 32-bit)"
echo " - msvc (Microsoft Visual C++, Windows 32-bit)"
echo " - When HB_ARCHITECTURE=linux"
echo " - gcc (GNU C, 32-bit)"
echo " - When HB_ARCHITECTURE=os2"
echo " - gcc (EMX GNU C, OS/2 32-bit)"
echo " - icc (IBM Visual Age C++ 3.0, OS/2 32-bit)"
echo
read
echo " HB_GT_LIB:"
echo " - gtstd (Standard streaming) (for all architectures)"
echo " - gtdos (DOS console) (for dos architecture)"
echo " - gtwin (Win32 console) (for w32 architecture)"
echo " - gtos2 (OS/2 console) (for os2 architecture)"
echo " - gtpca (PC ANSI console) (for all architectures)"
echo " - gtcrs (Curses console) (for linux, w32 architectures)"
echo " - gtsln (Slang console) (for linux, w32 architectures)"
exit
else
$HB_BIN_INSTALL/harbour $1.prg -n -i$HB_INC_INSTALL $2 $3 $HARBOURFLAGS
if [ "$HB_ARCHITECTURE" = "linux" ]; then
#if [ -z "$HB_GT_LIB" ]; then HB_GT_LIB=gtstd; fi
if [ -z "$HB_GT_LIB" ]; then HB_GT_LIB=gttrm; fi
if [ "$HB_COMPILER" = "gcc" ]; then

gcc -o$1 $1.c $CFLAGS -I$HB_INC_INSTALL -L$HB_LIB_INSTALL \
-Wl,--start-group -lhbvm -lhbrtl -lhbmacro -lhbcommon \
-lhblang -lhbcpage -lhbpp -lhbpcre -lhbzlib \
-lhbrdd -lrddntx -lrddcdx -lrddfpt -lhbsix \
-ldebug -lgttrm -lgtstd -lgtcgi -lgtpca \
-Wl,--end-group -lm

else
echo Error: HB_COMPILER value is unsupported.
fi
else
echo Error: HB_ARCHITECTURE value is unsupported.
unlink $1.c
fi
fi

After we must change the permission to the script:
# chmod 700 bldlin.sh
and we can run the script:
# ./bldlin.sh hello
and now we can run the:
# ./hello

N.B.: Linux is case sensitive, remember this, when you try to open a dbf file on a Linux filesystem.


To learn more:
To compile yours .prg you we suggest you to read the documents into the Harbour "doc" subdirectory:
"doc/howtomak.txt" and "doc/gmake.txt" and "bin/bld.sh".

Комментариев нет: