]> Pileus Git - ~andy/sunrise/commitdiff
dev-lang/xharbour: New ebuild for bug 123975. Thanks to Clemens Dudek <cdudek@netway...
authorPhil Krylov (philkrylov) <phil.krylov@gmail.com>
Sun, 8 Mar 2009 22:04:32 +0000 (22:04 +0000)
committerPhil Krylov (philkrylov) <phil.krylov@gmail.com>
Sun, 8 Mar 2009 22:04:32 +0000 (22:04 +0000)
svn path=/sunrise/; revision=8026

dev-lang/xharbour/ChangeLog [new file with mode: 0644]
dev-lang/xharbour/Manifest [new file with mode: 0644]
dev-lang/xharbour/files/xharbour-as-needed.patch [new file with mode: 0644]
dev-lang/xharbour/files/xharbour-fPIC.patch [new file with mode: 0644]
dev-lang/xharbour/files/xharbour-mkinstdir.patch [new file with mode: 0644]
dev-lang/xharbour/files/xharbour-parallel-make.patch [new file with mode: 0644]
dev-lang/xharbour/files/xharbour-skip-static-utils.patch [new file with mode: 0644]
dev-lang/xharbour/metadata.xml [new file with mode: 0644]
dev-lang/xharbour/xharbour-1.0.0_beta1.ebuild [new file with mode: 0644]

