# --- SDE-COPYRIGHT-NOTE-BEGIN ---
# This copyright note is auto-generated by ./scripts/Create-CopyPatch.
#
# Filename: package/.../mythtv/mythtv.conf
# Copyright (C) 2011 The OpenSDE Project
# Copyright (C) 2004 - 2006 The T2 SDE Project
#
# More information can be found in the files COPYING and README.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 2 of the License. A copy of the
# GNU General Public License can be found in the file COPYING.
# --- SDE-COPYRIGHT-NOTE-END ---

. $base/package/*/*/mythtv-conf.in

# mythtv is using a custom configure script which is not accepting our
# auto-generated configure options
confopt=''

var_append confopt ' ' "--prefix=/$prefix"

# compiler
var_append confopt ' ' "--cc=$CC"
var_append confopt ' ' "--cxx=$CXX"
# architecture/cpu
var_append confopt ' ' "--arch=$arch_machine"
var_append confopt ' ' "--cpu=$SDECFG_X86_OPT"
# TODO tuning
# --tune=CPU     tune instruction usage for a particular CPU [generic]

# controlled by OpenSDE itself
var_append confopt ' ' "--disable-ccache --disable-distcc"

# X11
if pkginstalled -f libx11; then
	# location of X11 include files
	var_append confopt ' ' "--x11-path=$(pkgprefix -r includedir libx11)"
	#var_append confopt ' ' "--extra-cflags=-I$(pkgprefix -r includedir libx11)"
	var_append confopt ' ' "--extra-ldflags=-L$(pkgprefix -r libdir libx11)"
else
	var_append confopt ' ' "--disable-x11"
fi

# Lirc Support
if ! pkginstalled -f lirc; then
	var_append confopt ' ' "--disable-lirc"
fi

# install database and contrib stuff
hook_add postmake 5 "cp -av database contrib $root/$datadir"