# Build recipe for xdotool.
#
# Copyright (c) 2018 Markus Tornow, <tornow@riseup.net>.
# Copyright (c) 2018 Matias Fonzo, <selk@dragora.org>.
#
# 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.

program=xdotool
version=3.20160805.1
release=1

# Set 'outdir' for a nice and well-organized output directory
outdir="${outdir}/${arch}/x-apps"

tarname=${program}-${version}.tar.gz

# Remote source(s)
fetch=http://github.com/jordansissel/xdotool/releases/download/v${version}/$tarname

homepage=http://www.semicomplete.com/projects/xdotool/

description="
Fake input from the mouse and keyboard very easily.

xdotool also supports window manager actions such as moving,
activating, and other actions on windows.

For more information, visit:
$homepage
"

homepage=http://www.semicomplete.com/projects/xdotool/
license=Custom

# Source documentation
docs="CHANGELIST COPYRIGHT README VERSION examples/"
docsdir="${docdir}/${program}-${version}"

build()
{
    set -e

    unpack "${tardir}/$tarname"

    cd "$srcdir"

    make showman

    make -j${jobs} V=1 CFLAGS="$QICFLAGS" LDFLAGS="$QILDFLAGS" \
          PREFIX=/usr \
          INSTALLLIB=/usr/lib${libSuffix} \
          INSTALLMAN=$mandir \
          LDCONFIG=true \
          DESTDIR="$destdir" \
          install

    lzip -9 "${destdir}/${mandir}/man1/xdotool.1"

    # Copy documentation
    mkdir -p "${destdir}${docsdir}"
    cp -p -r $docs "${destdir}${docsdir}/"
}

