##################### GENERAL ##################### 
GARNAME = firebird25
GARVERSION = 2.5.9.27139.0
ORIGNAME = Firebird
ORIGVERSION = 2.5.9.27139-0
GARELEASE = 2
HOME_URL = https://firebirdsql.org
CATEGORIES = app/database
MASTER_SITES += https://github.com/FirebirdSQL/firebird/releases/download/R2_5_9/
DISTFILES = Firebird-$(ORIGVERSION).tar.bz2
PATCHFILES = 
MAINTAINER = Felipe Sanchez <izto@asic-linux.com.mx>
LICENSE = Interbase Public License (Modified Mozilla Public License V1.1)

DESCRIPTION = An open source, multiplatform RDBMS (Version 2.5.X)
define BLURB

Firebird is a relational database offering many ANSI SQL standard
features that runs on Linux, Windows, MacOS and a variety of Unix
platforms. Firebird offers excellent concurrency, high performance,
and powerful language support for stored procedures and triggers.
It has been used in production systems, under a variety of names,
since 1981.

The Firebird Project is a commercially independent project of
C/C++ programmers, technical advisors and supporters developing
and enhancing a multi-platform relational database management
system based on the source code released by Inprise Corporation
on 25 July, 2000.
endef

##################### PACKAGING #####################


#IZTACI_PACKAGE_PATH =

# Users and groups the binary package will create
# WHEN INSTALLED ON THE DESTINATION SYSTEM
CREATE_GROUPS = firebird:84
CREATE_USERS  = firebird:84:84

# This is to be appended to the package's installation script
# Use it to set file owners, permissions, DB initialization, etc.
# Remember any shell variables (Such as $ROOT) have to be escaped
# like this: \$$ROOT

define DOINST_APPEND

chown -v firebird:firebird /etc/firebird/security2.fdb

echo ------------------------------------------------------------------
echo s6-rc services installed:
echo
echo \"    firebird-server\"
echo \"    firebird-log\"
echo \"    fbserver-log\"
echo \"    firebird\"
echo
echo Run \'rc update\' to add them to the live services database.
echo
echo ----------------------------------------------------------------------------
echo If this is a new installation you should change the default SYSDBA password:
echo
echo \"gsec -user sysdba -password masterkey -modify sysdba -pw 'newpasword'\"
echo
echo Afterwards, start the FirebirdSQL service with \'rc up firebird\'
echo ----------------------------------------------------------------------------
echo
endef

# Required dependencies
define SLACK_REQUIRED
gcc-so | gcc
icu4c
endef

# Suggested dependencies
define SLACK_SUGGESTS
endef

# Package conflicts (lprng vs cups for example)
define SLACK_CONFLICTS
firebird
endef



##################### BUILDING #####################


CONFIGURE_SCRIPTS = $(WORKSRC)/configure
BUILD_SCRIPTS = $(WORKSRC)/Makefile
INSTALL_SCRIPTS = custom

CONFIGURE_ARGS = $(DIRPATHS)
NODIRPATHS = 

# Directories to be created as part of the install process.
# Can be inside the final package or just transient dirs we need
# while building it.
INSTALL_DIRS += $(DESTDIR)/etc/s6-rc/source
INSTALL_DIRS += $(DESTDIR)/etc/sysconfig
INSTALL_DIRS += $(DESTDIR)/srv/firebird
INSTALL_DIRS += $(DESTDIR)/$(libdir)/firebird
INSTALL_DIRS += $(DESTDIR)/$(bindir)
INSTALL_DIRS += $(DESTDIR)/$(docdir)

# If some dirs are trying to install into /, list their names
# here, such as: prefix bindir mandir
INSTALL_OVERRIDE_DIRS = 


# Dependencies are of the form categorydir/packagedir
# LIBDEPS are for libraries, and DEPENDS are for everything else
DEPENDS =
LIBDEPS =
DEPENDS =
# Builddeps are installed in the build DESTIMG
BUILDDEPS =

##################### GAR #####################

# This should go before any hand-made rules.
include config.mk
include ../level.mk

##################### CUSTOMIZING #####################

test:
	cd $(WORKSRC); $(MAKE) check
	$(MAKECOOKIE)

# Firebird does not support DESTDIR and its "install" target
# looks loke an overly convoluted mess to me, so we'll just 
# take the "gen" target which creates something a bit
# like a DESTDIR and then we move everything in place from
# there.

install-custom:
	$(MAKE) -C $(WORKSRC) gen
	$(MAKE) -C $(WORKSRC)/gen -f Makefile.install buildRoot
	cp -av $(WORKSRC)/gen/buildroot/* $(DESTDIR)
	$(MAKECOOKIE)

post-install:
	$(MAKE) etc-new
	$(MAKE) s6rc
	$(MAKE) sysconfig
	rm -vr $(DESTDIR)/var
	rm -vr $(DESTDIR)/run
	$(MAKE) strip
	$(MAKE) gzip-man
	$(MAKECOOKIE)
