# Makefile for Optware packages
#
# Copyright (C) 2004 by Rod Whitby <unslung@gmail.com>
# Copyright (C) 2004 by Oleg I. Vdovikin <oleg@cs.msu.su>
# Copyright (C) 2001-2004 Erik Andersen <andersen@codepoet.org>
# Copyright (C) 2002 by Tim Riker <Tim@Rikers.org>
#
# 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; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#

# shell used by make: should be bash
SHELL=/bin/bash

# one of `ls platforms/toolchain-*.mk | sed 's|^platforms/toolchain-\(.*\)\.mk$$|\1|'`
OPTWARE_TARGET ?= buildroot-armeabi-ng

# Add new packages here
# When they have been tested, they will be promoted and uploaded.
#
PACKAGES_READY_FOR_TESTING = qt-embedded \
	py-btpd-webui \
	cryptsetup \
	unbound \
	ldns \
	dnssec-trigger \

# iozone - fileop_linux-arm.o: No such file or directory
# lumikki - does not install to $(TARGET_PREFIX)
# doxygen - host binary, not stripped
# bpalogin - for some reason it can't find 'sed' on the build machine
# btg - needs old boost and libtorrent-rasterbar
# clinkcc - fails to build with GCC 7:
#	../../src/cybergarage/upnp/Service.cpp: In member function ‘bool CyberLink::Service::loadSCPD(CyberIO::File*)’:
#	../../src/cybergarage/upnp/Service.cpp:349:33: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
#
PACKAGES_THAT_NEED_TO_BE_FIXED = lumikki \
	doxygen \
	xchat \
	iozone \
	bpalogin \
	nemesis \
	appweb libextractor sandbox \
	btg \
	clinkcc \

PERL_PACKAGES = \
	intltool \
	perl \
	perl-algorithm-diff \
	perl-appconfig perl-assp \
	perl-archive-tar perl-archive-zip \
	perl-b-keywords \
	perl-berkeleydb \
	perl-bit-vector \
	perl-bsd-resource \
	perl-business-isbn-data perl-business-isbn \
	perl-carp-clan \
	perl-cgi perl-cgi-application \
	perl-class-accessor perl-class-data-inheritable perl-class-inspector perl-class-dbi perl-class-trigger \
	perl-clone \
	perl-compress-zlib \
	perl-convert-binhex perl-convert-tnef perl-convert-uulib \
	perl-crypt-openssl-random perl-crypt-openssl-rsa perl-crypt-ssleay \
	perl-danga-socket \
	perl-date-calc perl-date-manip \
	perl-db-file \
	perl-dbd-mysql perl-dbd-sqlite perl-dbi \
	perl-dbix-contextualfetch \
	perl-devel-caller perl-devel-lexalias \
	perl-devel-modlist \
	perl-device-serialport \
	perl-digest-hmac perl-digest-perl-md5 perl-digest-sha1 perl-digest-sha \
	perl-email-address perl-email-messageid \
	perl-email-mime-contenttype \
	perl-email-mime-encodings \
	perl-email-mime-modifier perl-email-mime \
	perl-email-simple perl-email-send \
	perl-encode-detect \
	perl-encode-locale \
	perl-extutils-cbuilder perl-extutils-parsexs \
	perl-file-next perl-file-pid perl-file-rename \
	perl-gd perl-gd-barcode \
	perl-html-form \
	perl-html-parser perl-html-tagparser perl-html-tagset perl-html-template perl-hottproxy \
	perl-http-cookies perl-http-date perl-http-message \
	perl-http-response-encoding \
	perl-ima-dbi \
	perl-io-interface perl-io-socket-multicast \
	perl-io-multiplex perl-io-socket-ssl perl-io-string perl-io-stringy perl-io-zlib \
	perl-ip-country \
	perl-json-xs \
	perl-lexical-persistence \
	perl-libnet perl-libwww \
	perl-libxml perl-libxml-libxml perl-libxml-namespacesupport perl-libxml-sax-base perl-libxml-sax perl-libxml-simple \
	perl-lwp-protocol-https \
	perl-mail-spf-query perl-mailtools \
	perl-mime-tools \
	perl-module-build perl-module-pluggable perl-module-refresh perl-module-signature perl-mozilla-ca \
	perl-net-cidr-lite perl-net-dns perl-net-http perl-net-ident perl-net-server perl-net-ssleay \
	perl-padwalker \
	perl-par-dist \
	perl-pod-readme perl-poe-xs-queue-array \
	perl-return-value \
	perl-scgi perl-soap-lite \
	perl-storable \
	perl-sys-hostname-long \
	perl-sys-syscall \
	perl-template-toolkit \
	perl-term-readkey perl-term-readline-gnu \
	perl-text-diff \
	perl-timedate \
	perl-time-hires \
	perl-unicode-map perl-unicode-string \
	perl-universal-moniker \
	perl-unix-syslog \
	perl-uri \
	perl-version \
	perl-wakeonlan \
	perl-www-mechanize \
	perl-xml-dom perl-xml-parser perl-xml-parser-lite perl-xml-regexp \
	perl-yaml-syck \
	ack \
	amavisd-new \
	colordiff \
	cowsay \
	ddclient \
	ipcalc \
	perlbal \
	perlconsole \
	postgrey \
	rsnapshot \
	slimrat \
	slimserver squeezecenter \
	spamassassin \
	stow \

PYTHON_PACKAGES = \
	bzr bzr-rewrite bzr-svn bzrtools \
	cherokee-pyscgi \
	deluge deluge-develop \
	dir2ogg \
	dstat \
	getmail \
	gitosis \
	hellanzb \
	hplip \
	iotop \
	ipython \
	mailman \
	mod-python mod-wsgi \
	offlineimap \
	pyload \
	pssh putmail \
	pygments pyrex \
	sabnzbd sabnzbdplus \
	scons \
	stgit \
	subvertpy \
	py-4suite py-amara py-apsw \
	py-asn1-modules py-asn1 py-cairo py-cffi py-characteristic py-cparser \
	py-cryptography py-cython py-enum34 py-hgdistver py-ordereddict py-service-identity py-six \
	py-beaker py-bittorrent py-bluez py-boto py-buildutils \
	py-celementtree py-chardet py-cheetah py-cherrypy py-cherrytemplate py-cjson \
	py-clips py-configobj py-constraint py-crypto py-cups py-curl \
	py-decorator py-decoratortools py-dispatcher py-django py-docutils py-duplicity \
	py-elementtree py-feedparser py-flup py-formencode \
	py-gdchart2 py-gd py-genshi py-geoip py-gnosis-utils py-gobject2 py-gtk \
	py-idna py-imaplib2 py-ipaddress py-jinja2 \
	py-hgsubversion py-hgsvn py-jsmin py-kid py-lepl py-lxml \
	py-mako py-markdown py-mercurial \
	py-moin py-mssql py-mutagen py-mx-base py-mysql \
	py-myghty \
	py-nose \
	py-openssl py-openzwave py-paramiko \
	py-paste py-pastedeploy py-pastescript py-pastewebkit \
	py-pexpect py-pil py-pip py-ply py-protocols \
	py-pgsql py-psycopg py-psycopg2 py-pygresql \
	py-pudge py-pylons py-pyro py-quixote \
	py-rdiff-backup py-redis py-requests py-tornado \
	py-reportlab py-routes py-roundup py-ruledispatch \
	py-scgi py-selector py-serial py-setuptools \
	py-silvercity py-simplejson py-simpy py-slimit py-soappy \
	py-sqlalchemy py-sqlite py-sqlobject py-statlib \
	py-tailor py-tgfastdata py-trac py-urllib3 \
	py-turbocheetah py-turbogears py-turbojson py-turbokid \
	py-urwid py-usb py-weatherget py-webpy py-wsgiref py-webhelpers \
	py-xdg py-xml py-yaml py-yenc py-zope-interface \
	py-twisted py-axiom py-epsilon py-mantissa py-nevow \

ERLANG_PACKAGES = \
	erlang erl-yaws erl-ejabberd \

# removed asterisk-chan-capi, doesn't build because of asterisk-stage problems
ASTERISK_PACKAGES = \
	asterisk10 \
	asterisk11 \
	asterisk11-chan-dongle \
	asterisk13 \
	asterisk14-core-sounds-en-alaw \
	asterisk14-core-sounds-en-g729 \
	asterisk14-core-sounds-en-gsm \
	asterisk14-core-sounds-en-ulaw \
	asterisk14-extra-sounds-en-alaw \
	asterisk14-extra-sounds-en-g729 \
	asterisk14-extra-sounds-en-gsm \
	asterisk14-extra-sounds-en-ulaw \
	asterisk14-moh-freeplay-alaw \
	asterisk14-moh-freeplay-g729 \
	asterisk14-moh-freeplay-gsm \
	asterisk14-moh-freeplay-ulaw \
	asterisk14-moh-opsound-alaw \
	asterisk14-moh-opsound-g729 \
	asterisk14-moh-opsound-gsm \
	asterisk14-moh-opsound-ulaw \
	asterisk-gui \
	asterisk18 \

PACKAGES_REQUIRE_LINUX26 = \
	inotail \
	lm-sensors \
	module-init-tools \
	sysfsutils \
	varnish \

PACKAGES_ONLY_WORK_ON_LINUX24 = \
	modutils \
	spindown \

BOOST_PACKAGES = \
	libtorrent-rasterbar \
	mkvtoolnix \
	player \

OPENJDK_PACKAGES = \
	openjdk7 openjdk8 \
	bubbleupnpserver-installer

GCCGO_PACKAGES = \
	gotty \
	shell2http \

GOLANG_PACKAGES = \
	rclone \
	syncthing \

