### this file is sourced not run
PKGVER=2017.03
PKGBUILD=1
PKGARCH=x86_64

# source: james
TARBALL= # built-in
MD5SUM=  # built-in
SRC_URL= # built-in
BUNDLE=

SLACKREQ='libgtop xmessage' # 
SLACKDESC="das-watchdog: das-watchdog $PKGVER (Real-time kernel watchdog)  
das-watchdog:  
das-watchdog: Das_Watchdog is a general watchdog for the Linux operating 
das-watchdog: system that should be run in the background at all times to 
das-watchdog: ensure a realtime process won't hang the machine. It works by 
das-watchdog: watching system usage and if locks up is detected, it 
das-watchdog: temporarily drops real-time priorities of all processes.  
das-watchdog: 
das-watchdog: https://github.com/kmatheussen/das_watchdog
das-watchdog: 
das-watchdog: 
"

### default pkg_download
### prepare
pkg_prepare() {
	return 0 # nothing to prepare, sources included in this recipe
}

### default pkg_package
### build
pkg_build() {
	cd /tmp/pkg

	gcc -O2 $(pkg-config --libs --cflags libgtop-2.0) -lpthread \
	     -DWHICH_XMESSAGE=\"/usr/bin/xmessage\" -DVERSION=\"0.9.0-$PKGVER\" \
	     das_watchdog.c -o /usr/sbin/das_watchdog &&
	
	mkdir -p /etc/init.d &&
	sed -i -e 's|^PATH=.*|PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin|' das_watchdog.rc \
	       -e 's|^DAEMON=.*|DAEMON=/usr/sbin/das_watchdog|' das_watchdog.rc &&
	install -m755 das_watchdog.rc /etc/init.d/90-das-watchdog &&
	
	pkg_build_slackdesc
}
