ncurses 6.0 - patch 20170408
[ncurses.git] / package / debian / rules
old mode 100644 (file)
new mode 100755 (executable)
index e4cb109..49978d8
@@ -1,11 +1,15 @@
 #!/usr/bin/make -f
-# MAde with the aid of dh_make, by Craig Small
+# Made with the aid of dh_make, by Craig Small
 # Sample debian/rules that uses debhelper. GNU copyright 1997 by Joey Hess.
 # Some lines taken from debmake, by Cristoph Lameter.
 
 # Uncomment this to turn on verbose mode.
 #export DH_VERBOSE=1
 
+# packages
+PACKAGES.indep = # ncurses6-docs
+PACKAGES.arch  = ncurses6 ncursest6
+
 # These are used for cross-compiling and for saving the configure script
 # from having to guess our platform (since we know it already)
 DEB_HOST_GNU_TYPE   ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
@@ -14,11 +18,23 @@ DEB_BUILD_GNU_TYPE  ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
 CC_NORMAL = -Wall -Wstrict-prototypes -Wmissing-prototypes -Wshadow -Wconversion
 CC_STRICT = $(CC_NORMAL) -W -Wbad-function-cast -Wcast-align -Wcast-qual -Wmissing-declarations -Wnested-externs -Wpointer-arith -Wwrite-strings -ansi -pedantic
 
-MY_DIR=/usr/local/ncurses6
+MY_ABI=6
+MY_DIR=/usr
 MYDATA=/usr/local/ncurses/share/terminfo
-BUILD_DIR=$(CURDIR)/debian/ncurses6
+NORMAL_DIR=$(CURDIR)/debian/ncurses$(MY_ABI)
+THREAD_DIR=$(CURDIR)/debian/ncursest$(MY_ABI)
 
-CFLAGS = $(CC_NORMAL)
+CFLAGS   = $(shell dpkg-buildflags --get CFLAGS) $(CC_NORMAL)
+CPPFLAGS = $(shell dpkg-buildflags --get CPPFLAGS)
+LDFLAGS  = $(shell dpkg-buildflags --get LDFLAGS)
+
+ifneq ($(MY_DIR),/usr)
+       RPATH_ENV = RPATH_LIST=../lib:$(MY_DIR)/lib
+       RPATH_OPT = --enable-rpath
+else
+       RPATH_ENV =
+       RPATH_OPT = --disable-rpath --disable-rpath-hack
+endif
 
 ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
         CFLAGS += -O0
@@ -29,13 +45,13 @@ ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
         INSTALL_PROGRAM += -s
 endif
 
+verbose = # -v
 
-configure: configure-stamp
-configure-stamp:
-       dh_testdir
-
-       RPATH_LIST=../lib:$(MY_DIR)/lib \
-       CFLAGS="$(CFLAGS)" ./configure \
+configure = \
+       $(RPATH_ENV) \
+       CFLAGS="$(CFLAGS)" \
+       CPPFLAGS="$(CPPFLAGS)" \
+       LDFLAGS="$(LDFLAGS)" ../../configure $(RPATH_OPT) \
                --host=$(DEB_HOST_GNU_TYPE) \
                --build=$(DEB_BUILD_GNU_TYPE) \
                --prefix=$(MY_DIR) \
@@ -45,79 +61,148 @@ configure-stamp:
                --disable-getcap \
                --disable-leaks \
                --disable-macros  \
+               --disable-overwrite  \
                --disable-termcap \
-               --enable-const \
-               --enable-ext-colors \
-               --enable-ext-mouse \
                --enable-hard-tabs \
-               --enable-interop \
-               --enable-rpath \
-               --enable-sp-funcs \
+               --enable-pc-files \
                --enable-warnings \
+               --enable-wgetch-events \
                --enable-widec \
+               --program-suffix=$(MY_ABI) \
                --verbose \
+               --with-abi-version=$(MY_ABI) \
                --with-develop \
+               --with-extra-suffix=$(MY_ABI) \
                --with-shared \
                --with-termlib \
                --with-ticlib \
                --with-trace \
                --with-cxx-shared \
+               --with-terminfo-dirs=/lib/terminfo:/usr/share/terminfo \
+               --with-versioned-syms \
                --with-xterm-kbs=DEL \
                --without-ada \
                --without-debug \
                --without-normal
 
-       touch configure-stamp
+NCURSES6_DIR = $(CURDIR)/debian/ncurses6
+NCURSEST6_DIR = $(CURDIR)/debian/ncursest6
+
+.PHONY: all config build install binary clean config-indep config-arch \
+    build-indep build-arch install-indep install-arch binary-indep \
+    binary-arch
 
-build: build-stamp
-build-stamp: configure-stamp
+all: build
+
+config: config-indep config-arch
+build: build-indep build-arch
+install: install-indep install-arch
+binary: binary-indep binary-arch
+clean:
        dh_testdir
+       dh_testroot
+       dh_clean $(verbose)
+       rm -rf t
 
-       $(MAKE)
+config-indep: $(PACKAGES.indep:%=config-%-stamp)
+config-arch: $(PACKAGES.arch:%=config-%-stamp)
 
-       touch build-stamp
+build-indep: $(PACKAGES.indep:%=build-%-stamp)
+build-arch: $(PACKAGES.arch:%=build-%-stamp)
 