# libao - has runtime trouble?
COMMON_PACKAGES = \
	$(PACKAGES_REQUIRE_LINUX26) \
	6relayd 9base \
	abook adduser adns aget aiccu alac-decoder \
	alsa-lib alsa-oss alsa-utils \
	amule analog antinat apcupsd \
	apache apr apr-util \
	arc aria2 arping arpwatch aspell \
	$(ASTERISK_PACKAGES) \
	at at-spi2-core atftp atk atk-bridge atop attr audiofile autoconf \
	automake automake1.4 automake1.9 automake1.10 automake1.14 autossh avahi \
	bacula bash bash-completion bc bftpd \
	bind bip bison bitchx bitlbee \
	bogofilter boost $(BOOST_PACKAGES) bridge-utils \
	bsdgames bsdmainutils \
	btpd busybox byrequest bzflag bzip2 \
	bluez-libs bluez-utils bluez-hcidump \
	bluez2-libs bluez2-utils bvi \
	c-ares cabextract cacerts jre-cacerts cadaver cairo calc calcurse castget \
	catdoc ccollect ccrypt ccxstream cdargs \
	cdrtools centerim cuetools \
	cherokee chicken chillispot chromaprint chrpath cksfv \
	classpath clamav clearsilver climm clips cmake cmdftp collectd \
	confuse connect coreutils corkscrew cpio cppunit cpufrequtils cron cryptcat \
	cscope csync2 ctags ctcs ctorrent ctrlproxy \
	cups cups-filters cups-pdf cvs \
	cyrus-imapd cyrus-sasl \
	daemonize dansguardian dash davtools \
	dbus dbus-glib dbus-python \
	dcled dcraw delegate denyhosts dev-pts devio devmem2 dfu-util \
	dhcp dialog dict digitemp dircproxy distcc \
	diffstat diffutils discount \
	dmsetup dnscrypt-proxy dnsmasq dnstracer dokuwiki dos2unix dosfstools dovecot \
	dropbear dropbear-android drraw dspam dtach duktape dump \
	e2fsprogs e2tools eaccelerator easy-rsa ed ecl electric-fence elinks \
	elementary-xfce-icon-theme \
	emacs22 encfs endian enhanced-ctorrent enscript esmtp esniper \
	ettercap ettercap-ng \
	$(ERLANG_PACKAGES) \
	esound eggdrop eventlog exif exo expat extract-xiso ez-ipupdate \
	faad2 fake-hwclock fann fatresize fatsort fbcat fcgi fconfig \
	fdupes fetchmail ffmpeg ffmpegthumbnailer \
	ficy file finch findutils firedrill-httptunnel \
	fis fish fixesext flac flex flip \
	fontconfig \
	fossil-scm \
	freecell freeradius freetds freetype freeze \
	fribidi ftpcopy fslint ftpd-topfield fuppes fuse fuse-exfat \
	gambit-c gawk gcal gconv-modules gdb gdbm gdchart \
	ged gedit geoip gerbera gettext gdk-pixbuf \
	ggrab ghostscript ghostscript-fonts git gkrellmd glib glib-networking gnet gnokii gnome-icon-theme \
	gnome-icon-theme-symbolic \
	gnu-httptunnel gnu-smalltalk gnugo \
	gnupg1 gnupg gnuplot gnutls gpgme \
	gloox gobject-introspection golang $(GCCGO_PACKAGES) $(GOLANG_PACKAGES) gpsd \
	grep groff gsasl gsnmp gtmess gtypist gutenprint gzip \
	gphoto2 libgphoto2 \
	gift giftcurs gift-ares gift-fasttrack gift-gnutella \
	gift-openft gift-opennap gtk gtk2 gtksourceview gtksourceview2 gsettings-desktop-schemas \
	haproxy harfbuzz haserl hd2u hdparm hello hexcurse heyu \
	hiawatha hicolor-icon-theme hnb hping htop httping \
	ice icecast ices0 icu \
	id3lib ifstat iftop ii iksemel imagemagick imap \
	inadyn indent inetutils \
	inferno \
	ink inputproto \
	ipac-ng iperf ipkg-web iptables iptraf iputils-arping \
	ircd-hybrid irssi ivorbis-tools \
	jabberd jamvm jed jfsutils jikes jove joe \
	kamailio kbproto keychain kismet kissdx knock \
	lame launchtool lcd4linux ldconfig ldd lddtree leafnode less lftp lha \
	liba52 libacl libao libart libass libassuan libatomic-ops libbt libcap \
	libcapi20 libcdio libconfig libcroco libcurl \
	libdaemon libdb libdb52 libdlna \
	libdvb libdvbpsi libdvdnav libdvdread libdrm \
	libebml libexosip2 \
	libepoxy libevent \
	libesmtp libexif libexplain libfdk-aac libffi libftdi \
	libgc libgcrypt libgd libghttp libgmp libgpg-error libgssapi \
	libglade libhid \
	libical \
	libid3tag libidn libieee1284 libijs libinklevel libjansson libjbigkit libjpeg libjson-c \
	libksba liblcms liblcms2 libmaa libmad libmatroska libmediainfo libmemcache libmemcached libmicrohttpd \
	libmcrypt libmm $(strip $(if $(filter true, $(NO_LIBNSL)), , libnsl)) \
	libmms libmnl libmpc libmpcdec libmpdclient libmpeg2 libmpfr libmrss libmtp \
	libnetfilter-acct libnetfilter-conntrack libnetfilter-log libnetfilter-queue libnfnetlink libnettle libnl libnxml \
	libol libogg libosip2 libopensync libopenzwave libopus libotr libpam \
	libpar2 libpcap libpeas libpng libpth librsync librsvg \
	libsamplerate libserf libshout libsigc++ libsoup libsndfile libsodium libsoxr libstdc++ libgo \
	libtasn1 libtheora libtiff libtirpc libtool libtorrent \
	libubox libunistring libupnp libupnp6 libusb libusb1 libuv libvncserver \
	libvorbis libvorbisidec libwebsockets libxfce4ui libxfce4util libxkbcommon libxml2 libxslt libzen libzip \
	lighttpd lirc links2 linksys-tftp linphone littlesmalltalk llink \
	logrotate lookat loudmouth lrzsz lsof ltrace \
	lua luarocks lxappearance lxde-icon-theme \
	lynx lzo \
	m4 mac madplay make man man-pages mc mcabber md5deep mdadm \
	mediainfo mediatomb mediawiki meganz-sdk megatools memcached mesalib metalog memtester \
	mg miau microcom microdc2 microperl mimms \
	minicom minidlna minidlna-rescan minihttpd miniupnpd \
	mini-sendmail mini-snmpd \
	miscfiles mktemp mktorrent mlocate moblock \
	moc modutils monit most motif motion motor mousepad \
	mod-fastcgi moe moreutils mp3blaster mp3info mpack mpage \
	mpc mpd mpdscribble \
	mpg123 mplayer mpop mrtg msmtp \
	msort msynctool mt-daapd mt-daapd-svn mtools \
	mtr multitail mussh mutt mxml \
	myrapbook \
	mysql mysql5 mysql-connector-odbc \
	nagg nagios-plugins nail nano nanoblogger nbench-byte \
	ncdu ncftp ncmpc ncurses ncursesw nd ne \
	neon net-snmp net-tools netatalk netcat nethack netio netrik \
	newsbeuter newt \
	nfs-server nfs-utils \
	nget nginx ngrep nickle ninvaders nload \
	nmap nmon node node010 noip nostromo nrpe \
	ntfs-3g ntfsprogs \
	ntop ntp ntpclient nttcp nut nvi nylon nzbget nzbget-testing \
	ocaml oleo open2300 $(OPENJDK_PACKAGES) \
	openobex obexftp \
	opendchub openjpeg openldap opensips \
	openssl openssh sshfs sshguard openvpn oscam \
	optware-devel ossp-js oww owwlog \
	p7zip p910nd pal palantir pango parted \
	par2cmdline patch patchutils \
	pcal pcapsipdump pciutils pcre pcsc-lite pen perltgd $(PERL_PACKAGES) pinentry pixman \
	phoneme-advanced \
	php php-apache php-geoip php-imagick php-opcache php-thttpd php-memcached phpmyadmin \
	picocom picolisp pkgconfig plowshare poco polipo pop3proxy poppler \
	popt poptop portmap postgresql postfix pound powertop \
	ppower ppp printproto privoxy procmail \
	procps proftpd proxytunnel psmisc psutils pthread-stubs puppy pure-ftpd pv pwgen \
	python python24 python25 python26 python27 python3 $(PYTHON_PACKAGES) \
	qemacs qemu qemu-libc-i386 qpdf qpopper quagga quickie quilt \
	radiusclient-ng rc rc5pipe rcs rdate \
	readline re2c recode recordext recordprotos \
	redir renderext renderproto rhtvision rkhunter \
	rlfe rlwrap rox-filer rpcbind rrdcollect rrdtool \
	rssh rsstail rsync rtmpdump rtorrent rtpproxy ruby rubygems rxtx \
	sablevm samba samba2 samba34 samba35 samba36 sane-backends \
	scli scponly screen scrobby scsi-idle sd-idle sdl sdparm \
	sed sendmail ser ser2net setserial setpwc sg3-utils shared-mime-info \
	sharutils shellinabox shntool silc-client simh sipcalc siproxd sispmctl \
	slang slrn slsc \
	sm smartmontools smstools3 snort snownews \
	socat softethervpn softflowd sox spandsp spawn-fcgi speex speexdsp spindown splix \
	sqlite sqlite2 \
	sqsh squeak squid squid3 squeezelite \
	srelay srecord srtp ssam sslh sslwrap start-stop-daemon \
	strace strongswan stunnel streamripper \
	stupid-ftpd sudo surfraw swi-prolog svn \
	swig syslog-ng sysstat syx \
	taged taglib talloc tar tcl tcpwrappers tftp-hpa \
	tcpdump tcpflow tcsh telldus-core termcap tesseract-ocr \
	texinfo textutils thttpd thunar \
	tig tin tinyproxy tinyscheme tmsnc tmux tnef tnftp tnftpd \
	toppyweb tor torsocks torrent torrentflux transcode \
	transmission \
	transmissiond transmissiondcfp tre tree trickle \
	tshark tsocks ttf-bitstream-vera tz tzwatch \
	ucl udev udns udpxy uemacs ulogd unarj uncia unfs3 unionfs-fuse units unixodbc \
	unrar unrtf \
	unzip up-imapproxy updatedd upslug2 \
	upx usb-modeswitch usbutils ushare utelnetd utf8proc util-linux \
	vblade vdr-mediamvp vim vitetris vlc \
	vnstat vorbis-tools vorbisgain vpnc vsftpd vte vtun \
	w3cam w3m wayland wakelan wavpack webalizer weechat werc wget \
	which whois wizd wpa-supplicant wput wxbase \
	xerces-c xmlrpc-c xmlstarlet \
	x11 xau xauth xaw xbitmaps compositeproto libxcomposite xcursor xdg-utils xdmcp xdpyinfo xext xdamage xinerama xineramaproto xshmfence \
	xextensions xfixes xfixesproto xft xi xinetd pciaccess \
	xmu xp xpdf xpm xcb-proto xcb xextproto xfconf xorg-macros xproto xrender xt xterm xtrans xtst \
	damageproto dri2proto dri3proto glproto presentproto \
	x264 xmail xupnpd xvid xz-utils \
	yafc yasm yawk yougrabber \
	zile zip zlib znc zoo zsh zsync \
	glibc-opt glibc-locale binutils libc-dev gcc ipkg-static \

# php-fcgi ipk is now built from php.mk

# libiconv - has been made obsolete by gconv-modules
# Metalog - has been made obsolete by syslog-ng
PACKAGES_OBSOLETED = cogito erl-escript libiconv metalog monotone \
	perl-spamassassin perl-mime-base64 jabber tzcode \

##############

HOST_MACHINE:=$(shell \
if test x86_64 = `uname -m` -a 32-bit = `file /sbin/init | awk '{print $$3}'`; then echo i386 ; else uname -m; fi \
| sed -e 's/i[3-9]86/i386/' )
HOST_OS:=$(shell uname)

# extract number of jobs passed through the command line
MAKE_JOBS:=$(shell \
ps T | grep "^\s*$(shell echo $$PPID).*$(MAKE)" | \
sed -e 's/--jobs=/--jobs /g' -e 's/--jobs/-j/g' -e 's/[ \t][\t ]*/ /g' -e 's/-j /-j/g' -n -e 's/.* -j\([^ ]*\).*/\1/p')

# Directory location definitions

OPTWARE_TOP=$(shell if ! grep -q ^OPTWARE_TOP= ./Makefile; then cd ..; fi; pwd)
BASE_DIR:=$(shell pwd)

SOURCE_DIR=$(BASE_DIR)/sources
DL_DIR=$(BASE_DIR)/downloads
TOOL_BUILD_DIR=$(BASE_DIR)/toolchain
PACKAGE_DIR=$(BASE_DIR)/packages

BUILD_DIR=$(BASE_DIR)/builds
STAGING_DIR=$(BASE_DIR)/staging

STAGING_PREFIX=$(STAGING_DIR)$(TARGET_PREFIX)
STAGING_INCLUDE_DIR=$(STAGING_PREFIX)/include
STAGING_LIB_DIR=$(STAGING_PREFIX)/lib
STAGING_CPPFLAGS=$(TARGET_CFLAGS) -I$(STAGING_INCLUDE_DIR)
STAGING_LDFLAGS=$(TARGET_LDFLAGS) -L$(STAGING_LIB_DIR) -Wl,-rpath,$(TARGET_PREFIX)/lib -Wl,-rpath-link,$(STAGING_LIB_DIR)

HOST_BUILD_DIR=$(BASE_DIR)/host/builds
HOST_STAGING_DIR=$(BASE_DIR)/host/staging

HOST_STAGING_PREFIX=$(HOST_STAGING_DIR)/opt
HOST_STAGING_INCLUDE_DIR=$(HOST_STAGING_PREFIX)/include
HOST_STAGING_LIB_DIR=$(HOST_STAGING_PREFIX)/lib
HOST_STAGING_CPPFLAGS=-I$(HOST_STAGING_INCLUDE_DIR)
HOST_STAGING_LDFLAGS=-L$(HOST_STAGING_LIB_DIR) -Wl,-rpath,$(HOST_STAGING_LIB_DIR) -Wl,-rpath-link,$(HOST_STAGING_LIB_DIR)

WHAT_TO_DO_WITH_IPK_DIR=rm -rf
# WHAT_TO_DO_WITH_IPK_DIR=: keep

export TMPDIR=$(BASE_DIR)/tmp

##############

all: directories toolchain packages

TARGET_OPTIMIZATION=-O2 #-mtune=xscale -march=armv4 -Wa,-mcpu=xscale
TARGET_DEBUGGING= #-g

include $(OPTWARE_TOP)/platforms/toolchain-$(OPTWARE_TARGET).mk

DEFAULT_TARGET_PREFIX ?= /opt

TARGET_PREFIX ?= /opt

INSTALL = TARGET_PREFIX=$(TARGET_PREFIX) $(SHELL) $(BASE_DIR)/scripts/install.sh

PATCH = TARGET_PREFIX=$(TARGET_PREFIX) $(SHELL) $(BASE_DIR)/scripts/patch.sh

ifndef TARGET_USRLIBDIR
TARGET_USRLIBDIR = $(TARGET_LIBDIR)
endif

ifeq (darwin,$(TARGET_OS))
SHLIB_EXT=dylib
SO=
DYLIB=.dylib
else	# default linux
SHLIB_EXT=so
SO=.so
DYLIB=
endif

include $(OPTWARE_TOP)/platforms/packages-$(OPTWARE_TARGET).mk

ifeq ($(LIBC_STYLE), uclibc)
include $(OPTWARE_TOP)/platforms/packages-uclibc.mk
else
LIBC_STYLE=glibc
endif

PACKAGES = $(filter-out \
	$(BROKEN_PACKAGES) \
	, $(COMMON_PACKAGES) $(SPECIFIC_PACKAGES))

ifneq (, $(filter ipkg-static ipkg-opt $(OPTWARE_TARGET)-bootstrap $(OPTWARE_TARGET)-optware-bootstrap, $(PACKAGES)))
UPD-ALT_PREFIX ?= $(TARGET_PREFIX)
endif

