#!/usr/bin/make -f
# -*- makefile -*-
# Sample debian/rules that uses debhelper.
# This file was originally written by Joey Hess and Craig Small.
# As a special exception, when this file is copied by dh-make into a
# dh-make output file, you may use that output file without restriction.
# This special exception was added by Craig Small in version 0.37 of dh-make.

# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1

# Build with --as-needed to reduce library dependencies (e.g. libncurses)
export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed

%:
	dh $@ --with python3

override_dh_auto_build:
	# Update timestamp on distributed completion.c to avoid regenerating
	touch src/completion.c
	dh_auto_build

override_dh_install:
	dh_install
	chmod -x $(CURDIR)/debian/rlwrap/usr/share/rlwrap/filters/README
	chmod -x $(CURDIR)/debian/rlwrap/usr/share/rlwrap/filters/RlwrapFilter.3pm
	chmod -x $(CURDIR)/debian/rlwrap/usr/share/rlwrap/filters/RlwrapFilter.pm
	perl -p -i -e 's@^#! */usr/bin/env +perl@#! /usr/bin/perl@' $(CURDIR)/debian/rlwrap/usr/share/rlwrap/filters/*