diff --git a/dev-lang/xharbour/ChangeLog b/dev-lang/xharbour/ChangeLog
new file mode 100644 (file)
index 0000000..f672988
--- /dev/null
@@ -0,0 +1,12 @@
+# ChangeLog for dev-lang/xharbour
+# Copyright 1999-2009 Gentoo Foundation; Distributed under the GPL v2
+# $Header: $
+
+  08 Mar 2009; Phil Krylov (philkrylov) <phil.krylov@gmail.com>
+  +xharbour-1.0.0_beta1.ebuild, +files/xharbour-as-needed.patch,
+  +files/xharbour-fPIC.patch, +files/xharbour-mkinstdir.patch,
+  +files/xharbour-parallel-make.patch,
+  +files/xharbour-skip-static-utils.patch, +metadata.xml:
+  New ebuild for bug 123975. Thanks to Clemens Dudek <cdudek@netway.at> and
+  Bel Zébute <mailto:stephane@gorfou.ca>.
+
diff --git a/dev-lang/xharbour/Manifest b/dev-lang/xharbour/Manifest
new file mode 100644 (file)
index 0000000..8cc5be3
--- /dev/null
@@ -0,0 +1,9 @@
+AUX xharbour-as-needed.patch 5807 RMD160 e4a44c1b1da169142e69cb31dbe5b677d5fd8b6e SHA1 fb095344e7d79bbf2deeb167745c1b11d7a88f72 SHA256 6704203fb9449f7a55a14f82b7141a2a9049969f5729b1c23a14ef8ee9655d05
+AUX xharbour-fPIC.patch 942 RMD160 e82e793b6de7314e8da3cda111aa63e5ce13598e SHA1 fc56c72b607f63ed9e09cbff799d22b6f1170952 SHA256 7e6998d863950c0a2bf0f80ea9b031a7c3db81b6bbf311aad367762ad1a2e04b
+AUX xharbour-mkinstdir.patch 386 RMD160 b36d7e51971926063eee2386a457f45b416b85f6 SHA1 668500f4f160e667b55be2a0b8d9ad2bf471e6f4 SHA256 caef1428aa93c7e17460ef71016a599f31680b327cb448716c860f094b045f44
+AUX xharbour-parallel-make.patch 3736 RMD160 3c4d3986a912c463b4c4dbfd73d79cea96e84c6b SHA1 e4c7c34e04db45fadc7a45904a448b01bbe47d60 SHA256 b57b85917a0d962fea6ccc8d938318bce436dff62ec2081795f50c97935390b5
+AUX xharbour-skip-static-utils.patch 256 RMD160 afd46e6127a2bbcae080c14edfe5e833933b614c SHA1 17e4951348de79196138d199e7df5c8704df370c SHA256 4a0b6792b3126ff8fc24e00ebd15ea77de12542476d5990d3298f356e607d2a9
+DIST xharbour-1.0.0-beta1.src.tar.gz 4599382 RMD160 201c45aee776efbd41da5c4bd7c2cb7637c78f48 SHA1 b874ec86a265ad80263c400f0e72516082747719 SHA256 0ec6faf77be2a3842465e6dc1337c760331152fbe1f9f2f95c18e59823cd3e66
+EBUILD xharbour-1.0.0_beta1.ebuild 2931 RMD160 bb0d8b2ef8bf1f75a98562aa705b4efe2265fc73 SHA1 8900819bc3df2bff5774f1a9b4062c5a85750e34 SHA256 020808427e345e499fdbb6a0e62e5e1d0a15dc85c949098e485f4cd6559d7893
+MISC ChangeLog 527 RMD160 241d366cf14da54f642fddefcbae13618f095da4 SHA1 77b744b439e8a6be51369584216243c0548de856 SHA256 f92286e9417eeeb52826e5e514fd0a3d51e822da26468eca292bdd0b962835cd
+MISC metadata.xml 243 RMD160 acce2888cb02b47c1948846ff447513f4cb6283e SHA1 8666a3eb22d98103aa8ac03907b85906e143e2cf SHA256 4b6fe2a2b60f72ca8aa59e7e0208c01e802058d5cd2ce1f3609f8bae5320d29c
diff --git a/dev-lang/xharbour/files/xharbour-as-needed.patch b/dev-lang/xharbour/files/xharbour-as-needed.patch
new file mode 100644 (file)
index 0000000..ca48df3
--- /dev/null
@@ -0,0 +1,138 @@
+--- xharbour-1.0.0-beta1/bin/hb-func.sh.orig   2007-02-13 22:02:23.000000000 +0300
++++ xharbour-1.0.0-beta1/bin/hb-func.sh        2009-03-05 11:33:06.000000000 +0300
+@@ -324,13 +324,9 @@
+ fi
+ [ -n "\${HB_GPM_LIB}" ] && SYSTEM_LIBS="\${SYSTEM_LIBS} -l\${HB_GPM_LIB}"
+-if [ "\${HB_STATIC}" = "full" ]; then
+-    SYSTEM_LIBS="\${SYSTEM_LIBS} -ldl"
+-    if [ "\${HB_ARCHITECTURE}" = "linux" ]; then
+-        SYSTEM_LIBS="\${SYSTEM_LIBS} -lpthread"
+-    fi
+-    LN_OPT="\${LN_OPT} -static"
+-    HB_STATIC="yes"
++
++if [ "\${HB_STATIC}" = "no" ]; then
++    SYSTEM_LIBS=""
+ fi
+ if [ "\${HB_XBGTK}" = "yes" ]; then
+@@ -339,6 +335,14 @@
+     SYSTEM_LIBS="\${SYSTEM_LIBS} \`pkg-config --libs gtk+-2.0 --libs libgnomeprint-2.2\`"
+ fi
++if [ "\${HB_STATIC}" = "full" ]; then
++    if [ "\${HB_ARCHITECTURE}" = "linux" ]; then
++        SYSTEM_LIBS="\${SYSTEM_LIBS} -lpthread -ldl"
++    fi
++    LN_OPT="\${LN_OPT} -static"
++    HB_STATIC="yes"
++fi
++
+ HB_LNK_REQ=""
+ for gt in \${HB_GT_REQ}; do
+     if [ "\${HB_STATIC}" = "yes" ] || [ "\${gt}" = "ALLEG" ]; then
+@@ -534,7 +538,7 @@
+ mk_hblibso()
+ {
+-    local LIBS LIBSMT l lm ll hb_rootdir hb_ver hb_libs full_lib_name full_lib_name_mt linker_options
++    local LIBS LIBSMT l lm ll hb_rootdir hb_ver hb_libs full_lib_name full_lib_name_mt linker_options linker_mtoptions gpm
+     name=`get_solibname`
+     hb_rootdir="${1-.}"
+@@ -546,6 +550,32 @@
+     (cd $HB_LIB_INSTALL
+     LIBS=""
+     LIBSMT=""
++    gpm="${HB_GPM_MOUSE}"
++    linker_options="-lm"
++    linker_mtoptions=""
++    if [ "${HB_COMPILER}" = "mingw32" ]; then
++        linker_options="${linker_options} -luser32 -lwinspool -lgdi32 -lcomctl32 -lcomdlg32 -lole32 -loleaut32 -luuid -lwsock32 -lws2_32"
++    elif [ "${HB_COMPILER}" = "mingwce" ]; then
++        linker_options="${linker_options} -lwininet -lws2 -lcommdlg -lcommctrl -luuid -lole32"
++    elif [ "${HB_COMPILER}" = "djgpp" ]; then
++        linker_options="${linker_options}"
++    elif [ "${HB_ARCHITECTURE}" = "linux" ]; then
++        linker_options="${linker_options} -ldl -lrt"
++        linker_mtoptions="${linker_mtoptions} -lpthread"
++    elif [ "${HB_ARCHITECTURE}" = "sunos" ]; then
++        linker_options="${linker_options} -lrt -lsocket -lnsl -lresolv"
++        linker_mtoptions="${linker_mtoptions} -lpthread"
++    elif [ "${HB_ARCHITECTURE}" = "hpux" ]; then
++        linker_options="${linker_options} -lrt"
++        linker_mtoptions="${linker_mtoptions} -lpthread"
++    elif [ "${HB_ARCHITECTURE}" = "bsd" ]; then
++        linker_options="$-L/usr/local/lib {linker_options}"
++        linker_mtoptions="${linker_mtoptions} -lpthread"
++    elif [ "${HB_ARCHITECTURE}" = "darwin" ]; then
++        linker_options="-L/sw/lib -L/opt/local/lib ${linker_options}"
++        linker_mtoptions="${linker_mtoptions} -lpthread"
++    fi
++
+     for l in ${hb_libs}
+     do
+         case $l in
+@@ -562,21 +592,34 @@
+                    [ "${l#gt}" = "${l}" ] || \
+                    [ "${l}" = "${HB_GT_LIB}" ]
+                 then
+-                    if [ -f $ls ]
+-                    then
+-                        LIBS="$LIBS $ls"
+-                    fi
+                     if [ -f $lm ]
+                     then
+                         LIBSMT="$LIBSMT $lm"
+                     fi
+-                    if [ "${HB_ARCHITECTURE}" = "darwin" ]; then
++                    if [ -f $ls ]
++                    then
++                        LIBS="$LIBS $ls"
+                         if [ "${l}" = gtcrs ]; then
+-                            linker_options="$linker_options -lncurses"
++                            if [ "${HB_ARCHITECTURE}" = "sunos" ]; then
++                                linker_options="$linker_options -lcurses"
++                            else
++                                linker_options="$linker_options -lncurses"
++                            fi
+                         elif [ "${l}" = gtsln ]; then
+                             if [ "${HB_WITHOUT_GTSLN}" != "yes" ]; then
+                                 linker_options="$linker_options -lslang"
+                             fi
++                        elif [ "${l}" = gtxwc ]; then
++                            [ -d "/usr/X11R6/lib" ] && \
++                                linker_options="$linker_options -L/usr/X11R6/lib"
++                            [ -d "/usr/X11R6/lib64" ] && \
++                                linker_options="$linker_options -L/usr/X11R6/lib64"
++                            linker_options="$linker_options -lX11"
++                        fi
++                        if [ "${gpm}" = yes ] && ( [ "${l}" = gtcrs ] || \
++                           [ "${l}" = gtsln ] || [ "${l}" = gttrm ] ); then
++                            linker_options="$linker_options -lgpm"
++                            gpm=""
+                         fi
+                     fi
+                 fi
+@@ -586,7 +629,6 @@
+     if [ "${HB_ARCHITECTURE}" = "darwin" ]; then
+         full_lib_name="lib${name}.${hb_ver}.dylib"
+         full_lib_name_mt="lib${name}mt.${hb_ver}.dylib"
+-        linker_options="-L/sw/lib -L/opt/local/lib $linker_options"
+     elif [ "${HB_ARCHITECTURE}" = "w32" ]; then
+         full_lib_name="${name}.dll"
+         full_lib_name_mt="${name}mt.dll"
+@@ -595,10 +637,10 @@
+         full_lib_name_mt="lib${name}mt-${hb_ver}.so"
+     fi
+     echo "Making ${full_lib_name}..."
+-    $HB_BIN_INSTALL/hb-mkslib ${full_lib_name} $LIBS ${linker_options}
++    $HB_BIN_INSTALL/hb-mkslib ${full_lib_name} ${LIBS} ${linker_options}
+     if [ "$HB_MT" = "MT" ]; then
+         echo "Making ${full_lib_name_mt}..."
+-        $HB_BIN_INSTALL/hb-mkslib ${full_lib_name_mt} $LIBSMT ${linker_options}
++        $HB_BIN_INSTALL/hb-mkslib ${full_lib_name_mt} ${LIBSMT} ${linker_mtoptions} ${linker_options}
+     fi
+     for l in ${full_lib_name} ${full_lib_name_mt}
+     do
diff --git a/dev-lang/xharbour/files/xharbour-fPIC.patch b/dev-lang/xharbour/files/xharbour-fPIC.patch
new file mode 100644 (file)
index 0000000..ba4faa7
--- /dev/null
@@ -0,0 +1,27 @@
+--- xharbour-1.0.0-beta1/config/linux/gcc.cf.orig      2006-07-16 23:48:56.000000000 +0400
++++ xharbour-1.0.0-beta1/config/linux/gcc.cf   2009-03-05 10:38:53.000000000 +0300
+@@ -22,9 +22,6 @@
+ # We are under linux
+ #CFLAGS = -DHB_OS_LINUX -Wall -std=gnu99
+ CFLAGS = -DHB_OS_LINUX -Wall -W -fsigned-char
+-# uncomment this if you want to force relocateable code for .so libs
+-# it's necessary on some platforms but can reduce performance
+-#CFLAGS += -fPIC
+ ifeq ($(HB_LEX),SIMPLEX)
+ CFLAGS += -DSIMPLEX
+@@ -36,6 +33,14 @@
+ CFLAGS+= -DHB_THREAD_SUPPORT -D_THREAD_SAFE
+ endif
+ else
++# force relocateable code for .so libs
++# it's necessary on some platforms but can reduce performance
++ifeq ($(shell sh -c 'uname -m 2>/dev/null'),x86_64)
++USE_FPIC = yes
++endif
++ifeq ($(USE_FPIC),yes)
++CFLAGS += -fPIC
++endif
+ #Add thread support to lib compilation only if compiling a _mt lib
+ ifeq ($(HB_LIBCOMP_MT),YES)
+ CFLAGS+= -DHB_THREAD_SUPPORT -D_THREAD_SAFE
diff --git a/dev-lang/xharbour/files/xharbour-mkinstdir.patch b/dev-lang/xharbour/files/xharbour-mkinstdir.patch
new file mode 100644 (file)
index 0000000..ca9c50a
--- /dev/null
@@ -0,0 +1,12 @@
+--- xharbour-1.0.0-beta1/config/linux/install.cf.orig  2003-12-13 20:55:11.000000000 +0300
++++ xharbour-1.0.0-beta1/config/linux/install.cf       2009-03-04 17:48:05.000000000 +0300
+@@ -3,7 +3,8 @@
+ #
+ INSTALL_RULE =\
+-      @if [ ! -d $(INSTALL_DIR) ]; \
++      @$(MDP) $(INSTALL_DIR); \
++      if [ ! -d $(INSTALL_DIR) ]; \
+       then \
+         echo "! Can't install, path not found:" $(INSTALL_DIR); \
+       else \
diff --git a/dev-lang/xharbour/files/xharbour-parallel-make.patch b/dev-lang/xharbour/files/xharbour-parallel-make.patch
new file mode 100644 (file)
index 0000000..e1c50a0
--- /dev/null
@@ -0,0 +1,161 @@
+--- xharbour-1.0.0-beta1/config/bin.cf.orig    2001-12-21 13:47:57.000000000 +0300
++++ xharbour-1.0.0-beta1/config/bin.cf 2009-03-04 18:42:51.000000000 +0300
+@@ -35,8 +35,8 @@
+ first:: dirbase descend
+-descend :
+-      @$(MK) -C $(ARCH_DIR) -f $(GRANDP)Makefile 'TOP=$(GRANDP)' $(EXE_NAME)
++descend:: dirbase
++      +@$(MK) -C $(ARCH_DIR) -f $(GRANDP)Makefile 'TOP=$(GRANDP)' $(EXE_NAME)
+ $(EXE_NAME) : $(ALL_OBJS)
+       $(LD_RULE)
+--- xharbour-1.0.0-beta1/config/lib.cf.orig    2003-08-25 20:24:52.000000000 +0400
++++ xharbour-1.0.0-beta1/config/lib.cf 2009-03-04 18:44:30.000000000 +0300
+@@ -44,11 +44,11 @@
+ endif
+ endif
+-descend :
+-      @$(MK) -C $(ARCH_DIR) -f $(GRANDP)Makefile 'TOP=$(GRANDP)' 'HB_LIBCOMP_MT=NO' $(LIB_NAME)
++descend:: dirbase
++      +@$(MK) -C $(ARCH_DIR) -f $(GRANDP)Makefile 'TOP=$(GRANDP)' 'HB_LIBCOMP_MT=NO' $(LIB_NAME)
+-descend_mt:
+-      @$(MK) -C $(ARCH_DIR)_mt -f $(GRANDP)Makefile 'TOP=$(GRANDP)' 'HB_LIBCOMP_MT=YES' $(MT_LIB_NAME)
++descend_mt:: dirbase_mt
++      +@$(MK) -C $(ARCH_DIR)_mt -f $(GRANDP)Makefile 'TOP=$(GRANDP)' 'HB_LIBCOMP_MT=YES' $(MT_LIB_NAME)
+ $(LIB_NAME) : $(ALL_OBJS)
+       $(AR_RULE)
+--- xharbour-1.0.0-beta1/config/dir.cf.orig    2009-03-04 18:58:03.000000000 +0300
++++ xharbour-1.0.0-beta1/config/dir.cf 2009-03-04 19:01:17.000000000 +0300
+@@ -6,16 +6,73 @@
+ ifneq ($(HB_COMPILER),)
+ include $(TOP)$(ROOT)config/global.cf
++# this make version does not work correctly parallel execution rules below
++ifeq ($(MAKE_VERSION),3.79.1)
+ include $(TOP)$(ROOT)config/$(HB_ARCHITECTURE)/dir.cf
++endif
++
++ifeq ($(DIR_RULE),)
++
++# NOTE: The empty line directly before 'endef' HAVE TO exist!
++# It causes that every commands will be separated by LF
++define dir_mk
++$(MK) -C $(dir) $@
++
++endef
++
++DIRS_PURE = $(filter-out {%},$(subst {, {,$(DIRS)))
++DIRS_DEP  = $(filter-out $(DIRS_PURE),$(DIRS))
++DIRS_MK   = $(foreach d, $(DIRS_PURE), $(if $(wildcard $(d)/Makefile),$(d),))
++DIR_RULE = $(foreach dir, $(DIRS_MK), $(dir_mk))
++MULTI_DEPS = yes
++
++else
++
++DIRS := $(filter-out {%},$(subst {, {,$(DIRS)))
++MULTI_DEPS = no
++
++endif
+ all : first
++ifneq ($(MULTI_DEPS),yes)
++
+ first clean install::
+-      $(DIR_RULE)
++      +$(DIR_RULE)
++
++else
++
++DIRS_CLEAN = $(foreach dir, $(DIRS_MK), $(dir).clean)
++DIRS_INST  = $(foreach dir, $(DIRS_MK), $(dir).inst)
++
++first   :: $(DIRS_MK)
++install :: $(DIRS_INST)
++clean   :: $(DIRS_CLEAN)
++
++comma=,
++define dep_rule
++$(subst $(comma),$(2) ,$(subst },$(2),$(subst {,$(2)::|,$(1))))
++endef
++
++$(foreach dep, $(DIRS_DEP), $(eval $(call dep_rule,$(dep),.clean)))
++$(foreach dep, $(DIRS_DEP), $(eval $(call dep_rule,$(dep),.inst)))
++$(foreach dep, $(DIRS_DEP), $(eval $(call dep_rule,$(dep),)))
++
++$(DIRS_CLEAN) ::
++      +$(MK) -C $(@:.clean=) clean
++
++$(DIRS_INST) ::
++      +$(MK) -C $(@:.inst=) install
++
++$(DIRS_MK) ::
++      +$(MK) -C $(@)
++
++endif
++
+ ifneq ($(HB_POSTINST),)
+ install::
+-      $(HB_POSTINST)
++      +$(HB_POSTINST)
+ endif
+ endif
+--- xharbour-1.0.0-beta1/source/Makefile.orig  2009-03-04 19:23:38.000000000 +0300
++++ xharbour-1.0.0-beta1/source/Makefile       2009-03-04 19:27:42.000000000 +0300
+@@ -23,26 +23,28 @@
+ else
++HB_COMP_REF={compiler}
++
+ DIRS=\
+       common \
+-      pp \
+-      compiler \
+-      rtl \
+-      vm \
++      pp{common} \
++      compiler{pp} \
++      rtl$(HB_COMP_REF) \
++      vm$(HB_COMP_REF) \
+       macro \
+       codepage \
+       lang \
+-      rdd \
+-      debug \
+-      odbc \
+-      ct \
++      rdd$(HB_COMP_REF) \
++      debug$(HB_COMP_REF) \
++      odbc$(HB_COMP_REF) \
++      ct$(HB_COMP_REF) \
+       misc \
+-      cgi
++      cgi$(HB_COMP_REF)
+ ifneq ($(HB_ARCHITECTURE),dos)
+ DIRS+=\
+-      tip 
++      tip$(HB_COMP_REF) 
+ endif
+--- xharbour-1.0.0-beta1/Makefile.orig 2004-09-15 00:15:12.000000000 +0400
++++ xharbour-1.0.0-beta1/Makefile      2009-03-04 19:33:50.000000000 +0300
+@@ -7,7 +7,7 @@
+ DIRS=\
+       include \
+       source \
+-      utils \
++      utils{source} \
+ #     tests \
+ #     samples \
diff --git a/dev-lang/xharbour/files/xharbour-skip-static-utils.patch b/dev-lang/xharbour/files/xharbour-skip-static-utils.patch
new file mode 100644 (file)
index 0000000..133bc3d
--- /dev/null
@@ -0,0 +1,11 @@
+--- xharbour-1.0.0-beta1/Makefile.orig2        2009-03-04 19:33:50.000000000 +0300
++++ xharbour-1.0.0-beta1/Makefile      2009-03-05 12:30:40.000000000 +0300
+@@ -7,7 +7,7 @@
+ DIRS=\
+       include \
+       source \
+-      utils{source} \
++#     utils{source} \
+ #     tests \
+ #     samples \
diff --git a/dev-lang/xharbour/metadata.xml b/dev-lang/xharbour/metadata.xml
new file mode 100644 (file)
index 0000000..5ee6e15
--- /dev/null
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+<herd>maintainer-wanted</herd>
+<use>
+  <flag name='allegro'>Build Allegro-based GT driver</flag>
+</use>
+</pkgmetadata>
diff --git a/dev-lang/xharbour/xharbour-1.0.0_beta1.ebuild b/dev-lang/xharbour/xharbour-1.0.0_beta1.ebuild
new file mode 100644 (file)
index 0000000..0411e8a
--- /dev/null
@@ -0,0 +1,111 @@
+# Copyright 1999-2009 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+inherit base
+
+MY_P=${P/_/-}
+DESCRIPTION="An extended implementation of the Clipper dialect of the xBase language family"
+HOMEPAGE="http://www.xharbour.org/"
+SRC_URI="mirror://sourceforge/${PN}/${MY_P}.src.tar.gz"
+
+LICENSE="GPL-2-with-exceptions"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE="allegro doc gpm odbc slang threads X"
+
+RDEPEND="
+       sys-libs/ncurses
+       virtual/libc
+       allegro? ( media-libs/allegro )
+       gpm? ( sys-libs/gpm )
+       odbc? ( dev-db/unixODBC )
+       slang? ( sys-libs/slang )
+       X? ( media-libs/freetype
+                x11-libs/libX11
+                x11-libs/libXext
+                x11-libs/libXmu
+                x11-libs/libXpm
+                x11-libs/libXt )"
+DEPEND="${RDEPEND}
+       sys-devel/bison"
+
+S=${WORKDIR}/${MY_P}
+
+PATCHES=(
+       "${FILESDIR}"/${PN}-as-needed.patch
+       "${FILESDIR}"/${PN}-fPIC.patch
+       "${FILESDIR}"/${PN}-mkinstdir.patch
+       "${FILESDIR}"/${PN}-parallel-make.patch
+       "${FILESDIR}"/${PN}-skip-static-utils.patch
+)
+
+src_compile() {
+       # xHarbour uses environment vars to configure the build
+       export \
+               C_USR="${CFLAGS}" \
+               L_USR="${LDFLAGS}" \
+               HB_GTALLEG=$(useq allegro && echo yes) \
+               HB_GPM_MOUSE=$(useq gpm && echo yes) \
+               HB_WITHOUT_GTSLN=$(useq slang || echo yes) \
+               HB_MT=$(useq threads && echo MT) \
+               HB_WITHOUT_X11=$(useq X || echo yes) \
+               HB_COMPILER="gcc" \
+               HB_ARCHITECTURE="$(uname -s | sed -e 's/-//g;y/BDFHLNOPSUX/bdfhlnopsux/;s/.*bsd/bsd/')" \
+               HB_GT_LIB="gtstd" \
+               HB_MULTI_GT="yes" \
+               HB_COMMERCE="no"
+       emake || die
+}
+
+src_test() {
+       emake -C utils/hbtest || die
+       utils/hbtest/*/*/hbtest
+       einfo "In general, the package works if 'Total calls passed' figure above"
+       einfo "is 90% or greater."
+}
+
+src_install() {
+       # xHarbour uses environment vars to configure the install
+       export _DEFAULT_BIN_DIR=/usr/bin
+       export _DEFAULT_INC_DIR=/usr/include/xharbour
+       export _DEFAULT_LIB_DIR=/usr/lib/xharbour
+       export HB_BIN_INSTALL="${D}"/usr/bin
+       export HB_INC_INSTALL="${D}"/usr/include/xharbour
+       export HB_LIB_INSTALL="${D}"/usr/lib/xharbour
+       emake install || die
+
+       dodir /etc/harbour
+       install -m644 source/rtl/gtcrs/hb-charmap.def "${D}"/etc/harbour/hb-charmap.def || die
+       cat > "${D}"/etc/harbour.cfg <<-EOF
+               CC=$(tc-getCC)
+               CFLAGS=-c -I${_DEFAULT_INC_DIR} ${CFLAGS}
+               VERBOSE=YES
+               DELTMP=YES
+       EOF
+
+       # build utils with shared libs
+       L_USR="${L_USR} -L${HB_LIB_INSTALL} -l${PN}"
+       export PRG_USR="\"-D_DEFAULT_INC_DIR='${_DEFAULT_INC_DIR}'\""
+       for utl in hbdict hbmake hbpp hbrun xbscript; do
+               emake -C utils/${utl} install || die
+       done
+
+       dosym xbscript /usr/bin/pprun
+       dosym xbscript /usr/bin/xprompt
+
+       # remove unused files
+       rm -f "${HB_BIN_INSTALL}"/{hbdict*.hit,gharbour,harbour-link}
+
+       dodoc ChangeLog || die
+       if ! has nodoc ${FEATURES} && use doc; then
+               dodoc doc/*.txt || die
+               strip-linguas en es
+               for LNG in ${LINGUAS}; do
+                       docinto "${LNG}"
+                       dodoc doc/${LNG}/*.txt || die
+               done
+               docinto ct
+               dodoc doc/en/ct/*.txt || die
+       fi
+}