testing:
	$(MAKE) PACKAGES="$(PACKAGES_READY_FOR_TESTING)" all
	$(PERL) -w scripts/optware-check-package.pl --target=$(OPTWARE_TARGET) --objdump-path=$(TARGET_CROSS)objdump --base-dir=$(BASE_DIR) $(patsubst %,$(BUILD_DIR)/%*.ipk,$(PACKAGES_READY_FOR_TESTING))

# Common tools which may need overriding
CVS=cvs
SUDO=sudo
WGET_BINARY=wget
CREATE_CHECKSUM=0
ifeq ($(CREATE_CHECKSUM), 1)
WGET = TOP=$(BASE_DIR)/scripts WGET=$(WGET_BINARY) CREATE_CHECKSUM=1 $(SHELL) $(BASE_DIR)/scripts/wget.sh --passive-ftp --tries=2 --no-check-certificate
else
WGET = TOP=$(BASE_DIR)/scripts WGET=$(WGET_BINARY) $(SHELL) $(BASE_DIR)/scripts/wget.sh --passive-ftp --tries=2 --no-check-certificate
endif
PERL=perl

# Required host-tools, which will build if they missing
HOST_TOOL_GCC33 = $(MAKE) gcc-host-stage GCC_VERSION=3.3.6
HOST_TOOL_ACLOCAL = \
	$(MAKE) directories automake-host-stage autoconf-host-stage pkgconfig-host-stage m4-host-stage libtool-host-stage
HOST_TOOL_AUTOMAKE = \
	$(MAKE) directories automake-host-stage autoconf-host-stage pkgconfig-host-stage m4-host-stage libtool-host-stage
HOST_TOOL_ACLOCAL1.14 = \
	$(MAKE) directories automake1.14-host-stage autoconf-host-stage pkgconfig-host-stage m4-host-stage libtool-host-stage
HOST_TOOL_AUTOMAKE1.14 = \
	$(MAKE) directories automake1.14-host-stage autoconf-host-stage pkgconfig-host-stage m4-host-stage libtool-host-stage
HOST_TOOL_ACLOCAL1.10 = \
	$(MAKE) directories automake1.10-host-stage autoconf-host-stage pkgconfig-host-stage m4-host-stage libtool-host-stage
HOST_TOOL_AUTOMAKE1.10 = \
	$(MAKE) directories automake1.10-host-stage autoconf-host-stage pkgconfig-host-stage m4-host-stage libtool-host-stage
HOST_TOOL_ACLOCAL1.9 = \
	$(MAKE) directories automake1.9-host-stage autoconf-host-stage pkgconfig-host-stage m4-host-stage libtool-host-stage
HOST_TOOL_AUTOMAKE1.9 = \
	$(MAKE) directories automake1.9-host-stage autoconf-host-stage pkgconfig-host-stage m4-host-stage libtool-host-stage
HOST_TOOL_ACLOCAL1.4 = \
	$(MAKE) directories automake1.4-host-stage autoconf-host-stage pkgconfig-host-stage m4-host-stage libtool-host-stage
HOST_TOOL_AUTOMAKE1.4 = \
	$(MAKE) directories automake1.4-host-stage autoconf-host-stage pkgconfig-host-stage m4-host-stage libtool-host-stage

# These are aclocal wrappers used to automatically fix
# libtool versions mismatch issue that can occur with
# some software in most cases
ACLOCAL1.15_SH= TOP=$(BASE_DIR) ACLOCAL=$(HOST_STAGING_PREFIX)/bin/aclocal-1.15 \
		$(SHELL) $(BASE_DIR)/scripts/aclocal.sh
ACLOCAL1.14_SH= TOP=$(BASE_DIR) ACLOCAL=$(HOST_STAGING_PREFIX)/bin/aclocal-1.14 \
		$(SHELL) $(BASE_DIR)/scripts/aclocal.sh
ACLOCAL1.10_SH= TOP=$(BASE_DIR) ACLOCAL=$(HOST_STAGING_PREFIX)/bin/aclocal-1.10 \
		$(SHELL) $(BASE_DIR)/scripts/aclocal.sh
ACLOCAL1.9_SH= TOP=$(BASE_DIR) ACLOCAL=$(HOST_STAGING_PREFIX)/bin/aclocal-1.9 \
		$(SHELL) $(BASE_DIR)/scripts/aclocal.sh
ACLOCAL1.4_SH= TOP=$(BASE_DIR) ACLOCAL=$(HOST_STAGING_PREFIX)/bin/aclocal-1.4 \
		$(SHELL) $(BASE_DIR)/scripts/aclocal.sh

# These should be called instead of `autoreconf`
AUTORECONF1.15 = (cd $(BASE_DIR) && $(HOST_TOOL_AUTOMAKE)) && \
	mkdir -p $(STAGING_PREFIX)/share/aclocal && \
	$(subst %,$(HOST_STAGING_PREFIX)/bin/, \
		AUTOCONF=%autoconf \
		AUTOHEADER=%autoheader \
		AUTOMAKE=%automake-1.15 \
		AUTOPOINT=%autopoint \
		LIBTOOLIZE=%libtoolize \
		M4=%m4 \
		ACLOCAL='$(ACLOCAL1.15_SH) -I $(STAGING_PREFIX)/share/aclocal' \
		%autoreconf)
AUTORECONF1.14 = (cd $(BASE_DIR) && $(HOST_TOOL_AUTOMAKE1.14)) && \
	mkdir -p $(STAGING_PREFIX)/share/aclocal && \
	$(subst %,$(HOST_STAGING_PREFIX)/bin/, \
		AUTOCONF=%autoconf \
		AUTOHEADER=%autoheader \
		AUTOMAKE=%automake-1.14 \
		AUTOPOINT=%autopoint \
		LIBTOOLIZE=%libtoolize \
		M4=%m4 \
		ACLOCAL='$(ACLOCAL1.14_SH) -I $(STAGING_PREFIX)/share/aclocal' \
		%autoreconf)
AUTORECONF1.10 =(cd $(BASE_DIR) && $(HOST_TOOL_AUTOMAKE1.10)) && \
	mkdir -p $(STAGING_PREFIX)/share/aclocal && \
	$(subst %,$(HOST_STAGING_PREFIX)/bin/, \
		AUTOCONF=%autoconf \
		AUTOHEADER=%autoheader \
		AUTOMAKE=%automake-1.10 \
		AUTOPOINT=%autopoint \
		LIBTOOLIZE=%libtoolize \
		M4=%m4 \
		ACLOCAL='$(ACLOCAL1.10_SH) -I $(STAGING_PREFIX)/share/aclocal' \
		%autoreconf)
AUTORECONF1.9 = (cd $(BASE_DIR) && $(HOST_TOOL_AUTOMAKE1.9)) && \
	mkdir -p $(STAGING_PREFIX)/share/aclocal && \
	$(subst %,$(HOST_STAGING_PREFIX)/bin/, \
		AUTOCONF=%autoconf \
		AUTOHEADER=%autoheader \
		AUTOMAKE=%automake-1.9 \
		AUTOPOINT=%autopoint \
		LIBTOOLIZE=%libtoolize \
		M4=%m4 \
		ACLOCAL='$(ACLOCAL1.9_SH) -I $(STAGING_PREFIX)/share/aclocal' \
		%autoreconf)
AUTORECONF1.4 = (cd $(BASE_DIR) && $(HOST_TOOL_AUTOMAKE1.4)) && \
	mkdir -p $(STAGING_PREFIX)/share/aclocal && \
	$(subst %,$(HOST_STAGING_PREFIX)/bin/, \
		AUTOCONF=%autoconf \
		AUTOHEADER=%autoheader \
		AUTOMAKE=%automake-1.4 \
		AUTOPOINT=%autopoint \
		LIBTOOLIZE=%libtoolize \
		M4=%m4 \
		ACLOCAL='$(ACLOCAL1.4_SH) -I $(STAGING_PREFIX)/share/aclocal' \
		%autoreconf)

host-automake-tools: directories automake1.4-host-stage automake1.9-host-stage automake1.10-host-stage automake1.14-host-stage automake-host-stage autoconf-host-stage pkgconfig-host-stage m4-host-stage libtool-host-stage

# The hostname or IP number of our local dl.sf.net mirror
SOURCEFORGE_MIRROR=downloads.sourceforge.net
#SOURCES_NLO_SITE=http://sources.nslu2-linux.org/sources
#SOURCES_NLO_SITE=http://ftp.osuosl.org/pub/nslu2/sources
SOURCES_NLO_SITE=http://ipkg.nslu2-linux.org/sources

# FreeBSD distfiles site
FREEBSD_DISTFILES=ftp://ftp.fi.freebsd.org/pub/FreeBSD/ports/distfiles

# Perl CPAN mirror:
# use this instead of search.cpan.org, since search.cpan.org
# contains only recent versions
PERL_CPAN_SITE=ftp.auckland.ac.nz

TARGET_CXX=$(TARGET_CROSS)g++
TARGET_CC=$(TARGET_CROSS)gcc
TARGET_GCCGO=$(TARGET_CROSS)gccgo
TARGET_CPP="$(TARGET_CC) -E"
TARGET_LD=$(TARGET_CROSS)ld
TARGET_AR=$(TARGET_CROSS)ar
TARGET_AS=$(TARGET_CROSS)as
TARGET_NM=$(TARGET_CROSS)nm
TARGET_OBJDUMP=$(TARGET_CROSS)objdump
TARGET_RANLIB=$(TARGET_CROSS)ranlib
TARGET_READELF=$(TARGET_CROSS)readelf
TARGET_STRIP?=$(TARGET_CROSS)strip

TARGET_CONFIGURE_OPTS= \
	AR=$(TARGET_AR) \
	AS=$(TARGET_AS) \
	LD=$(TARGET_LD) \
	NM=$(TARGET_NM) \
	OBJDUMP=$(TARGET_OBJDUMP) \
	CC=$(TARGET_CC) \
	CPP=$(TARGET_CPP) \
	GCC=$(TARGET_CC) \
	CXX=$(TARGET_CXX) \
	RANLIB=$(TARGET_RANLIB) \
	STRIP=$(TARGET_STRIP) \
	PKG_CONFIG=$(OPTWARE_TOP)/scripts/pkg-config.sh

CMAKE_CONFIGURE_OPTS= \
	-DCMAKE_VERBOSE_MAKEFILE=TRUE \
	-DCMAKE_SYSTEM_NAME=Linux \
	-DCMAKE_SYSTEM_VERSION=1 \
	-DCMAKE_CROSSCOMPILING=1 \
	-DCMAKE_SYSTEM_PROCESSOR=$(TARGET_ARCH) \
	-DCMAKE_BUILD_TYPE=Release \
	-DCMAKE_C_FLAGS_RELEASE="-DNDEBUG" \
	-DCMAKE_CXX_FLAGS_RELEASE="-DNDEBUG" \
	-DCMAKE_C_COMPILER="$(TARGET_CC)" \
	-DCMAKE_C_COMPILER_ARG1="" \
	-DCMAKE_CXX_COMPILER="$(TARGET_CXX)" \
	-DCMAKE_CXX_COMPILER_ARG1="" \
	-DCMAKE_ASM_COMPILER="$(TARGET_CC)" \
	-DCMAKE_ASM_COMPILER_ARG1="" \
	-DCMAKE_AR=$(TARGET_AR) \
	-DCMAKE_NM=$(TARGET_NM) \
	-DCMAKE_RANLIB=$(TARGET_RUNLIB) \
	-DPKG_CONFIG_EXECUTABLE=$(OPTWARE_TOP)/scripts/pkg-config.sh \
	-DCMAKE_FIND_ROOT_PATH="$(STAGING_PREFIX);$(TARGET_CROSS_TOP)" \
	-DCMAKE_LIBRARY_PATH=$(STAGING_LIB_DIR) \
	-DCMAKE_INCLUDE_PATH=$(STAGING_INCLUDE_DIR) \
	-DCMAKE_FIND_ROOT_PATH_MODE_PROGRAM=NEVER \
	-DCMAKE_FIND_ROOT_PATH_MODE_LIBRARY=ONLY \
	-DCMAKE_FIND_ROOT_PATH_MODE_INCLUDE=ONLY \
	-DCMAKE_STRIP=: \
	-DCMAKE_INSTALL_PREFIX=$(TARGET_PREFIX) \
	-DDL_LIBRARY=$(STAGING_DIR) \
	-DCMAKE_PREFIX_PATH=$(STAGING_DIR) \
	-DCMAKE_SKIP_RPATH=TRUE

TARGET_GOARCH=$(strip \
$(if $(filter buildroot-armeabi-ng buildroot-armeabihf buildroot-armv5eabi-ng buildroot-armv5eabi-ng-legacy, $(OPTWARE_TARGET)), arm, \
$(if $(filter buildroot-i686, $(OPTWARE_TARGET)), 386, \
$(if $(filter buildroot-mipsel-ng, $(OPTWARE_TARGET)), mipsle, \
$(if $(filter buildroot-ppc-603e ct-ng-ppc-e500v2, $(OPTWARE_TARGET)), ppc, \
$(if $(filter buildroot-x86_64, $(OPTWARE_TARGET)), amd64, \
$(TARGET_ARCH)))))))

