# # $Id$ # # --------------------------------------------------------------- # Copyright 2007 Przemyslaw Czerpak (druzus/at/priv.onet.pl), # Harbour-MinGW cross build RPM spec file # # See doc/license.txt for licensing terms. # --------------------------------------------------------------- ###################################################################### # Conditional build: # --with mysql - build mysql lib # --with pgsql - build pgsql lib # --with gd - build gd lib # --with allegro - build GTALLEG - Allegro based GT driver # --with ads - build ADS RDD # --with odbc - build odbc lib # --without nf - do not build nanforum lib ###################################################################### ###################################################################### ## Definitions. ###################################################################### %define name harbour-win %define version 1.1.0 %define releasen dev %define hb_pref hbw %define hb_ccpath /opt/xmingw/bin %define hb_ccpref i386-mingw- %define hb_host www.harbour-project.org %define readme README.RPM # Workaround for the problem of /usr/bin/strip not handling PE binaries. %define __strip %{hb_ccpath}/%{hb_ccpref}strip %define __objdump %{hb_ccpath}/%{hb_ccpref}objdump ###################################################################### ## Preamble. ###################################################################### Summary: Free software Clipper compatible compiler Summary(pl): Darmowy kompilator kompatybilny z językiem Clipper. Name: %{name} Version: %{version} Release: %{releasen} License: GPL (plus exception) Group: Development/Languages Vendor: %{hb_host} URL: http://%{hb_host}/ Source: harbour-%{version}.src.tar.gz Packager: Przemysław Czerpak (druzus/at/priv.onet.pl) BuildPrereq: gcc binutils bash Requires: gcc binutils bash sh-utils harbour = %{?epoch:%{epoch}:}%{version}-%{release} Provides: %{name} BuildRoot: /tmp/%{name}-%{version}-root %define _noautoreq 'libharbour.*' %description Harbour is a CA-Cl*pper compatible compiler for multiple platforms. This package includes a compiler, pre-processor, header files, virtual machine and libraries for creating MS-Windows application in Linux box using MinGW GCC port. %description -l pl Harbour to kompatybilny z językiem CA-Cl*pper kompilator rozwijany na wielu różnych platformach. Ten pakiet zawiera kompilator, preprocesor, zbiory nagłówkowe, wirtualn+ maszynę oraz biblioteki pozwalaj+ce na tworzenie aplikacji dla MS-Windows przy użyciu MinGW GCC. ###################################################################### ## Preperation. ###################################################################### %prep %setup -c harbour rm -fR $RPM_BUILD_ROOT ###################################################################### ## Build. ###################################################################### %build export HB_HOST_BUILD=yes export HB_ARCHITECTURE=linux export HB_COMPILER=gcc export HB_USER_CFLAGS="-O2 -DHB_FM_STATISTICS_OFF" make export HB_HOST_BUILD=lib export HB_ARCHITECTURE=win export HB_COMPILER=mingw mkdir -p source/pp/${HB_ARCHITECTURE}/${HB_COMPILER} ln -s ../../linux/gcc/hbpp source/pp/${HB_ARCHITECTURE}/${HB_COMPILER}/hbpp.exe mkdir -p source/main/${HB_ARCHITECTURE}/${HB_COMPILER} ln -s ../../linux/gcc/harbour source/main/${HB_ARCHITECTURE}/${HB_COMPILER}/harbour.exe export CC_HB_USER_CFLAGS="" export HB_USER_CFLAGS="$CC_HB_USER_CFLAGS -O2 -DHB_FM_STATISTICS_OFF" export CC_HB_USER_PRGFLAGS="-D__PLATFORM__WINDOWS -undef:__PLATFORM__UNIX -undef:__PLATFORM__LINUX" export HB_USER_PRGFLAGS="$CC_HB_USER_PRGFLAGS" export HB_USER_LDFLAGS="${CC_HB_USER_LDFLAGS}" export CCPATH="%{hb_ccpath}:" export CCPREFIX="%{hb_ccpref}" export PATH="$CCPATH$PATH" export HB_XBUILD=win export HB_BIN_INSTALL=%{_bindir} export HB_INC_INSTALL=%{_includedir}/%{name} export HB_LIB_INSTALL=%{_libdir}/%{name} export HB_CONTRIBLIBS="gtwvg hbbmcdx hbbtree hbclipsm hbct hbgt hbmisc hbmzip hbtip hbvpdf hbwin hbziparc rddado xhb %{!?_without_nf:hbnf} %{?_with_odbc:hbodbc} %{?_with_curl:hbcurl} %{?_with_ads:rddads} %{?_with_gd:hbgd} %{?_with_pgsql:hbpgsql} %{?_with_mysql:hbmysql} %{?_with_allegro:gtalleg}" make ###################################################################### ## Install. ###################################################################### %install # Install harbour itself. export CC_HB_USER_CFLAGS="" export HB_USER_CFLAGS="$CC_HB_USER_CFLAGS -O2 -DHB_FM_STATISTICS_OFF" export CC_HB_USER_PRGFLAGS="-D__PLATFORM__WINDOWS -undef:__PLATFORM__UNIX -undef:__PLATFORM__LINUX" export HB_USER_PRGFLAGS="$CC_HB_USER_PRGFLAGS" export HB_USER_LDFLAGS="${CC_HB_USER_LDFLAGS}" export CCPATH="%{hb_ccpath}:" export CCPREFIX="%{hb_ccpref}" export PATH="$CCPATH$PATH" export HB_HOST_BUILD=lib export HB_ARCHITECTURE=win export HB_COMPILER=mingw export HB_XBUILD=win export HB_BIN_INSTALL=%{_bindir} export HB_INC_INSTALL=%{_includedir}/%{name} export HB_LIB_INSTALL=%{_libdir}/%{name} export HB_CONTRIBLIBS="gtwvg hbbmcdx hbbtree hbclipsm hbct hbgt hbmisc hbmzip hbtip hbvpdf hbwin hbziparc rddado xhb %{!?_without_nf:hbnf} %{?_with_odbc:hbodbc} %{?_with_curl:hbcurl} %{?_with_ads:rddads} %{?_with_gd:hbgd} %{?_with_pgsql:hbpgsql} %{?_with_mysql:hbmysql} %{?_with_allegro:gtalleg}" export _DEFAULT_BIN_DIR=$HB_BIN_INSTALL export _DEFAULT_INC_DIR=$HB_INC_INSTALL export _DEFAULT_LIB_DIR=$HB_LIB_INSTALL export HB_BIN_INSTALL=$RPM_BUILD_ROOT/$HB_BIN_INSTALL export HB_INC_INSTALL=$RPM_BUILD_ROOT/$HB_INC_INSTALL export HB_LIB_INSTALL=$RPM_BUILD_ROOT/$HB_LIB_INSTALL export HB_TOOLS_PREF=%{hb_pref} mkdir -p $HB_BIN_INSTALL mkdir -p $HB_INC_INSTALL mkdir -p $HB_LIB_INSTALL make -i install [ "%{?_with_odbc:1}" ] || rm -f $HB_LIB_INSTALL/libhbodbc.a [ "%{?_with_allegro:1}" ] || rm -f $HB_LIB_INSTALL/libgtalleg.a [ "%{?_with_ads:1}" ] || rm -f $HB_LIB_INSTALL/librddads.a [ "%{?_without_nf:1}" ] && rm -f $HB_LIB_INSTALL/libhbnf.a # Keep the size of the libraries to a minimim. ${CCPREFIX}strip --strip-debug $HB_LIB_INSTALL/* # remove unused files rm -fR ${HB_BIN_INSTALL}/{harbour,hbpp,hbdoc,hbmk2,hbrun,hbi18n,hbtest}.exe # Create a README file for people using this RPM. cat > doc/%{readme} < # output file name -static # link with static Harbour libs -fullstatic # link with all static libs -shared # link with shared libs (default) -mt # link with multi-thread libs -gt # link with GT driver, can be repeated to # link with more GTs. The first one will be # the default at runtime -xbgtk # link with xbgtk library (xBase GTK+ interface) -hwgui # link with HWGUI library (GTK+ interface) -l # link with library -L # additional path to search for libraries -fmstat # link with the memory statistics lib -nofmstat # do not link with the memory statistics lib (default) -[no]strip # strip (no strip) binaries -main= # set the name of main program function/procedure. # if not set then 'MAIN' is used or if it doesn't # exist the name of first public function/procedure # in first linked object module (link) Link options work only with "%{hb_pref}lnk" and "%{hb_pref}mk" and have no effect in "%{hb_pref}cc" and "%{hb_pref}cmp". Other options are passed to Harbour/C compiler/linker. An example compile/link session looks like: ---------------------------------------------------------------------- druzus@uran:~/tmp$ cat foo.prg function main() ? "Hello, World!" return nil druzus@uran:~/tmp$ %{hb_pref}cmp foo Harbour 1.0.0 Intl. (Rev. 9099) Copyright (c) 1999-2008, http://www.harbour-project.org/ Compiling 'foo.prg'... Lines 5, Functions/Procedures 2 Generating C source output to 'foo.c'... Done. druzus@uran:~/tmp$ %{hb_pref}lnk foo.o druzus@uran:~/tmp$ ls -l foo -rwxrwxr-x 1 druzus druzus 3824 maj 17 02:46 foo.exe ---------------------------------------------------------------------- or using %{hb_pref}mk only: ---------------------------------------------------------------------- druzus@uran:~/tmp$ cat foo.prg function main() ? "Hello, World!" return nil druzus@uran:~/tmp$ %{hb_pref}mk foo Harbour 1.0.0 Intl. (Rev. 9099) Copyright (c) 1999-2008, http://www.harbour-project.org/ Compiling 'foo.prg'... Lines 5, Functions/Procedures 2 Generating C source output to 'foo.c'... Done. druzus@uran:~/tmp$ ls -l foo -rwxrwxr-x 1 druzus druzus 3824 maj 17 02:46 foo.exe ---------------------------------------------------------------------- I hope this RPM is useful. Have fun with Harbour. Przemyslaw Czerpak (druzus/at/priv.onet.pl) EOF ###################################################################### ## Post install ###################################################################### #%post lib #/sbin/ldconfig ###################################################################### ## Post uninstall ###################################################################### #%postun lib #/sbin/ldconfig ###################################################################### ## Clean. ###################################################################### %clean rm -fR $RPM_BUILD_ROOT ###################################################################### ## File list. ###################################################################### %files %defattr(-,root,root,755) %doc doc/%{readme} %{_bindir}/%{hb_pref}-mkdyn %{_bindir}/%{hb_pref}-mkslib %{_bindir}/%{hb_pref}-build %{_bindir}/%{hb_pref}cc %{_bindir}/%{hb_pref}cmp %{_bindir}/%{hb_pref}lnk %{_bindir}/%{hb_pref}mk %{_bindir}/hbmk.cfg %defattr(644,root,root,755) %dir %{_includedir}/%{name} %{_includedir}/%{name}/* %dir %{_libdir}/%{name} %{_libdir}/%{name}/libhbcpage.a %{_libdir}/%{name}/libhbcommon.a %{_libdir}/%{name}/libhbcplr.a %{_libdir}/%{name}/libhbdebug.a %{_libdir}/%{name}/libhbfm.a %{_libdir}/%{name}/libhbfmmt.a %{_libdir}/%{name}/librddfpt.a %{_libdir}/%{name}/librddcdx.a %{_libdir}/%{name}/librddntx.a %{_libdir}/%{name}/librddnsx.a %{_libdir}/%{name}/libgt*.a %{_libdir}/%{name}/libhblang.a %{_libdir}/%{name}/libhbmacro.a %{_libdir}/%{name}/libhbpcre.a %{_libdir}/%{name}/libhbzlib.a %{_libdir}/%{name}/libhbextern.a %{_libdir}/%{name}/libhbnulrdd.a %{_libdir}/%{name}/libhbpp.a %{_libdir}/%{name}/libhbrdd.a %{_libdir}/%{name}/libhbhsx.a %{_libdir}/%{name}/libhbsix.a %{_libdir}/%{name}/libhbrtl.a %{_libdir}/%{name}/libhbvm.a %{_libdir}/%{name}/libhbvmmt.a %{_libdir}/%{name}/libhbmainstd.a %{_libdir}/%{name}/libhbusrrdd.a %{_libdir}/%{name}/libhbuddall.a %{!?_without_nf: %{_libdir}/%{name}/libhbnf.a} %{?_with_ads: %{_libdir}/%{name}/librddads.a} %{?_with_odbc: %{_libdir}/%{name}/libhbodbc.a} %{?_with_mysql: %{_libdir}/%{name}/libhbmysql.a} %{?_with_pgsql: %{_libdir}/%{name}/libhbpgsql.a} %{?_with_gd: %{_libdir}/%{name}/libhbgd.a} %{_libdir}/%{name}/libhbbtree.a %{_libdir}/%{name}/libhbmisc.a %{_libdir}/%{name}/libhbmzip.a %{_libdir}/%{name}/libhbct.a %{_libdir}/%{name}/libhbtip.a %{_libdir}/%{name}/libxhb.a %{_libdir}/%{name}/librddado.a %{_libdir}/%{name}/libhbwin.a %{_libdir}/%{name}/libhbvpdf.a %{_libdir}/%{name}/libhbgt.a %{_libdir}/%{name}/libhbbmcdx.a %{_libdir}/%{name}/libhbclipsm.a %{_libdir}/%{name}/libhbziparc.a %defattr(755,root,root,755) %{_libdir}/%{name}/*.dll ###################################################################### ## Spec file Changelog. ###################################################################### %changelog * Thu Oct 23 2007 Przemyslaw Czerpak (druzus/at/priv.onet.pl) - initial release