# Copyright 1999-2017 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Header: $ EAPI=6 inherit eutils git-r3 user DESCRIPTION="OSCam is an Open Source Conditional Access Module software" HOMEPAGE="http://www.streamboard.tv/oscam/wiki" EGIT_REPO_URI="git://repo.or.cz/oscam.git" LICENSE="GPL-2" SLOT="0" KEYWORDS="~amd64 ~x86" IUSE="ac csp debug doc dvb emu gbox iconv ipv6 irdeto iuu lb led lcd log monitor pcsc +reader rtc +ssl usb +www" IUSE_PROTOCOL="camd33 camd35 camd35_tcp newcamd cccam gbox radegast scam serial constcw pandora ghttp" for share in ${IUSE_PROTOCOL}; do IUSE="${IUSE} protocol_${share}" done IUSE_READER="nagra irdeto conax cryptoworks seca viaccess videoguard dre tongfang bulcrypt griffin dgcrypt" for card in ${IUSE_READER}; do IUSE="${IUSE} reader_${card}" done IUSE_CARD_READERS="phoenix internal sc8in1 mp35 smargo db2com stapi stapi5 stinger drecas" for card_readers in ${IUSE_CARD_READERS}; do IUSE="${IUSE} cardreader_${card_readers}" done REQUIRED_USE=" protocol_camd35_tcp? ( protocol_camd35 ) reader_irdeto? ( irdeto ) " DEPEND="dev-util/cmake" RDEPEND="${DEPEND} dev-libs/openssl usb? ( dev-libs/libusb ) pcsc? ( sys-apps/pcsc-lite )" OSCAMUSER="oscam" S="${WORKDIR}/${PN}-9999" src_defs() { myconf="" if use ac; then myconf="${myconf} CS_ANTICASC" fi if use csp; then myconf="${myconf} CS_CACHEEX" myconf="${myconf} CW_CYCLE_CHECK" fi if use debug; then myconf="${myconf} WITH_DEBUG" fi if use dvb; then myconf="${myconf} HAVE_DVBAPI" fi if use emu; then myconf="${myconf} WITH_EMU" fi if use iconv; then myconf="${myconf} READ_SDT_CHARSETS" fi if use ipv6; then myconf="${myconf} IPV6SUPPORT" fi if use irdeto; then myconf="${myconf} IRDETO_GUESSING" fi if use lb; then myconf="${myconf} WITH_LB" fi if use lcd; then myconf="${myconf} LCDSUPPORT" fi if use led; then myconf="${myconf} LEDSUPPORT" fi if use monitor; then myconf="${myconf} MODULE_MONITOR" fi if use rtc; then myconf="${myconf} CLOCKFIX" fi if use ssl; then myconf="${myconf} WITH_SSL" fi if use www; then myconf="${myconf} WEBIF" myconf="${myconf} WEBIF_LIVELOG" myconf="${myconf} WEBIF_JQUERY" myconf="${myconf} TOUCH" fi if use protocol_camd33; then myconf="${myconf} MODULE_CAMD33" fi if use protocol_camd35; then myconf="${myconf} MODULE_CAMD35" fi if use protocol_camd35_tcp; then myconf="${myconf} MODULE_CAMD35_TCP" fi if use protocol_newcamd; then myconf="${myconf} MODULE_NEWCAMD" fi if use protocol_cccam; then myconf="${myconf} MODULE_CCCAM" myconf="${myconf} MODULE_CCCSHARE" fi if use protocol_gbox; then myconf="${myconf} MODULE_GBOX" fi if use protocol_radegast; then myconf="${myconf} MODULE_RADEGAST" fi if use protocol_scam; then myconf="${myconf} MODULE_SCAM" fi if use protocol_serial; then myconf="${myconf} MODULE_SERIAL" fi if use protocol_constcw; then myconf="${myconf} MODULE_CONSTCW" fi if use protocol_pandora; then myconf="${myconf} MODULE_PANDORA" fi if use protocol_ghttp; then myconf="${myconf} MODULE_GHTTP" fi if use reader_nagra; then myconf="${myconf} READER_NAGRA" fi if use reader_irdeto; then myconf="${myconf} READER_IRDETO" fi if use reader_conax; then myconf="${myconf} READER_CONAX" fi if use reader_cryptoworks; then myconf="${myconf} READER_CRYPTOWORKS" fi if use reader_seca; then myconf="${myconf} READER_SECA" fi if use reader_viaccess; then myconf="${myconf} READER_VIACCESS" fi if use reader_videoguard; then myconf="${myconf} READER_VIDEOGUARD" fi if use reader_dre; then myconf="${myconf} READER_DRE" fi if use reader_tongfang; then myconf="${myconf} READER_TONGFANG" fi if use reader_bulcrypt; then myconf="${myconf} READER_BULCRYPT" fi if use reader_griffin; then myconf="${myconf} READER_GRIFFIN" fi if use reader_dgcrypt; then myconf="${myconf} READER_DGCRYPT" fi if use cardreader_phoenix; then myconf="${myconf} CARDREADER_PHOENIX" fi if use cardreader_internal; then myconf="${myconf} CARDREADER_INTERNAL" fi if use cardreader_sc8in1; then myconf="${myconf} CARDREADER_SC8IN1" fi if use cardreader_mp35; then myconf="${myconf} CARDREADER_MP35" fi if use cardreader_smargo; then myconf="${myconf} CARDREADER_SMARGO" fi if use cardreader_db2com; then myconf="${myconf} CARDREADER_DB2COM" fi if use cardreader_stapi; then myconf="${myconf} CARDREADER_STAPI" myconf="${myconf} CARDREADER_STAPI5" fi if use cardreader_stinger; then myconf="${myconf} CARDREADER_STINGER" fi if use cardreader_drecas; then myconf="${myconf} CARDREADER_DRECAS" fi export myconf } src_defs_2() { myconf_2="" if use ssl; then myconf="${myconf_2} USE_LIBCRYPTO=1" fi if use usb; then myconf="${myconf_2} USE_LIBUSB=1" fi if use pcsc; then myconf="${myconf_2} USE_PCSC=1" fi export myconf_2 } src_prepare() { if use csp && ! use log; then einfo "Using this patch will eliminate logging of rejects in Cache-EX mode1" epatch "${FILESDIR}"/oscam-2017_1107_csp_logging.patch fi if ! use debug; then einfo "Disables debugging flags set in Makefile" epatch "${FILESDIR}"/oscam-2017_1107_no_debug.patch fi if ! use log; then einfo "Using this patch will eliminate logging of invalid ECMs" epatch "${FILESDIR}"/oscam-2017_1107_no_invalid_logging.patch fi if use emu; then einfo "Using this patch will enable emulation of several protocols" epatch "${FILESDIR}"/oscam-2018_0123_emu.patch fi eapply_user } src_configure() { src_defs # Disable everything and enable set options ./config.sh -D all -E ${myconf} ./config.sh --oscam-revision > rev rev=`cat rev` } src_compile() { src_defs_2 emake ${myconf_2} || die "emake failed" } src_install() { newbin Distribution/oscam-1.20-unstable_svn${rev}-x86_64-pc-linux-gnu-ssl ${PN}-${rev} || die "newbin failed" doman Distribution/doc/man/* || die "doman failed" if use doc; then dodoc -r Distribution/doc/txt/* || die "dodoc failed" dodoc -r Distribution/doc/example/* || die "dodoc failed" fi newconfd "${FILESDIR}/oscam.confd" ${PN} fperms 600 /etc/conf.d/${PN} newinitd "${FILESDIR}/oscam.initd" ${PN} } pkg_preinst() { enewuser ${OSCAMUSER} -1 -1 /home/oscam users } pkg_postinst() { einfo "" einfo "Please reffer to the wiki for assistance with the setup " einfo " located at http://streamboard.de.vu/wiki/OSCam/en " einfo "" einfo "Don't forget to add the 'oscam' user to the right groups," einfo " 'usb' for a usb reader or 'tty' for serial reader." }