CROSS_GCCGO_GOROOT ?= $(TARGET_CROSS_TOP)/$(EXACT_TARGET_NAME)

TARGET_GCCGO_GO_ENV= \
	GCCGO=$(TARGET_GCCGO) \
	GOROOT=$(CROSS_GCCGO_GOROOT) \
	GOARCH=$(TARGET_GOARCH) \
	CC=$(TARGET_CC) \
	CXX=$(TARGET_CXX)

TARGET_PATH=$(STAGING_PREFIX)/bin:$(STAGING_DIR)/bin:$(TARGET_PREFIX)/bin:$(TARGET_PREFIX)/sbin:/bin:/sbin:/usr/bin:/usr/sbin

STRIP_COMMAND ?= $(TARGET_STRIP) --remove-section=.comment --remove-section=.note --strip-unneeded

PATCH_LIBTOOL=$(SHELL) $(OPTWARE_TOP)/scripts/patch_libtool.sh -i \
	-e 's|^sys_lib_search_path_spec=.*"$$|sys_lib_search_path_spec="$(TARGET_LIBDIR) $(STAGING_LIB_DIR)"|' \
	-e 's|^sys_lib_dlsearch_path_spec=.*"$$|sys_lib_dlsearch_path_spec=""|' \
	-e 's|^hardcode_libdir_flag_spec=.*"$$|hardcode_libdir_flag_spec=""|' \
	-e 's|nmedit |$(TARGET_CROSS)nmedit |' \

# Clear these variables to remove assumptions
AR=
AS=
LD=
NM=
CC=
GCC=
CXX=
RANLIB=
STRIP=
LD_LIBRARY_PATH=

PACKAGES_CLEAN:=$(patsubst %,%-clean,$(PACKAGES))
PACKAGES_SOURCE:=$(patsubst %,%-source,$(PACKAGES))
PACKAGES_DIRCLEAN:=$(patsubst %,%-dirclean,$(PACKAGES))
PACKAGES_STAGE:=$(patsubst %,%-stage,$(PACKAGES))
PACKAGES_IPKG:=$(patsubst %,%-ipk,$(PACKAGES))

$(PACKAGES) : directories toolchain
$(PACKAGES_STAGE) : directories toolchain
%-stage : directories toolchain
$(PACKAGES_IPKG) : directories toolchain ipkg-utils
%-ipk : directories toolchain ipkg-utils

.PHONY: index
index: $(HOST_STAGING_DIR)/bin/ipk_indexer_html_sorted.sh $(PACKAGE_DIR)/Packages $(PACKAGE_DIR)/Packages.html

boost-packages: $(BOOST_PACKAGES)

boost-packages-ipk: $(patsubst %, %-ipk, $(BOOST_PACKAGES))

boost-packages-dirclean: $(patsubst %, %-dirclean, $(BOOST_PACKAGES))

boost-packages-check: $(patsubst %, %-check, $(BOOST_PACKAGES))

test-build:
	rm -f builds/failed.log
ifneq ($(MAKE_JOBS), )
	for package in $(PACKAGES); do \
		$(MAKE) $${package}-ipk -j$(MAKE_JOBS) || (echo "$${package}" >> builds/failed.log); \
	done
else
	for package in $(PACKAGES); do \
		$(MAKE) $${package}-ipk || (echo "$${package}" >> builds/failed.log); \
	done
endif

ifeq ($(PACKAGE_DIR),$(BASE_DIR)/packages)
    ifeq (,$(findstring -bootstrap,$(SPECIFIC_PACKAGES)))
$(PACKAGE_DIR)/Packages $(PACKAGE_DIR)/Packages.html: $(BUILD_DIR)/*.ipk
    else
$(PACKAGE_DIR)/Packages $(PACKAGE_DIR)/Packages.html: $(BUILD_DIR)/*.ipk $(BUILD_DIR)/*.xsh
    endif
	if ls $(BUILD_DIR)/*_$(TARGET_ARCH).xsh > /dev/null 2>&1; then \
		rm -f $(@D)/*_$(TARGET_ARCH).xsh ; \
		cp -fal $(BUILD_DIR)/*_$(TARGET_ARCH).xsh $(@D)/ ; \
	fi
	rm -f $(@D)/*_$(TARGET_ARCH).ipk
	cp -fal $(BUILD_DIR)/*_$(TARGET_ARCH).ipk $(@D)/
else
$(PACKAGE_DIR)/Packages $(PACKAGE_DIR)/Packages.html:
endif
	{ \
		cd $(PACKAGE_DIR); \
		$(IPKG_MAKE_INDEX) . > Packages; \
		gzip -c Packages > Packages.gz; \
		$(IPK_INDEXER_MAKE_HTML_INDEX); \
	}
	@echo "ALL DONE."

packages: $(PACKAGES_IPKG)
ifneq ($(MAKE_JOBS), )
	$(MAKE) index -j$(MAKE_JOBS)
else
	$(MAKE) index
endif

package-only: $(PACKAGES_IPKG)

.PHONY: all clean dirclean distclean directories packages source toolchain \
	buildroot-toolchain libuclibc++-toolchain \
	autoclean \
	check-dependencies \
	$(PACKAGES) $(PACKAGES_SOURCE) $(PACKAGES_DIRCLEAN) \
	$(PACKAGES_STAGE) $(PACKAGES_IPKG) \
	query-%

query-%:
	@echo $($(*))

TARGET_CC_VER = $(shell test -x "$(TARGET_CC)" && $(TARGET_CC) -dumpversion)

include $(shell ls make/*.mk)

.NOTPARALLEL: %/.configured %/.built %/.staged %.ipk %/.packaged

directories: $(DL_DIR) $(BUILD_DIR) $(STAGING_DIR) $(STAGING_PREFIX) \
	$(STAGING_LIB_DIR) $(STAGING_INCLUDE_DIR) $(TOOL_BUILD_DIR) \
	$(PACKAGE_DIR) $(TMPDIR) $(STAGING_PREFIX)/lib64

$(DL_DIR):
	mkdir $(DL_DIR)

$(BUILD_DIR):
	mkdir $(BUILD_DIR)

$(STAGING_DIR):
	mkdir $(STAGING_DIR)

$(STAGING_PREFIX):
	mkdir -p $(STAGING_PREFIX)

$(STAGING_LIB_DIR):
	mkdir $(STAGING_LIB_DIR)

$(STAGING_INCLUDE_DIR):
	mkdir $(STAGING_INCLUDE_DIR)

$(TOOL_BUILD_DIR):
	mkdir $(TOOL_BUILD_DIR)

$(PACKAGE_DIR):
	mkdir $(PACKAGE_DIR)

$(TMPDIR):
	mkdir $(TMPDIR)

$(STAGING_PREFIX)/lib64:
	ln -sf lib $(STAGING_PREFIX)/lib64

source: $(PACKAGES_SOURCE)

check-packages:
	@$(PERL) -w scripts/optware-check-package.pl --target=$(OPTWARE_TARGET) --objdump-path=$(TARGET_CROSS)objdump --base-dir=$(BASE_DIR) $(filter-out $(BUILD_DIR)/crosstool-native-%,$(wildcard $(BUILD_DIR)/*.ipk))

check-dependencies:
	@rm -rf test
	@mkdir test
	@READELF=$(TARGET_READELF) PACKAGESDIR=packages TEST=test scripts/dependencies_check.sh

autoclean:
	$(PERL) -w scripts/optware-autoclean.pl -v -C $(BASE_DIR)

clean: $(TARGETS_CLEAN) $(PACKAGES_CLEAN)
	find . -name '*~' -print | xargs /bin/rm -f
	find . -name '.*~' -print | xargs /bin/rm -f
	find . -name '.#*' -print | xargs /bin/rm -f

dirclean: $(PACKAGES_DIRCLEAN)

distclean:
	cd $(OPTWARE_TOP)
	rm -rf $(BUILD_DIR) $(STAGING_DIR) $(PACKAGE_DIR)
	rm -rf host
	rm -rf `ls platforms/toolchain-*.mk | sed 's|^platforms/toolchain-\(.*\)\.mk$$|\1|'`

toolclean:
	rm -rf $(TOOL_BUILD_DIR)

%-savespace:
	scripts/clean-workdir.sh $*

host/.configured:
	[ -d $(HOST_BUILD_DIR) ] || ( \
		if [ "$(OPTWARE_TARGET)" = $(shell basename $(BASE_DIR)) ]; \
			then mkdir -p ../host; ln -s ../host .; \
			else mkdir -p host; \
		fi; \
		mkdir -p $(HOST_BUILD_DIR) $(HOST_STAGING_PREFIX); \
	)
	[ -e $@ ] || touch $@

ifeq ($(DEFAULT_TARGET_PREFIX), $(TARGET_PREFIX))
DIRNAME_SUFFIX=
else
DIRNAME_SUFFIX=$(shell echo $(TARGET_PREFIX) | sed 's/[^a-zA-Z]/-/g')
endif

ifneq ($(DEFAULT_TARGET_PREFIX), $(TARGET_PREFIX))
%-target %$(DIRNAME_SUFFIX)/.configured:
	[ -e ${DL_DIR} ] || mkdir -p ${DL_DIR}
	[ -e $*$(DIRNAME_SUFFIX)/Makefile ] || ( \
		mkdir -p $*$(DIRNAME_SUFFIX) ; \
		cd $*$(DIRNAME_SUFFIX) ; \
		echo "OPTWARE_TARGET=$*" > Makefile ; \
		echo "TARGET_PREFIX=$(TARGET_PREFIX)" >> Makefile ; \
		echo "include ../Makefile" >> Makefile ; \
		ln -s ../downloads downloads ; \
		ln -s ../make make ; \
		ln -s ../scripts scripts ; \
		ln -s ../sources sources ; \
	)
	touch $*$(DIRNAME_SUFFIX)/.configured
else
%-target %/.configured:
	[ -e ${DL_DIR} ] || mkdir -p ${DL_DIR}
	[ -e $*/Makefile ] || ( \
		mkdir -p $* ; \
		cd $* ; \
		echo "OPTWARE_TARGET=$*" > Makefile ; \
		echo "include ../Makefile" >> Makefile ; \
		ln -s ../downloads downloads ; \
		ln -s ../make make ; \
		ln -s ../scripts scripts ; \
		ln -s ../sources sources ; \
	)
	touch $*/.configured
endif

make/%.mk:
	PKG_UP=$$(echo $* | tr [a-z\-] [A-Z_]);			\
	sed -e "s/<foo>/$*/g" -e "s/<FOO>/$${PKG_UP}/g"		\
		 -e '6,11d' make/template.mk > $@

ifeq ($(OPTWARE_TOP), $(BASE_DIR))

# Use this to build *all* feeds (all targets from `cat Optware_targets_list`)

OPTWARE_BUILD_TARGETS:=$(shell echo `cat Optware_targets_list`)

ifneq ($(DEFAULT_TARGET_PREFIX), $(TARGET_PREFIX))
%/.configured:
	[ -e ${DL_DIR} ] || mkdir -p ${DL_DIR}
	[ -e $*/Makefile ] || ( \
		mkdir -p $* ; \
		cd $* ; \
		echo "OPTWARE_TARGET=$*" > Makefile ; \
		echo "include ../Makefile" >> Makefile ; \
		ln -s ../downloads downloads ; \
		ln -s ../make make ; \
		ln -s ../scripts scripts ; \
		ln -s ../sources sources ; \
	)
	touch $*/.configured
endif

%-feed: %/.configured
ifneq ($(MAKE_JOBS), )
	$(MAKE) -C $* directories -j$(MAKE_JOBS)
	$(MAKE) -C $* host/.configured -j$(MAKE_JOBS)
	$(MAKE) -C $* ipkg-utils -j$(MAKE_JOBS)
	$(MAKE) -C $* toolchain -j$(MAKE_JOBS)
	$(MAKE) -C $* packages -j$(MAKE_JOBS)
else
	$(MAKE) -C $* directories
	$(MAKE) -C $* host/.configured
	$(MAKE) -C $* ipkg-utils
	$(MAKE) -C $* toolchain
	$(MAKE) -C $* packages
endif

%-feed-build: %/.configured
ifneq ($(MAKE_JOBS), )
	$(MAKE) -C $* directories -j$(MAKE_JOBS)
	$(MAKE) -C $* host/.configured -j$(MAKE_JOBS)
	$(MAKE) -C $* ipkg-utils -j$(MAKE_JOBS)
	$(MAKE) -C $* toolchain -j$(MAKE_JOBS)
	$(MAKE) -C $* package-only -j$(MAKE_JOBS)
else
	$(MAKE) -C $* directories
	$(MAKE) -C $* host/.configured
	$(MAKE) -C $* ipkg-utils
	$(MAKE) -C $* toolchain
	$(MAKE) -C $* package-only
endif