-clean:
+install-indep: $(PACKAGES.indep:%=install-%-stamp)
+install-arch: $(PACKAGES.arch:%=install-%-stamp)
+
+config-ncurses6-stamp:
+       dh_testdir
+       rm -rf t/ncurses6
+       mkdir -p t/ncurses6
+       cd t/ncurses6; $(configure)
+       touch $@
+
+config-ncursest6-stamp:
+       dh_testdir
+       rm -rf t/ncursest6
+       mkdir -p t/ncursest6
+       cd t/ncursest6; $(configure) \
+               --enable-interop \
+               --enable-sp-funcs \
+               --program-suffix=t$(MY_ABI) \
+               --with-pthread
+       touch $@
+
+build-ncurses6-stamp: config-ncurses6-stamp
+       dh_testdir
+
+       $(MAKE) -C t/ncurses6
+
+       touch $@
+
+build-ncursest6-stamp: config-ncursest6-stamp
+       dh_testdir
+
+       $(MAKE) -C t/ncursest6
+
+       touch $@
+
+install-ncurses6-stamp: build-ncurses6-stamp
        dh_testdir
        dh_testroot
+       dh_installdirs $(verbose)
+       dh_prep        $(verbose) -pncurses6
 
-       [ ! -f makefile ] || $(MAKE) distclean
+       $(MAKE) -C t/ncurses6 install.libs install.progs DESTDIR=$(NCURSES6_DIR)
+       $(MAKE) -C t/ncurses6/test ncurses LOCAL_LIBDIR=$(MY_DIR)/lib
 
-       rm -f configure-stamp build-stamp install-stamp
+       mv t/ncurses6/test/ncurses $(NCURSES6_DIR)$(MY_DIR)/bin/ncurses$(MY_ABI)
 
-       dh_clean
+       touch $@
 
-install: install-stamp
-install-stamp: build-stamp
+install-ncursest6-stamp: build-ncursest6-stamp
        dh_testdir
        dh_testroot
-       dh_clean -k
-       dh_installdirs
+       dh_installdirs $(verbose)
+       dh_prep        $(verbose) -pncursest6
 
-       $(MAKE) install.libs install.progs DESTDIR=$(BUILD_DIR)
+       $(MAKE) -C t/ncursest6 install.libs install.progs DESTDIR=$(NCURSEST6_DIR)
+       $(MAKE) -C t/ncursest6/test ncurses LOCAL_LIBDIR=$(MY_DIR)/lib
 
-       ( cd test && make ncurses LOCAL_LIBDIR=$(MY_DIR)/lib )
-       mv test/ncurses $(BUILD_DIR)$(MY_DIR)/bin/ncurses6
+       mv t/ncursest6/test/ncurses $(NCURSEST6_DIR)$(MY_DIR)/bin/ncursest$(MY_ABI)
 
-       touch install-stamp
+       touch $@
 
 # Build architecture-independent files here.
-binary-indep: build install
-# No binary-indep target.
+binary-indep: install-indep
+ifneq ($(PACKAGES.indep),)
+       rm -f $(PACKAGES.indep:%=install-%-stamp)
+       dh_testdir
+       dh_testroot
+       dh_installdocs       $(verbose) $(PACKAGES.indep:%=-p%)
+       dh_installman        $(verbose) $(PACKAGES.indep:%=-p%)
+       dh_installexamples   $(verbose) $(PACKAGES.indep:%=-p%)
+       dh_installchangelogs $(verbose) $(PACKAGES.indep:%=-p%) NEWS
+       dh_compress          $(verbose) $(PACKAGES.indep:%=-p%)
+       dh_fixperms          $(verbose) $(PACKAGES.indep:%=-p%)
+       dh_installdeb        $(verbose) $(PACKAGES.indep:%=-p%)
+       dh_gencontrol        $(verbose) $(PACKAGES.indep:%=-p%)
+       dh_md5sums           $(verbose) $(PACKAGES.indep:%=-p%)
+       dh_builddeb          $(verbose) $(PACKAGES.indep:%=-p%)
+endif
 
 # Build architecture-dependent files here.
-binary-arch: build install
+binary-arch: install-arch
+ifneq ($(PACKAGES.arch),)
+       rm -f $(PACKAGES.arch:%=install-%-stamp)
        dh_testdir
        dh_testroot
-       dh_installchangelogs NEWS
-       dh_strip
-       dh_compress
-       dh_fixperms
-       dh_installdeb
-       dh_shlibdeps
-       dh_gencontrol
-       dh_md5sums
-       dh_builddeb
-
-binary: binary-indep binary-arch
-.PHONY: build clean binary-indep binary-arch binary install install-stamp
+       dh_installchangelogs $(verbose) $(PACKAGES.arch:%=-p%)  NEWS
+       dh_strip             $(verbose) $(PACKAGES.arch:%=-p%)
+       dh_compress          $(verbose) $(PACKAGES.arch:%=-p%)
+       dh_fixperms          $(verbose) $(PACKAGES.arch:%=-p%)
+       dh_installdeb        $(verbose) $(PACKAGES.arch:%=-p%)
+       dh_makeshlibs        $(verbose) $(PACKAGES.arch:%=-p%)
+       dh_shlibdeps         $(verbose) $(PACKAGES.arch:%=-p%)
+       dh_gencontrol        $(verbose) $(PACKAGES.arch:%=-p%)
+       dh_md5sums           $(verbose) $(PACKAGES.arch:%=-p%)
+       dh_builddeb          $(verbose) $(PACKAGES.arch:%=-p%)
+endif