%-feed-test-build: %/.configured
ifneq ($(MAKE_JOBS), )
	$(MAKE) -C $* directories -j$(MAKE_JOBS)
	$(MAKE) -C $* host/.configured -j$(MAKE_JOBS)
	$(MAKE) -C $* ipkg-utils -j$(MAKE_JOBS)
	$(MAKE) -C $* toolchain -j$(MAKE_JOBS)
	$(MAKE) -C $* test-build -j$(MAKE_JOBS)
else
	$(MAKE) -C $* directories
	$(MAKE) -C $* host/.configured
	$(MAKE) -C $* ipkg-utils
	$(MAKE) -C $* toolchain
	$(MAKE) -C $* test-build
endif

allfeeds: $(patsubst %,%-feed,$(OPTWARE_BUILD_TARGETS))

endif

{'repo_name': 'Optware/Optware-ng', 'stars': '238', 'repo_language': 'Makefile', 'file_name': 'createinstance.sh', 'mime_type': 'text/x-shellscript', 'hash': 6413286331060122876, 'source_dataset': 'data'}


/*
	@author Tony Beltramelli www.tonybeltramelli.com - created 05/09/15
*/

$(document).ready(function(){main();});

var LOCAL_SERVER_ADDRESS = "swat:serverAddress";
var LOCAL_SERVER_PORT = "swat:serverPort";

var serverAddress;
var serverPort;

function main ()
{
	$("main").hide();

	serverAddress = localStorage.getItem(LOCAL_SERVER_ADDRESS);
	serverPort = localStorage.getItem(LOCAL_SERVER_PORT);

	if(serverAddress) $("#serverAddress").val(serverAddress);
	if(serverPort) $("#serverPort").val(serverPort);

	$("#saveButton").click(function(e){
		serverAddress = $("#serverAddress").val();
		serverPort = $("#serverPort").val();

		localStorage.setItem(LOCAL_SERVER_ADDRESS, serverAddress);
		localStorage.setItem(LOCAL_SERVER_PORT, serverPort);

		$(this).parent().hide();
		$("main").show();
	});

	$(".keypad li").on("touchstart", function(e){
		timestamp = Date.now();

		e.stopPropagation();
		e.preventDefault();

		$(this).css({
			background: "#1caaff",
			color: "#fcfcfc"
		});

		var label = $(this).find("span").text().charCodeAt(0);
		send(timestamp, label);
	});

	$(".keypad li").on("touchend", function(e){
		$(this).css({
			background: "#fcfcfc",
			color: "#1caaff"
		});
	});
}

function send(timestamp, label)
{
	var data = {
		sensor_name: "labels",
		data_points:[{
			timestamp: timestamp,
			label: label
		}]
	};

	$.ajax({
		url: serverAddress+":"+serverPort,
		type: "POST",
		data: JSON.stringify(data),
		contentType: "text/plain"
	});
}

{'repo_name': 'tonybeltramelli/Deep-Spying', 'stars': '172', 'repo_language': 'Python', 'file_name': 'FeatureExtractor.py', 'mime_type': 'text/x-python', 'hash': -877517969601131695, 'source_dataset': 'data'}


Microsoft Visual Studio Solution File, Format Version 10.00
# Visual C++ Express 2008
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "qztest", "qztest.vcproj", "{7632B767-D089-4F15-8B1E-C4B3F9EBF592}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "quazip", "..\quazip\quazip.vcproj", "{E4AC5F56-B711-4F0E-BC83-CDE8B6CD53AD}"
EndProject
Global
	GlobalSection(SolutionConfigurationPlatforms) = preSolution
		Debug|Win32 = Debug|Win32
		Release|Win32 = Release|Win32
	EndGlobalSection
	GlobalSection(ProjectConfigurationPlatforms) = postSolution
		{7632B767-D089-4F15-8B1E-C4B3F9EBF592}.Debug|Win32.ActiveCfg = Debug|Win32
		{7632B767-D089-4F15-8B1E-C4B3F9EBF592}.Debug|Win32.Build.0 = Debug|Win32
		{7632B767-D089-4F15-8B1E-C4B3F9EBF592}.Release|Win32.ActiveCfg = Release|Win32
		{7632B767-D089-4F15-8B1E-C4B3F9EBF592}.Release|Win32.Build.0 = Release|Win32
		{E4AC5F56-B711-4F0E-BC83-CDE8B6CD53AD}.Debug|Win32.ActiveCfg = Debug|Win32
		{E4AC5F56-B711-4F0E-BC83-CDE8B6CD53AD}.Debug|Win32.Build.0 = Debug|Win32
		{E4AC5F56-B711-4F0E-BC83-CDE8B6CD53AD}.Release|Win32.ActiveCfg = Release|Win32
		{E4AC5F56-B711-4F0E-BC83-CDE8B6CD53AD}.Release|Win32.Build.0 = Release|Win32
	EndGlobalSection
	GlobalSection(SolutionProperties) = preSolution
		HideSolutionNode = FALSE
	EndGlobalSection
EndGlobal

{'repo_name': 'yiminyangguang520/qt', 'stars': '464', 'repo_language': 'C++', 'file_name': 'QSpinBoxDemo.pro', 'mime_type': 'text/plain', 'hash': 6485214060889665375, 'source_dataset': 'data'}


/*
 * Copyright (c) 1998, 2017, Oracle and/or its affiliates. All rights reserved.
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 *
 * This code is free software; you can redistribute it and/or modify it
 * under the terms of the GNU General Public License version 2 only, as
 * published by the Free Software Foundation.  Oracle designates this
 * particular file as subject to the "Classpath" exception as provided
 * by Oracle in the LICENSE file that accompanied this code.
 *
 * This code is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 * version 2 for more details (a copy is included in the LICENSE file that
 * accompanied this code).
 *
 * You should have received a copy of the GNU General Public License version
 * 2 along with this work; if not, write to the Free Software Foundation,
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
 *
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
 * or visit www.oracle.com if you need additional information or have any
 * questions.
 */

package com.sun.tools.jdi;

import com.sun.jdi.ByteType;
import com.sun.jdi.InvalidTypeException;
import com.sun.jdi.PrimitiveValue;
import com.sun.jdi.VirtualMachine;

public class ByteTypeImpl extends PrimitiveTypeImpl implements ByteType {

    ByteTypeImpl(VirtualMachine vm) {
        super(vm);
    }

    public String signature() {
        return String.valueOf((char)JDWP.Tag.BYTE);
    }

    PrimitiveValue convert(PrimitiveValue value) throws InvalidTypeException {
        return vm.mirrorOf(((PrimitiveValueImpl)value).checkedByteValue());
    }
}

{'repo_name': 'openjdk/jdk', 'stars': '2204', 'repo_language': 'Java', 'file_name': 'fttype1.c', 'mime_type': 'text/x-c', 'hash': -4679544142480291781, 'source_dataset': 'data'}


<?php

$_PLUGIN_CONFIG['LANG'] = array(
	'NAME'=>'Quick Links',
	'DESCRIPTION'=>'Quick access to the administration panel.',
	'HOME'=>'Home',
	'DASHBOARD'=>'Dashboard',
	'NEW_SIMPLE_POST'=>'New Simple post',
	'NEW_VIDEO_POST'=>'New Video post',
	'NEW_QUOTE_POST'=>'New Quote post'
);

?>

{'repo_name': 'dignajar/nibbleblog', 'stars': '220', 'repo_language': 'PHP', 'file_name': 'da_DK.bit', 'mime_type': 'text/x-php', 'hash': 7022101256700028900, 'source_dataset': 'data'}


// Code generated by smithy-go-codegen DO NOT EDIT.

package kendra

import (
	"context"
	awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
	"github.com/aws/aws-sdk-go-v2/aws/retry"
	"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
	"github.com/aws/aws-sdk-go-v2/service/kendra/types"
	smithy "github.com/awslabs/smithy-go"
	"github.com/awslabs/smithy-go/middleware"
	smithyhttp "github.com/awslabs/smithy-go/transport/http"
)

// Searches an active index. Use this API to search your documents using query. The
// Query operation enables to do faceted search and to filter results based on
// document attributes. It also enables you to provide user context that Amazon
// Kendra uses to enforce document access control in the search results. Amazon
// Kendra searches your index for text content and question and answer (FAQ)
// content. By default the response contains three types of results.
//
//     *
// Relevant passages
//
//     * Matching FAQs
//
//     * Relevant documents
//
// You can
// specify that the query return only one type of result using the
// QueryResultTypeConfig parameter.
func (c *Client) Query(ctx context.Context, params *QueryInput, optFns ...func(*Options)) (*QueryOutput, error) {
	stack := middleware.NewStack("Query", smithyhttp.NewStackRequest)
	options := c.options.Copy()
	for _, fn := range optFns {
		fn(&options)
	}
	addawsAwsjson11_serdeOpQueryMiddlewares(stack)
	awsmiddleware.AddRequestInvocationIDMiddleware(stack)
	smithyhttp.AddContentLengthMiddleware(stack)
	AddResolveEndpointMiddleware(stack, options)
	v4.AddComputePayloadSHA256Middleware(stack)
	retry.AddRetryMiddlewares(stack, options)
	addHTTPSignerV4Middleware(stack, options)
	awsmiddleware.AddAttemptClockSkewMiddleware(stack)
	addClientUserAgent(stack)
	smithyhttp.AddErrorCloseResponseBodyMiddleware(stack)
	smithyhttp.AddCloseResponseBodyMiddleware(stack)
	addOpQueryValidationMiddleware(stack)
	stack.Initialize.Add(newServiceMetadataMiddleware_opQuery(options.Region), middleware.Before)
	addRequestIDRetrieverMiddleware(stack)
	addResponseErrorMiddleware(stack)

	for _, fn := range options.APIOptions {
		if err := fn(stack); err != nil {
			return nil, err
		}
	}
	handler := middleware.DecorateHandler(smithyhttp.NewClientHandler(options.HTTPClient), stack)
	result, metadata, err := handler.Handle(ctx, params)
	if err != nil {
		return nil, &smithy.OperationError{
			ServiceID:     ServiceID,
			OperationName: "Query",
			Err:           err,
		}
	}
	out := result.(*QueryOutput)
	out.ResultMetadata = metadata
	return out, nil
}

type QueryInput struct {
	// Provides information that determines how the results of the query are sorted.
	// You can set the field that Amazon Kendra should sort the results on, and specify
	// whether the results should be sorted in ascending or descending order. In the
	// case of ties in sorting the results, the results are sorted by relevance. If you
	// don't provide sorting configuration, the results are sorted by the relevance
	// that Amazon Kendra determines for the result.
	SortingConfiguration *types.SortingConfiguration
	// The unique identifier of the index to search. The identifier is returned in the
	// response from the operation.
	IndexId *string
	// The text to search for.
	QueryText *string
	// Enables filtered searches based on document attributes. You can only provide one
	// attribute filter; however, the AndAllFilters, NotFilter, and OrAllFilters
	// parameters contain a list of other filters. The AttributeFilter parameter
	// enables you to create a set of filtering rules that a document must satisfy to
	// be included in the query results.
	AttributeFilter *types.AttributeFilter
	// Query results are returned in pages the size of the PageSize parameter. By
	// default, Amazon Kendra returns the first page of results. Use this parameter to
	// get result pages after the first one.
	PageNumber *int32
	// Sets the number of results that are returned in each page of results. The
	// default page size is 10. The maximum number of results returned is 100. If you
	// ask for more than 100 results, only 100 are returned.
	PageSize *int32
	// An array of documents attributes. Amazon Kendra returns a count for each
	// attribute key specified. You can use this information to help narrow the search
	// for your user.
	Facets []*types.Facet
	// Sets the type of query. Only results for the specified query type are returned.
	QueryResultTypeFilter types.QueryResultType
	// An array of document attributes to include in the response. No other document
	// attributes are included in the response. By default all document attributes are
	// included in the response.
	RequestedDocumentAttributes []*string
}

type QueryOutput struct {
	// The results of the search.
	ResultItems []*types.QueryResultItem
	// Contains the facet results. A FacetResult contains the counts for each attribute
	// key that was specified in the Facets input parameter.
	FacetResults []*types.FacetResult
	// The number of items returned by the search. Use this to determine when you have
	// requested the last set of results.
	TotalNumberOfResults *int32
	// The unique identifier for the search. You use QueryId to identify the search
	// when using the feedback API.
	QueryId *string

	// Metadata pertaining to the operation's result.
	ResultMetadata middleware.Metadata
}

func addawsAwsjson11_serdeOpQueryMiddlewares(stack *middleware.Stack) {
	stack.Serialize.Add(&awsAwsjson11_serializeOpQuery{}, middleware.After)
	stack.Deserialize.Add(&awsAwsjson11_deserializeOpQuery{}, middleware.After)
}

func newServiceMetadataMiddleware_opQuery(region string) awsmiddleware.RegisterServiceMetadata {
	return awsmiddleware.RegisterServiceMetadata{
		Region:        region,
		ServiceID:     ServiceID,
		SigningName:   "kendra",
		OperationName: "Query",
	}
}

{'repo_name': 'aws/aws-sdk-go-v2', 'stars': '606', 'repo_language': 'Go', 'file_name': 'endpoints.go', 'mime_type': 'text/plain', 'hash': -487197765045750301, 'source_dataset': 'data'}


# logging for XMLTV importer
#
# One can simply use
# import log
# print>>log, "Some text"
# because the log unit looks enough like a file!

import sys
from cStringIO import StringIO
import threading

logfile = None
# Need to make our operations thread-safe.
mutex = None

size = None

def open(buffersize = 16384):
	global logfile, mutex, size
	if logfile is None:
		logfile = StringIO()
		mutex = threading.Lock()
		size = buffersize

def write(data):
	global logfile, mutex
	mutex.acquire()
	try:
		if logfile.tell() > size:
			# Do a sort of 16k round robin
			logfile.reset()
		logfile.write(data)
	finally:
		mutex.release()
	sys.stdout.write(data)

def getvalue():
	global logfile, mutex
	mutex.acquire()
	try:
		pos = logfile.tell()
		head = logfile.read()
		logfile.reset()
		tail = logfile.read(pos)
	finally:
		mutex.release()
	return head + tail

def close():
	global logfile
	if logfile:
		logfile.close()
		logfile = None

{'repo_name': 'openatv/enigma2', 'stars': '123', 'repo_language': 'Python', 'file_name': 'Makefile.am', 'mime_type': 'text/x-makefile', 'hash': -3771811874328461270, 'source_dataset': 'data'}


/* zutil.h -- internal interface and configuration of the compression library
 * Copyright (C) 1995-2002 Jean-loup Gailly.
 * For conditions of distribution and use, see copyright notice in zlib.h
 */

/* WARNING: this file should *not* be used by applications. It is
   part of the implementation of the compression library and is
   subject to change. Applications should only use zlib.h.
 */

/* @(#) $Id$ */

#ifndef _Z_UTIL_H
#define _Z_UTIL_H

#include "zlib.h"

#ifdef STDC
#  include <stddef.h>
#  include <string.h>
#  include <stdlib.h>
#endif
#ifdef NO_ERRNO_H
    extern int errno;
#else
#   include <errno.h>
#endif

#ifndef local
#  define local static
#endif
/* compile with -Dlocal if your debugger can't find static symbols */

typedef unsigned char  uch;
typedef uch FAR uchf;
typedef unsigned short ush;
typedef ush FAR ushf;
typedef unsigned long  ulg;

#define ERR_RETURN(strm,err) \
  return (strm->msg = (char*)ERR_MSG(err), (err))
/* To be used only when the state is known to be valid */

        /* common constants */

#ifndef DEF_WBITS
#  define DEF_WBITS MAX_WBITS
#endif
/* default windowBits for decompression. MAX_WBITS is for compression only */

#if MAX_MEM_LEVEL >= 8
#  define DEF_MEM_LEVEL 8
#else
#  define DEF_MEM_LEVEL  MAX_MEM_LEVEL
#endif
/* default memLevel */

#define STORED_BLOCK 0
#define STATIC_TREES 1
#define DYN_TREES    2
/* The three kinds of block type */

#define MIN_MATCH  3
#define MAX_MATCH  258
/* The minimum and maximum match lengths */

#define PRESET_DICT 0x20 /* preset dictionary flag in zlib header */

        /* target dependencies */

#ifdef MSDOS
#  define OS_CODE  0x00
#  if defined(__TURBOC__) || defined(__BORLANDC__)
#    if(__STDC__ == 1) && (defined(__LARGE__) || defined(__COMPACT__))
       /* Allow compilation with ANSI keywords only enabled */
       void _Cdecl farfree( void *block );
       void *_Cdecl farmalloc( unsigned long nbytes );
#    else
#     include <alloc.h>
#    endif
#  else /* MSC or DJGPP */
#  endif
#endif

#ifdef OS2
#  define OS_CODE  0x06
#endif

#ifdef WIN32 /* Window 95 & Windows NT */
#  define OS_CODE  0x0b
#endif

#if defined(VAXC) || defined(VMS)
#  define OS_CODE  0x02
#  define F_OPEN(name, mode) \
     ft_fopen((name), (mode), "mbc=60", "ctx=stm", "rfm=fix", "mrs=512")
#endif

#ifdef AMIGA
#  define OS_CODE  0x01
#endif

#if defined(ATARI) || defined(atarist)
#  define OS_CODE  0x05
#endif

#if defined(MACOS) || defined(TARGET_OS_MAC)
#  define OS_CODE  0x07
#  if defined(__MWERKS__) && __dest_os != __be_os && __dest_os != __win32_os
#    include <unix.h> /* for fdopen */
#  else
#    ifndef fdopen
#      define fdopen(fd,mode) NULL /* No fdopen() */
#    endif
#  endif
#endif

#ifdef __50SERIES /* Prime/PRIMOS */
#  define OS_CODE  0x0F
#endif

#ifdef TOPS20
#  define OS_CODE  0x0a
#endif

#if defined(_BEOS_) || defined(RISCOS)
#  define fdopen(fd,mode) NULL /* No fdopen() */
#endif

#if (defined(_MSC_VER) && (_MSC_VER > 600))
#  define fdopen(fd,type)  _fdopen(fd,type)
#endif

        /* Common defaults */

#ifndef OS_CODE
#  define OS_CODE  0x03  /* assume Unix */
#endif

#ifndef F_OPEN
#  define F_OPEN(name, mode) ft_fopen((name), (mode))
#endif

         /* functions */

#ifdef HAVE_STRERROR
   extern char *strerror OF((int));
#  define zstrerror(errnum) strerror(errnum)
#else
#  define zstrerror(errnum) ""
#endif

#if defined(pyr)
#  define NO_MEMCPY
#endif
#if defined(SMALL_MEDIUM) && !defined(_MSC_VER) && !defined(__SC__)
 /* Use our own functions for small and medium model with MSC <= 5.0.
  * You may have to use the same strategy for Borland C (untested).
  * The __SC__ check is for Symantec.
  */
#  define NO_MEMCPY
#endif
#if defined(STDC) && !defined(HAVE_MEMCPY) && !defined(NO_MEMCPY)
#  define HAVE_MEMCPY
#endif
#ifdef HAVE_MEMCPY
#  ifdef SMALL_MEDIUM /* MSDOS small or medium model */
#    define zmemcpy _fmemcpy
#    define zmemcmp _fmemcmp
#    define zmemzero(dest, len) _fmemset(dest, 0, len)
#  else
#    define zmemcpy ft_memcpy
#    define zmemcmp ft_memcmp
#    define zmemzero(dest, len) ft_memset(dest, 0, len)
#  endif
#else
   extern void zmemcpy  OF((Bytef* dest, const Bytef* source, uInt len));
   extern int  zmemcmp  OF((const Bytef* s1, const Bytef* s2, uInt len));
   extern void zmemzero OF((Bytef* dest, uInt len));
#endif

/* Diagnostic functions */
#ifdef DEBUG
#  include <stdio.h>
   extern int z_verbose;
   extern void z_error    OF((char *m));
#  define Assert(cond,msg) {if(!(cond)) z_error(msg);}
#  define Trace(x) {if (z_verbose>=0) fprintf x ;}
#  define Tracev(x) {if (z_verbose>0) fprintf x ;}
#  define Tracevv(x) {if (z_verbose>1) fprintf x ;}
#  define Tracec(c,x) {if (z_verbose>0 && (c)) fprintf x ;}
#  define Tracecv(c,x) {if (z_verbose>1 && (c)) fprintf x ;}
#else
#  define Assert(cond,msg)
#  define Trace(x)
#  define Tracev(x)
#  define Tracevv(x)
#  define Tracec(c,x)
#  define Tracecv(c,x)
#endif

typedef uLong (*check_func) OF((uLong check, const Bytef *buf,
                                uInt len));
local voidpf zcalloc OF((voidpf opaque, unsigned items, unsigned size));
local void   zcfree  OF((voidpf opaque, voidpf ptr));

#define ZALLOC(strm, items, size) \
           (*((strm)->zalloc))((strm)->opaque, (items), (size))
#define ZFREE(strm, addr)  (*((strm)->zfree))((strm)->opaque, (voidpf)(addr))
#define TRY_FREE(s, p) {if (p) ZFREE(s, p);}

#endif /* _Z_UTIL_H */

{'repo_name': 'musescore/MuseScore', 'stars': '4930', 'repo_language': 'C++', 'file_name': 'CMakeLists.txt', 'mime_type': 'text/plain', 'hash': 8331715330205794949, 'source_dataset': 'data'}


/*
 *  This file is part of Player Analytics (Plan).
 *
 *  Plan is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU Lesser General Public License v3 as published by
 *  the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.
 *
 *  Plan is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU Lesser General Public License for more details.
 *
 *  You should have received a copy of the GNU Lesser General Public License
 *  along with Plan. If not, see <https://www.gnu.org/licenses/>.
 */
package com.djrapitops.plan.gathering.listeners.bukkit;

import com.djrapitops.plan.delivery.domain.Nickname;
import com.djrapitops.plan.gathering.cache.NicknameCache;
import com.djrapitops.plan.identification.ServerInfo;
import com.djrapitops.plan.storage.database.DBSystem;
import com.djrapitops.plan.storage.database.transactions.events.NicknameStoreTransaction;
import com.djrapitops.plan.utilities.logging.ErrorContext;
import com.djrapitops.plan.utilities.logging.ErrorLogger;
import com.djrapitops.plugin.logging.L;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.player.AsyncPlayerChatEvent;

import javax.inject.Inject;
import java.util.UUID;

/**
 * Event Listener for AsyncPlayerChatEvents.
 *
 * @author Rsl1122
 */
public class ChatListener implements Listener {

    private final ServerInfo serverInfo;
    private final DBSystem dbSystem;
    private final NicknameCache nicknameCache;
    private final ErrorLogger errorLogger;

    @Inject
    public ChatListener(
            ServerInfo serverInfo,
            DBSystem dbSystem,
            NicknameCache nicknameCache,
            ErrorLogger errorLogger
    ) {
        this.serverInfo = serverInfo;
        this.dbSystem = dbSystem;
        this.nicknameCache = nicknameCache;
        this.errorLogger = errorLogger;
    }

    @EventHandler(priority = EventPriority.MONITOR)
    public void onChat(AsyncPlayerChatEvent event) {
        if (event.isCancelled()) {
            return;
        }

        try {
            actOnChatEvent(event);
        } catch (Exception e) {
            errorLogger.log(L.ERROR, e, ErrorContext.builder().related(event).build());
        }
    }

    private void actOnChatEvent(AsyncPlayerChatEvent event) {
        long time = System.currentTimeMillis();
        Player player = event.getPlayer();
        UUID uuid = player.getUniqueId();
        String displayName = player.getDisplayName();

        dbSystem.getDatabase().executeTransaction(new NicknameStoreTransaction(
                uuid, new Nickname(displayName, time, serverInfo.getServerUUID()),
                (playerUUID, name) -> nicknameCache.getDisplayName(playerUUID).map(name::equals).orElse(false)
        ));
    }
}

{'repo_name': 'plan-player-analytics/Plan', 'stars': '252', 'repo_language': 'Java', 'file_name': 'BungeeSystemTest.java', 'mime_type': 'text/x-java', 'hash': 8589519079060256299, 'source_dataset': 'data'}


#!/usr/bin/env python
#
# Public Domain 2014-2019 MongoDB, Inc.
# Public Domain 2008-2014 WiredTiger, Inc.
#
# This is free and unencumbered software released into the public domain.
#
# Anyone is free to copy, modify, publish, use, compile, sell, or
# distribute this software, either in source code form or as a compiled
# binary, for any purpose, commercial or non-commercial, and by any
# means.
#
# In jurisdictions that recognize copyright laws, the author or authors
# of this software dedicate any and all copyright interest in the
# software to the public domain. We make this dedication for the benefit
# of the public at large and to the detriment of our heirs and
# successors. We intend this dedication to be an overt act of
# relinquishment in perpetuity of all present and future rights to this
# software under copyright law.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
# IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
# OTHER DEALINGS IN THE SOFTWARE.

import wiredtiger, wttest
from wtdataset import SimpleDataSet
from helper import copy_wiredtiger_home

# test_bug014.py
#    JIRA WT-2115: fast-delete pages can be incorrectly lost due to a crash.
class test_bug014(wttest.WiredTigerTestCase):
    def test_bug014(self):
        # Populate a table with 1000 keys on small pages.
        uri = 'table:test_bug014'
        ds = SimpleDataSet(self, uri, 1000,
                           config='allocation_size=512,leaf_page_max=512')
        ds.populate()

        # Reopen it so we can fast-delete pages.
        self.reopen_conn()

        # Truncate a chunk of the key/value pairs inside a transaction.
        self.session.begin_transaction(None)
        start = self.session.open_cursor(uri, None)
        start.set_key(ds.key(250))
        end = self.session.open_cursor(uri, None)
        end.set_key(ds.key(500))
        self.session.truncate(None, start, end, None)
        start.close()
        end.close()

        # With the truncation uncommitted, checkpoint the database.
        ckpt_session = self.conn.open_session()
        ckpt_session.checkpoint(None)
        ckpt_session.close()

        # Simulate a crash by copying to a new directory.
        copy_wiredtiger_home(".", "RESTART")

        # Open the new directory.
        conn = self.setUpConnectionOpen("RESTART")
        session = self.setUpSessionOpen(conn)
        cursor = session.open_cursor(uri)

        # Confirm all of the records are there.
        for i in range(1, 1001):
            cursor.set_key(ds.key(i))
            self.assertEqual(cursor.search(), 0)

        conn.close()

if __name__ == '__main__':
    wttest.run()

{'repo_name': 'wiredtiger/wiredtiger', 'stars': '1562', 'repo_language': 'C', 'file_name': '__init__.py', 'mime_type': 'text/x-python', 'hash': -2473140215707633304, 'source_dataset': 'data'}


{'repo_name': 'dotnetGame/MineCase', 'stars': '466', 'repo_language': 'C#', 'file_name': 'cyan.json', 'mime_type': 'text/plain', 'hash': -8505639403623078809, 'source_dataset': 'data'}


/*!
@file
Forward declares `boost::hana::remove_range` and `boost::hana::remove_range_c`.

@copyright Louis Dionne 2013-2016
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
 */

#ifndef BOOST_HANA_FWD_REMOVE_RANGE_HPP
#define BOOST_HANA_FWD_REMOVE_RANGE_HPP

#include <boost/hana/config.hpp>
#include <boost/hana/core/when.hpp>

#include <cstddef>

BOOST_HANA_NAMESPACE_BEGIN
    //! Remove the elements inside a given range of indices from a sequence.
    //! @ingroup group-Sequence
    //!
    //! `remove_range` returns a new sequence identical to the original,
    //! except that elements at indices in the provided range are removed.
    //! Specifically, `remove_range([x0, ..., xn], from, to)` is a new
    //! sequence equivalent to `[x0, ..., x_from-1, x_to, ..., xn]`.
    //!
    //!
    //! @note
    //! The behavior is undefined if the range contains any index out of the
    //! bounds of the sequence.
    //!
    //!
    //! @param xs
    //! A sequence from which elements are removed.
    //!
    //! @param [from, to)
    //! An half-open interval of `IntegralConstant`s representing the indices
    //! of the elements to be removed from the sequence. The `IntegralConstant`s
    //! in the half-open interval must be non-negative and in the bounds of
    //! the sequence. The half-open interval must also be valid, meaning that
    //! `from <= to`.
    //!
    //!
    //! Example
    //! -------
    //! @include example/remove_range.cpp
#ifdef BOOST_HANA_DOXYGEN_INVOKED
    constexpr auto remove_range = [](auto&& xs, auto const& from, auto const& to) {
        return tag-dispatched;
    };
#else
    template <typename S, typename = void>
    struct remove_range_impl : remove_range_impl<S, when<true>> { };

    struct remove_range_t {
        template <typename Xs, typename From, typename To>
        constexpr auto operator()(Xs&& xs, From const& from, To const& to) const;
    };

    constexpr remove_range_t remove_range{};
#endif

    //! Equivalent to `remove_range`; provided for convenience.
    //! @ingroup group-Sequence
    //!
    //!
    //! Example
    //! -------
    //! @include example/remove_range_c.cpp
#ifdef BOOST_HANA_DOXYGEN_INVOKED
    template <std::size_t from, std::size_t to>
    constexpr auto remove_range_c = [](auto&& xs) {
        return hana::remove_range(forwarded(xs), hana::size_c<from>, hana::size_c<to>);
    };
#else
    template <std::size_t from, std::size_t to>
    struct remove_range_c_t;

    template <std::size_t from, std::size_t to>
    constexpr remove_range_c_t<from, to> remove_range_c{};
#endif
BOOST_HANA_NAMESPACE_END

#endif // !BOOST_HANA_FWD_REMOVE_RANGE_HPP

{'repo_name': 'textileio/photos', 'stars': '236', 'repo_language': 'TypeScript', 'file_name': 'config.yml', 'mime_type': 'text/plain', 'hash': -2561474514802215682, 'source_dataset': 'data'}


/*
 * Copyright (C) 2007 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.example.android.apis.graphics;

import android.os.Bundle;
import android.app.Dialog;
import android.content.Context;
import android.graphics.*;
import android.view.MotionEvent;
import android.view.View;

public class ColorPickerDialog extends Dialog {

    public interface OnColorChangedListener {
        void colorChanged(int color);
    }

    private OnColorChangedListener mListener;
    private int mInitialColor;

    private static class ColorPickerView extends View {
        private Paint mPaint;
        private Paint mCenterPaint;
        private final int[] mColors;
        private OnColorChangedListener mListener;

        ColorPickerView(Context c, OnColorChangedListener l, int color) {
            super(c);
            mListener = l;
            mColors = new int[] {
                0xFFFF0000, 0xFFFF00FF, 0xFF0000FF, 0xFF00FFFF, 0xFF00FF00,
                0xFFFFFF00, 0xFFFF0000
            };
            Shader s = new SweepGradient(0, 0, mColors, null);

            mPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
            mPaint.setShader(s);
            mPaint.setStyle(Paint.Style.STROKE);
            mPaint.setStrokeWidth(32);

            mCenterPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
            mCenterPaint.setColor(color);
            mCenterPaint.setStrokeWidth(5);
        }

        private boolean mTrackingCenter;
        private boolean mHighlightCenter;

        @Override
        protected void onDraw(Canvas canvas) {
            float r = CENTER_X - mPaint.getStrokeWidth()*0.5f;

            canvas.translate(CENTER_X, CENTER_X);

            canvas.drawOval(new RectF(-r, -r, r, r), mPaint);
            canvas.drawCircle(0, 0, CENTER_RADIUS, mCenterPaint);

            if (mTrackingCenter) {
                int c = mCenterPaint.getColor();
                mCenterPaint.setStyle(Paint.Style.STROKE);

                if (mHighlightCenter) {
                    mCenterPaint.setAlpha(0xFF);
                } else {
                    mCenterPaint.setAlpha(0x80);
                }
                canvas.drawCircle(0, 0,
                                  CENTER_RADIUS + mCenterPaint.getStrokeWidth(),
                                  mCenterPaint);

                mCenterPaint.setStyle(Paint.Style.FILL);
                mCenterPaint.setColor(c);
            }
        }

        @Override
        protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
            setMeasuredDimension(CENTER_X*2, CENTER_Y*2);
        }

        private static final int CENTER_X = 100;
        private static final int CENTER_Y = 100;
        private static final int CENTER_RADIUS = 32;

        private int floatToByte(float x) {
            int n = java.lang.Math.round(x);
            return n;
        }
        private int pinToByte(int n) {
            if (n < 0) {
                n = 0;
            } else if (n > 255) {
                n = 255;
            }
            return n;
        }

        private int ave(int s, int d, float p) {
            return s + java.lang.Math.round(p * (d - s));
        }

        private int interpColor(int colors[], float unit) {
            if (unit <= 0) {
                return colors[0];
            }
            if (unit >= 1) {
                return colors[colors.length - 1];
            }

            float p = unit * (colors.length - 1);
            int i = (int)p;
            p -= i;

            // now p is just the fractional part [0...1) and i is the index
            int c0 = colors[i];
            int c1 = colors[i+1];
            int a = ave(Color.alpha(c0), Color.alpha(c1), p);
            int r = ave(Color.red(c0), Color.red(c1), p);
            int g = ave(Color.green(c0), Color.green(c1), p);
            int b = ave(Color.blue(c0), Color.blue(c1), p);

            return Color.argb(a, r, g, b);
        }

        private int rotateColor(int color, float rad) {
            float deg = rad * 180 / 3.1415927f;
            int r = Color.red(color);
            int g = Color.green(color);
            int b = Color.blue(color);

            ColorMatrix cm = new ColorMatrix();
            ColorMatrix tmp = new ColorMatrix();

            cm.setRGB2YUV();
            tmp.setRotate(0, deg);
            cm.postConcat(tmp);
            tmp.setYUV2RGB();
            cm.postConcat(tmp);

            final float[] a = cm.getArray();

            int ir = floatToByte(a[0] * r +  a[1] * g +  a[2] * b);
            int ig = floatToByte(a[5] * r +  a[6] * g +  a[7] * b);
            int ib = floatToByte(a[10] * r + a[11] * g + a[12] * b);

            return Color.argb(Color.alpha(color), pinToByte(ir),
                              pinToByte(ig), pinToByte(ib));
        }

        private static final float PI = 3.1415926f;

        @Override
        public boolean onTouchEvent(MotionEvent event) {
            float x = event.getX() - CENTER_X;
            float y = event.getY() - CENTER_Y;
            boolean inCenter = java.lang.Math.sqrt(x*x + y*y) <= CENTER_RADIUS;

            switch (event.getAction()) {
                case MotionEvent.ACTION_DOWN:
                    mTrackingCenter = inCenter;
                    if (inCenter) {
                        mHighlightCenter = true;
                        invalidate();
                        break;
                    }
                case MotionEvent.ACTION_MOVE:
                    if (mTrackingCenter) {
                        if (mHighlightCenter != inCenter) {
                            mHighlightCenter = inCenter;
                            invalidate();
                        }
                    } else {
                        float angle = (float)java.lang.Math.atan2(y, x);
                        // need to turn angle [-PI ... PI] into unit [0....1]
                        float unit = angle/(2*PI);
                        if (unit < 0) {
                            unit += 1;
                        }
                        mCenterPaint.setColor(interpColor(mColors, unit));
                        invalidate();
                    }
                    break;
                case MotionEvent.ACTION_UP:
                    if (mTrackingCenter) {
                        if (inCenter) {
                            mListener.colorChanged(mCenterPaint.getColor());
                        }
                        mTrackingCenter = false;    // so we draw w/o halo
                        invalidate();
                    }
                    break;
            }
            return true;
        }
    }

    public ColorPickerDialog(Context context,
                             OnColorChangedListener listener,
                             int initialColor) {
        super(context);

        mListener = listener;
        mInitialColor = initialColor;
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        OnColorChangedListener l = new OnColorChangedListener() {
            public void colorChanged(int color) {
                mListener.colorChanged(color);
                dismiss();
            }
        };

        setContentView(new ColorPickerView(getContext(), l, mInitialColor));
        setTitle("Pick a Color");
    }
}

{'repo_name': 'Miserlou/Android-SDK-Samples', 'stars': '265', 'repo_language': 'Java', 'file_name': 'strings.xml', 'mime_type': 'text/xml', 'hash': -5361893934576945004, 'source_dataset': 'data'}


//
// QuantumUI Variables
// You must import bootstrap variabled
// --------------------------------------------------

//== Import Bootstap variables
//
//## Import Bootstap variables

@import "../../wwwroot/lib/bootstrap/scss/variables.scss";

//** Load fonts from this directory.
$icon-font-path:          "../../wwwroot/lib/bootstrap/fonts/";

//== Colors
//
//## Skin and brand colors for use across QuantumUI Bootstrap Skin.

$skin-base-color:                  $gray-light;
$skin-base-accent:                 lighten($brand-info, 10%);
$skin-base-active:                 darken($brand-warning, 10%);

$skin-base-50:             tint(shade($skin-base-color, -48.5%), 97%);
$skin-base-100:            tint(shade($skin-base-color, -40%), 88%);
$skin-base-200:            tint(shade($skin-base-color, -30%), 60%);
$skin-base-300:            tint(shade($skin-base-color, -20%), 40%);
$skin-base-400:            tint(shade($skin-base-color, -10%), 20%);
$skin-base-500:            $skin-base-color;
$skin-base-600:            shade(tint($skin-base-color, -7.5%), 15%);
$skin-base-700:            shade(tint($skin-base-color, -15%), 30%);
$skin-base-800:            shade(tint($skin-base-color, -22.5%), 45%);
$skin-base-900:            shade(tint($skin-base-color, -33.5%), 67%);
$skin-base-1000:           shade(tint($skin-base-color, -40%), 80%);

$skin-accent-50:           tint(shade($skin-base-accent, -41.5%), 92%);
$skin-accent-100:          tint(shade($skin-base-accent, -35%), 74%);
$skin-accent-200:          tint(shade($skin-base-accent, -27%), 54%);
$skin-accent-300:          tint(shade($skin-base-accent, -14%), 28%);
$skin-accent-400:          $skin-base-accent;
$skin-accent-700:          shade(tint($skin-base-accent, -15%), 30%);

$skin-active-50:           tint(shade($skin-base-active, -47.5%), 95%);
$skin-active-100:          tint(shade($skin-base-active, -40%), 80%);
$skin-active-200:          tint(shade($skin-base-active, -27%), 54%);
$skin-active-300:          tint(shade($skin-base-active, -14%), 28%);
$skin-active-400:          $skin-base-active;
$skin-active-700:          shade(tint($skin-base-active, -15%), 30%);

$white:                   #fff;
$white-lighter:           darken($white, 0.6%);
$white-light:             darken($white, 1.8%);
$white-dark:              darken($white, 3.3%);
$white-darker:            darken($white, 5.8%);

//==Brand Shades
//
//## Brand colors for use across QuantumUI.

$brand-primary-darker:         shade(tint($brand-primary, -19%), 38%);
$brand-primary-dark:           shade(tint($brand-primary, -9%), 18%);
$brand-primary-light:          tint(shade($brand-primary, -9%), 18%);
$brand-primary-lighter:        tint(shade($brand-primary, -19%), 38%);

$brand-info-darker:            shade(tint($brand-info, -7.5%), 15%);
$brand-info-dark:              shade(tint($brand-info, -3.75%), 7.5%);
$brand-info-light:             tint(shade($brand-info, -9%), 18%);
$brand-info-lighter:           tint(shade($brand-info, -19%), 38%);

$brand-success-darker:         shade(tint($brand-success, -7.5%), 15%);
$brand-success-dark:           shade(tint($brand-success, -3.75%), 7.5%);
$brand-success-light:          tint(shade($brand-success, -9%), 18%);
$brand-success-lighter:        tint(shade($brand-success, -18%), 38%);

$brand-warning-darker:         shade(tint($brand-warning, -7.5%), 15%);
$brand-warning-dark:           shade(tint($brand-warning, -3.75%), 7.5%);
$brand-warning-light:          tint(shade($brand-warning, -9%), 18%);
$brand-warning-lighter:        tint(shade($brand-warning, -19%), 38%);

$brand-danger-darker:         shade(tint($brand-danger, -7.5%), 15%);
$brand-danger-dark:           shade(tint($brand-danger, -3.75%), 7.5%);
$brand-danger-light:          tint(shade($brand-danger, -9%), 18%);
$brand-danger-lighter:        tint(shade($brand-danger, -19%), 38%);
//== Scaffolding
//
//## Settings for some of the most global styles.

$font-size-largest:       21px;
$font-size-smallest:      ceil(($font-size-base * 0.7)); // ~10px

//== Components
//
//## Define common padding and border radius sizes and more. Values based on 14px text and 1.428 line-height (~20px to start).

$line-height-largest:       1.18;

$border-radius-largest:     8px;

//** component font family.
$component-font-family:        'Glyphicons Halflings';
$angle-icon:                   '\e259';
$angle-up-icon:                '\e260';
$tick-icon:                    '\e013';
$info-icon:                    '\e086';
$danger-icon:                  '\e107';
$warning-icon:                 '\e101';

$caret-width-large:         5px;

//== Dropdowns
//
//## Dropdown menu container and contents.

$dropdown-min-width:             160px;
$dropdown-box-shadow:            0 6px 12px rgba($skin-base-700, 2%/100.0%);
$dropdown-caret-color:           $skin-base-800;

//** Background for the dropdown container.
$dropdown-container-bg:                    $skin-base-100;

$dropdown-container-box-shadow:            0 5px 10px rgba($skin-base-700, 2%/100.0%);

$dropdown-container-box-shadow-top:        0 -5px 10px rgba($skin-base-700, 2%/100.0%);
//** Dropdown container `border-color`.
$dropdown-container-border:                shade($dropdown-container-bg, 5.5%);

$dropdown-container-fallback-border:       shade($dropdown-container-bg, 5.5%);

$dropdown-container-min-width:             170px;
//** Dropdown container `max-width`.
$dropdown-container-max-width:             360px;
$dropdown-container-header-padding:        5px 7px;
$dropdown-container-footer-padding:        5px 7px;
$dropdown-container-header-color:          $skin-base-800;
$dropdown-container-footer-color:          $skin-base-800;

//-- Z-index master list
//
// Warning: Avoid customizing these values. They're used for a bird's eye view
// of components dependent on the z-axis and are designed to all work together.
//
// Note: These variables are not generated into the Customizer.

$zindex-dropdown:          1040;
$zindex-aside:             1040;
$zindex-modal:             1050;
$zindex-titip:             9999;

//== Tabs
$nav-tabs-font-size:                        ($font-size-base - 1px);

//== Modalbox
//
//##

$modal-box-lg:                    600px;
$modal-box-md:                    450px;
$modal-box-sm:                    250px;

//== Carousel
//
//##

$carousel-indicator-thumb-color:             $skin-base-800;
$carousel-indicator-thumb-bg:                $skin-base-200;
$carousel-indicator-thumb-border-color:      $skin-base-300;

$carousel-caption-color:                     #fff;
$carousel-caption-bg:                        $skin-base-700;

//== Scrollbar
//
//##

//** general scrollbar size.
$scrollbar-image-path:       "../../images/scrollbar";
$scrollbar-size:              8px;
//** page scrollbar size.
$scrollbar-page-size:         12px;

$scrollbar-offset:            5px;

$scrollbar-color:             #fff;
$scrollbar-bg-color:          rgba($skin-base-300, 30%/100.0%);
$scrollbar-button-bg-color:   rgba($skin-base-300, 50%/100.0%);
$scrollbar-hover-bg-color:    rgba($skin-base-300, 65%/100.0%);
$scrollbar-border-color:      lighten($skin-base-300, 35%);

$scrollbar-track-border-radius:    6px;
$scrollbar-track-box-shadow:       inset 0 0 6px rgba(0,0,0,0.3);

$scrollbar-thumb-opacity:          0.9;
$scrollbar-thumb-bg-color:         $skin-base-600;
$scrollbar-thumb-border-radius:    6px;
$scrollbar-thumb-box-shadow:       inset 3px 3px 9px rgba(255, 255, 255, 0.3), inset -3px -3px 9px rgba(255, 255, 255, 0.3);
$scrollbar-thumb-box-shadow-hover: inset 3px 3px 9px rgba(0, 0, 0, 0.2), inset -3px -3px 9px rgba(0, 0, 0, 0.2);
$scrollbar-thumb-filter-image:     radial-gradient(ellipse at center, rgba(255,255,255,0.2) 40%, rgba(0,0,0,0.1) 100%);

$scrollbar-corner-bg-color:          $skin-base-100;
$scrollbar-corner-border-color:      $scrollbar-corner-bg-color;

//** quantum scrollbar settings
$scrollbar-z-index:                9;

$scrollbar-button-bg-color:        $scrollbar-thumb-bg-color;
$scrollbar-button-box-shadow:      1px 1px 2px 0px rgba(50, 50, 50, 0.3);
$scrollbar-button-size:            $scrollbar-size;
$scrollbar-button-border-width:    4px;
$scrollbar-button-border-color:    rgba(255, 255, 255, 0.8);

$scrollbar-info-bg                    : $brand-info-lighter;
$scrollbar-info-color                 : $brand-info-lighter;
$scrollbar-info-thumb-bg              : $brand-info;

$scrollbar-warning-bg                 : $brand-warning-lighter;
$scrollbar-warning-color              : $brand-warning-lighter;
$scrollbar-warning-thumb-bg           : $brand-warning-dark;

$scrollbar-danger-bg                  : $brand-danger-lighter;
$scrollbar-danger-color               : $brand-danger-lighter;
$scrollbar-danger-thumb-bg            : $brand-danger;

$scrollbar-success-bg                 : $brand-success-lighter;
$scrollbar-success-color              : $brand-success-lighter;
$scrollbar-success-thumb-bg           : $brand-success;

//== with-arrow Utils
//
//##
$with-arrow-border-width:           10px;
$with-arrow-margin:                 $with-arrow-border-width;
$with-arrow-offset:                 $with-arrow-border-width;
$with-arrow-top-box-shadow:         0 -6px 12px rgba(0, 0, 0, 0.175);

$with-arrow-border-inner-color:    #fff;
$with-arrow-border-outer-color:    #fff;

//== titip pure CSS tooltip
//
//##
$titip-tringle-width:               8px;
$titip-bg:                          $skin-base-600;
$titip-border-color:                $skin-base-700;
$titip-color:                       $skin-base-100;
$titip-padding:                     6px 9px 7px;
$titip-font-size:                   13px;
$titip-line-height:                 13px;
$titip-radius:                      $border-radius-base;
$titip-box-shadow:                  1px 1px 7px 0px rgba(50, 50, 50, 0.09);

//== input[type="range"] IE10+ and nq-range-slider
//
//##
$range-height:                      6px;
$range-bg:                          $skin-base-50;
$range-selection-bg:                $skin-base-400;
$range-thumb-border:                $skin-base-500;
$range-ticks-color:                 $skin-base-800;
$range-ticks-border-color:          $skin-base-100;
$range-values-font-size:            11px;
$range-thumb-width:                 10px;
$range-thumb-height:                20px;

$range-box-shadow:                  inset 0 1px 2px rgba(0, 0, 0, 0.2);
$range-box-shadow-horizontal:       inset 0 -1px 2px rgba(0, 0, 0, 0.1);
$range-thumb-box-shadow:            inset 0 1px 0 rgba(255,255,255,.2), 0 1px 2px rgba(0,0,0,.05);

$range-height-xs:                   4px;
$range-thumb-width-xs:              8px;
$range-thumb-height-xs:             16px;
$range-height-md:                   10px;
$range-thumb-width-md:              14px;
$range-thumb-height-md:             24px;
$range-height-lg:                   14px;
$range-thumb-width-lg:              18px;
$range-thumb-height-lg:             28px;
$range-slider-size:                 210px;
$range-ticks-size:                  12px;

$range-primary-bg:                 $brand-primary-lighter;
$range-primary-selection-bg:       $brand-primary;
$range-primary-border:             $brand-primary-dark;

$range-success-bg:                 $state-success-bg;
$range-success-selection-bg:       $brand-success;
$range-success-border:             $brand-success-dark;

$range-info-bg:                    $state-info-bg;
$range-info-selection-bg:          $brand-info;
$range-info-border:                $brand-info-dark;

$range-warning-bg:                 $state-warning-bg;
$range-warning-selection-bg:       $brand-warning;
$range-warning-border:             $brand-warning-dark;

$range-danger-bg:                  $state-danger-bg;
$range-danger-selection-bg:        $brand-danger;
$range-danger-border:              $brand-danger-dark;

//== calendars, datepicker, datetimepicker
//
//##
$cal-panel-bg:                      #fff;
$cal-panel-z-index:                 $listbox-z-index;
$cal-panel-border-color:            $skin-base-100;
$cal-panel-color:                   $skin-base-900;
$cal-active-bg:                     $skin-base-active;
$cal-active-color:                  #fff;
$cal-hover-bg:                      $skin-base-700;
$cal-hover-color:                   #fff;
$cal-panel-padding:                 3px;
$cal-panel-radius:                  $border-radius-base;
$cal-panel-max-width:               270px;
$cal-panel-font:                    "Trebuchet MS", "Lucida Sans Unicode", "Lucida Sans", Arial, Helvetica, sans-serif;

//cal-table
$cal-table-bg:                      $skin-base-50;
$cal-table-color:                   $cal-panel-color;
$cal-table-border-color:            $cal-panel-border-color;
$cal-table-header-size:             25px;

$cal-table-cell-size:               30px;
$cal-table-cell-color:              lighten($cal-panel-color, 12%);
$cal-table-cell-hover-color:        #fff;
$cal-table-cell-hover-bg:           $cal-hover-bg;
//== aside
//
//##
$aside-bg:                          $skin-base-700;
$aside-overlay-bg:                  #fff;
$aside-color:                       $skin-base-400;
$aside-width:                       220px;
$aside-collapsed-width:             60px;
$aside-font:                       "Trebuchet MS", "Lucida Sans Unicode", "Lucida Sans", Arial, Helvetica, sans-serif;
$aside-header-height:               35px;
$aside-footer-height:               35px;
$aside-transition-duration:         0.2s;
/*aside menu*/
$aside-menu-color:                  $skin-base-400;
$aside-menu-link-height:            40px;

$aside-default-bg:                          $skin-base-100;
$aside-default-overlay-bg:                  $skin-base-600;
$aside-default-color:                       $skin-base-1000;
$aside-default-menu-color:                  $skin-base-1000;

//== listbox(select)
//
//##
$listbox-max-height:                 180px;
$listbox-max-width:                  350px;
$listbox-color:                      $skin-base-800;
$listbox-bg:                         #fff;
$listbox-border-color:               $skin-base-100;
$listbox-font-size:                  ($font-size-base - 1px);
$listbox-border-radius:              $border-radius-base;
$listbox-z-index:                    $zindex-dropdown;
$listbox-option-hover-bg:            $skin-accent-100;
$listbox-option-hover-color:         $skin-accent-700;
$listbox-option-active-bg:           $skin-base-active;
$listbox-option-active-color:        #fff;
$listbox-highlight-color:            $skin-base-active;

{'repo_name': 'quantumui/quantumui', 'stars': '205', 'repo_language': 'JavaScript', 'file_name': 'app.js', 'mime_type': 'text/plain', 'hash': 8583279639803710210, 'source_dataset': 'data'}


{'repo_name': 'facebook/flow', 'stars': '20773', 'repo_language': 'OCaml', 'file_name': 'Dockerfile', 'mime_type': 'text/plain', 'hash': -6757080461151524024, 'source_dataset': 'data'}