Paste number 156705: debian/rules for bash-builtins

Paste number 156705: debian/rules for bash-builtins
Pasted by: lfam
When:6 years, 1 month ago
Share:Tweet this! | http://paste.lisp.org/+3CWX
Channel:None
Paste contents:
Raw Source | XML | Display As
     1	#! /usr/bin/make -f
     2	# -*- makefile -*-
     3	
     4	#export DH_VERBOSE=1
     5	
     6	unexport LANG LC_ALL LC_CTYPE LC_COLLATE LC_TIME LC_NUMERIC LC_MESSAGES
     7	
     8	# architecture dependent variables
     9	vafilt = $(subst $(2)=,,$(filter $(2)=%,$(1)))
    10	DPKG_VARS := $(shell dpkg-architecture)
    11	DEB_BUILD_GNU_TYPE	?= $(call vafilt,$(DPKG_VARS),DEB_BUILD_GNU_TYPE)
    12	DEB_HOST_ARCH		?= $(call vafilt,$(DPKG_VARS),DEB_HOST_ARCH)
    13	DEB_HOST_ARCH_OS	?= $(call vafilt,$(DPKG_VARS),DEB_HOST_ARCH_OS)
    14	DEB_HOST_GNU_CPU	?= $(call vafilt,$(DPKG_VARS),DEB_HOST_GNU_CPU)
    15	DEB_HOST_GNU_SYSTEM	?= $(call vafilt,$(DPKG_VARS),DEB_HOST_GNU_SYSTEM)
    16	DEB_HOST_GNU_TYPE	?= $(call vafilt,$(DPKG_VARS),DEB_HOST_GNU_TYPE)
    17	DEB_HOST_MULTIARCH	?= $(call vafilt,$(DPKG_VARS),DEB_HOST_MULTIARCH)
    18	
    19	VERSION		:= 4.2
    20	#PKGVERSION	:= $(shell dpkg-parsechangelog \
    21	#			| sed -n '/Version:/s/\(.* \)\(.*\)-2\(.*\)/\2\3/p')
    22	#PKGVERSION	:= 3.0
    23	#dpkg_ctrl_args := -v$(PKGVERSION) -VBinary-Version=$(PKGVERSION)
    24	
    25	with_gfdl	= yes
    26	
    27	ifneq ($(DEB_HOST_GNU_TYPE),$(DEB_BUILD_GNU_TYPE))
    28	  CC	= $(DEB_HOST_GNU_TYPE)-gcc
    29	else
    30	  CC	= gcc
    31	endif
    32	
    33	ifneq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
    34	  ifneq ($(DEB_HOST_GNU_TYPE),$(DEB_BUILD_GNU_TYPE))
    35	    STRIP = $(DEB_HOST_GNU_TYPE)-strip
    36	  else
    37	    STRIP = strip
    38	  endif
    39	endif
    40	
    41	
    42	dpkg_buildflags = DEB_CFLAGS_MAINT_APPEND=-Wall dpkg-buildflags
    43	CFLAGS := $(shell $(dpkg_buildflags) --get CFLAGS)
    44	CPPFLAGS := $(shell $(dpkg_buildflags) --get CPPFLAGS)
    45	LDFLAGS := $(shell $(dpkg_buildflags) --get LDFLAGS)
    46	
    47	SHELL	= /bin/bash
    48	YACC	= bison -y
    49	
    50	IX	= install -o 0 -g 0
    51	ID	= install -o 0 -g 0 -m 644
    52	
    53	# built with installed libreadline?
    54	with_installed_rl = no
    55	
    56	debflags =
    57	
    58	p	= bash
    59	p_stat	= bash-static
    60	p_bins	= bash-builtins
    61	p_doc	= bash-doc
    62	
    63	d	= debian/$(p)
    64	d_stat	= debian/$(p_stat)
    65	d_bins	= debian/$(p_bins)
    66	d_doc	= debian/$(p_doc)
    67	
    68	termcap_lib := $(if $(wildcard /usr/lib/libtinfo.so /usr/lib/$(DEB_HOST_MULTIARCH)/libtinfo.so), \
    69			 -ltinfo, \
    70			 -lncurses)
    71	
    72	conf_args = \
    73		--with-curses \
    74		--enable-largefile \
    75		--prefix=/usr \
    76		--infodir=/usr/share/info \
    77		--mandir=/usr/share/man
    78	ifeq ($(with_installed_rl),yes)
    79	    conf_args += --with-installed-readline
    80	endif
    81	ifeq ($(DEB_BUILD_GNU_TYPE), $(DEB_HOST_GNU_TYPE))
    82	    conf_args += --build $(DEB_HOST_GNU_TYPE)
    83	else
    84	    conf_args += --build $(DEB_BUILD_GNU_TYPE) --host $(DEB_HOST_GNU_TYPE)
    85	endif
    86	
    87	static_conf_args := $(conf_args) \
    88		--enable-static-link \
    89		--without-bash-malloc \
    90	
    91	#build: bash-build static-build preinst-build check
    92	build: before-build bash-build static-build preinst-build check
    93	build-arch: build
    94	build-indep: build
    95	
    96	before-build:
    97		mkdir -p stamps
    98		: # see #327477, needed to have HAVE_DEV_STDIN defined
    99		(test -d /dev/fd && test -r /dev/stdin < /dev/null) \
   100		  || (test -d /proc/self/fd && test -r /dev/stdin < /dev/null)
   101	ifneq (,$(findstring $(DEB_HOST_ARCH_OS), linux freebsd))
   102		$(CC) $(CFLAGS) $(LDFLAGS) $(CPPFLAGS) -o clear_console \
   103		    debian/clear_console.c $(termcap_lib)
   104	endif
   105	
   106	# ---------------------------------------------------------------------------
   107	# build standard bash
   108	
   109	bash-build:
   110		$(MAKE) -f debian/rules do-build-bash \
   111		    bash_src=. \
   112		    build=bash \
   113		    configure_args="$(conf_args)"
   114	bash-configure:
   115		$(MAKE) -f debian/rules do-configure-bash \
   116		    bash_src=. \
   117		    build=bash \
   118		    configure_args="$(conf_args)"
   119	
   120	# ---------------------------------------------------------------------------
   121	# build static bash
   122	
   123	static-build:
   124		$(MAKE) -f debian/rules do-build-static \
   125		    bash_src=. \
   126		    build=static \
   127		    configure_args="$(static_conf_args)"
   128	static-configure:
   129		$(MAKE) -f debian/rules do-configure-static \
   130		    bash_src=. \
   131		    build=static \
   132		    configure_args="$(static_conf_args)"
   133	
   134	# ---------------------------------------------------------------------------
   135	
   136	bash-doc-build: stamps/stamp-build-bash-doc
   137	stamps/stamp-build-bash-doc:
   138		rm -f bash/doc/bashref.info
   139		$(MAKE) -C build-bash/doc info html
   140		$(MAKE) -C build-bash/doc bash.pdf bashref.pdf
   141		touch stamps/stamp-build-bash-doc
   142	
   143	# ---------------------------------------------------------------------------
   144	
   145	check: stamps/stamp-check
   146	stamps/stamp-check: bash-build
   147		@echo BEGIN test
   148	ifeq ($(DEB_BUILD_GNU_TYPE),$(DEB_HOST_GNU_TYPE))
   149	  ifeq (,$(findstring nocheck, $(DEB_BUILD_OPTIONS)))
   150		-sh debian/locale-gen
   151		LOCPATH=$(CURDIR)/locales \
   152			time $(MAKE) -C build-bash test 2>&1 | tee build-bash/test-protocol
   153	  endif
   154	else
   155		@echo Suppress 'make' test, because this is cross build
   156	endif
   157		@echo END test
   158		touch stamps/stamp-check
   159	
   160	# ---------------------------------------------------------------------------
   161	
   162	clean:
   163		dh_testdir
   164		dh_testroot
   165		rm -rf stamps build-*
   166		rm -f debian/bash.preinst debian/*.o
   167		rm -f debian/README.Debian
   168		rm -rf locales
   169		rm -f clear_console
   170		rm -rf .pc
   171		dh_clean
   172	
   173	preinst-build: debian/bash.preinst
   174	
   175	PREINST_OBJECTS = debian/bash.preinst.o debian/bash.preinst-lib.o
   176	
   177	$(PREINST_OBJECTS): %.o: %.c debian/bash.preinst.h
   178		$(CC) -c -o $@ $(CFLAGS) $(CPPFLAGS) $<
   179	
   180	debian/bash.preinst: $(PREINST_OBJECTS)
   181		$(CC) -o $@ $(CFLAGS) $(LDFLAGS) $(PREINST_OBJECTS)
   182		$(STRIP) -R .comment -R .note debian/bash.preinst
   183	
   184	# ---------------------------------------------------------------------------
   185	
   186	
   187	install: bash-install
   188	
   189	bash-install: bash-build stamps/stamp-install-bash
   190	stamps/stamp-install-bash: before-build stamps/stamp-build-bash
   191		dh_testdir
   192		dh_testroot
   193		dh_clean -k -p$(p) -p$(p_doc) -p$(p_bins)
   194		dh_installdirs -p$(p) \
   195			bin \
   196			etc/skel \
   197			usr/share/doc/$(p)
   198		dh_installdirs -p$(p_doc) \
   199			usr/share/doc/$(p)
   200		dh_installdirs -p$(p_bins) \
   201			usr/share/doc/$(p)/examples/loadables \
   202			usr/include/bash/{builtins,lib/{glob,tilde}}
   203	
   204	ifeq ($(with_gfdl),yes)
   205	# XXXXX
   206	#	cp -p build-bash/doc/*.info bash/doc/
   207	endif
   208	
   209		: # install it
   210		$(MAKE) -C build-bash install \
   211			YACC="$(YACC)" \
   212			DESTDIR=$(CURDIR)/$(d)
   213		mv $(d)/usr/bin/bash $(d)/bin/.
   214		chmod 755 $(d)/usr/bin/bashbug
   215		$(ID) debian/bashbug.1 $(d)/usr/share/man/man1/
   216	ifneq ($(with_gfdl),yes)
   217		mkdir -p $(d)/usr/share/man/man1
   218		cp -p bash/doc/bash.1 $(d)/usr/share/man/man1/bash.1
   219	endif
   220		rm -f $(d)/usr/share/doc/bash/*.html
   221		rm -f $(d)/usr/share/info/*.info
   222		rm -f $(d)/usr/share/info/dir*
   223	
   224		: # extra links
   225		ln -sf bash $(d)/bin/rbash
   226	
   227		: # skeleton files
   228		$(ID) debian/etc.bash.bashrc $(d)/etc/bash.bashrc
   229		$(ID) debian/skel.bashrc $(d)/etc/skel/.bashrc
   230		$(ID) debian/skel.profile $(d)/etc/skel/.profile
   231		$(ID) debian/skel.bash_logout $(d)/etc/skel/.bash_logout
   232	
   233		: # clean_console
   234	ifneq (,$(findstring $(DEB_HOST_ARCH_OS), linux freebsd))
   235		$(IX) clear_console $(d)/usr/bin/
   236		$(ID) debian/clear_console.1 $(d)/usr/share/man/man1/
   237	endif
   238	
   239		: # files for the bash-doc package
   240	
   241		dh_installexamples -p$(p_doc) examples/*
   242		mv $(d_doc)/usr/share/doc/$(p_doc)/examples \
   243			$(d_doc)/usr/share/doc/$(p)/examples
   244		rm -rf $(d_doc)/usr/share/doc/$(p)/examples/loadables
   245		ln -sf ../$(p)/examples $(d_doc)/usr/share/doc/$(p_doc)/examples
   246	
   247		rm -rf $(d_doc)/usr/share/doc/$(p)/examples/obashdb
   248		cd $(d_doc)/usr/share/doc/$(p)/examples && chmod 755 \
   249			misc/aliasconv.*sh misc/cshtobash
   250	
   251		cd $(d_doc)/usr/share/doc/$(p)/examples && chmod 644 \
   252			scripts/shprompt
   253	
   254		: # files for the bash-builtins package
   255		$(ID) include/*.h *.h  $(d_bins)/usr/include/bash/
   256		$(ID) build-bash/*.h $(d_bins)/usr/include/bash/
   257		rm -f $(d_bins)/usr/include/bash/y.tab.h
   258		$(ID) builtins/*.h $(d_bins)/usr/include/bash/builtins/
   259		$(ID) lib/glob/*.h $(d_bins)/usr/include/bash/lib/glob/
   260		$(ID) lib/tilde/*.h $(d_bins)/usr/include/bash/lib/tilde/
   261		$(ID) examples/loadables/{README,*.c} \
   262			$(d_bins)/usr/share/doc/$(p)/examples/loadables
   263		$(ID) build-bash/examples/loadables/Makefile \
   264			$(d_bins)/usr/share/doc/$(p)/examples/loadables
   265		ln -sf bash $(d_bins)/usr/share/doc/$(p_bins)
   266	
   267	#	cat debian/README stamps/stamp-patch > debian/README.Debian
   268		cat debian/README > debian/README.Debian
   269	
   270		touch stamps/stamp-install-bash
   271	
   272	binary-doc: bash-install bash-doc-build
   273		dh_testdir
   274		dh_testroot
   275		mkdir -p $(d_doc)/usr/share/doc/$(p)
   276	ifeq ($(with_gfdl),yes)
   277		dh_installdocs -p$(p_doc) 
   278		cp -p build-bash/doc/bashref.{html,pdf} $(d_doc)/usr/share/doc/$(p)/.
   279		mkdir -p $(d_doc)/usr/share/info
   280		cp -p build-bash/doc/bash.info $(d_doc)/usr/share/info/.
   281		dh_link -p$(p_doc) \
   282		    /usr/share/doc/$(p)/bashref.html /usr/share/doc/$(p_doc)/bashref.html \
   283		    /usr/share/doc/$(p)/bashref.pdf /usr/share/doc/$(p_doc)/bashref.pdf
   284	else
   285		dh_installdocs -p$(p_doc) -X.doc-base
   286		rm -f $(d_doc)/usr/share/doc-base/bashref
   287	endif
   288		rm -f $(d_doc)/usr/share/info/dir*
   289		cp -p build-bash/doc/bash.html build-bash/doc/bash.pdf \
   290		    $(d_doc)/usr/share/doc/$(p)/
   291		dh_link -p$(p_doc) \
   292		    /usr/share/doc/$(p)/bash.html /usr/share/doc/$(p_doc)/bash.html \
   293		    /usr/share/doc/$(p)/bash.pdf /usr/share/doc/$(p_doc)/bash.pdf
   294		dh_installchangelogs -p$(p_doc) CWRU/changelog
   295		dh_compress -p$(p_doc) -Xexamples -X.pdf
   296		dh_fixperms -p$(p_doc)
   297		dh_installdeb -p$(p_doc)
   298		dh_gencontrol -p$(p_doc)
   299		dh_md5sums -p$(p_doc)
   300		dh_builddeb -p$(p_doc)
   301	
   302	binary-bash: bash-install debian/bash.preinst
   303		dh_testdir
   304		dh_testroot
   305		dh_installchangelogs -p$(p)
   306		dh_installdocs -p$(p) \
   307			CHANGES NEWS COMPAT doc/INTRO POSIX \
   308			debian/{README.Debian,README.abs-guide,README.commands} \
   309			debian/inputrc.arrows
   310		install -D -m 644 debian/bash.overrides \
   311			debian/bash/usr/share/lintian/overrides/bash
   312		dh_installman -p$(p) doc/rbash.1 debian/bash-builtins.7
   313		dh_installmenu -p$(p)
   314		dh_strip -p$(p)
   315		dh_compress -p$(p)
   316		dh_fixperms -p$(p)
   317		dh_shlibdeps -p$(p) -- -dPre-Depends $(d)/bin/bash debian/bash.preinst
   318		dh_installdeb -p$(p)
   319		dh_gencontrol -p$(p)
   320		dh_md5sums -p$(p)
   321		dh_builddeb -p$(p)
   322	
   323	# Even though it contains only headers and example files,
   324	# bash-builtins is NOT arch-independent because the config.h* files
   325	# differ on different archs.
   326	binary-builtins: bash-install
   327		dh_testdir
   328		dh_testroot
   329		dh_compress -p$(p_bins) -Xexamples
   330		dh_fixperms -p$(p_bins)
   331		dh_installdeb -p$(p_bins)
   332		dh_gencontrol -p$(p_bins)
   333		dh_md5sums -p$(p_bins)
   334		dh_builddeb -p$(p_bins)
   335	
   336	binary-static: static-build
   337		dh_testdir
   338		dh_testroot
   339		dh_clean -k -p$(p_stat)
   340		dh_installdirs -p$(p_stat) \
   341			bin \
   342			usr/share/man/man1
   343		cp -p build-static/bash $(d_stat)/bin/bash-static
   344		cp -p doc/bash.1 $(d_stat)/usr/share/man/man1/bash-static.1
   345		dh_installdocs -p$(p_stat)
   346		dh_installchangelogs -p$(p_stat)
   347		install -D -m 644 debian/bash-static.overrides \
   348			debian/bash-static/usr/share/lintian/overrides/bash-static
   349		dh_strip -p$(p_stat)
   350		dh_compress -p$(p_stat)
   351		dh_fixperms -p$(p_stat)
   352		dh_installdeb -p$(p_stat)
   353		dh_gencontrol -p$(p_stat) -- \
   354			'-Vglibc:Source=$(shell dpkg-query -f '$${source:Package} (= $${source:Version}), ' -W libc-bin)'
   355		dh_md5sums -p$(p_stat)
   356		dh_builddeb -p$(p_stat)
   357	
   358	binary-indep: binary-doc
   359	binary-arch: binary-bash binary-builtins binary-static
   360	binary:	binary-indep binary-arch
   361	
   362	# ---------------------------------------------------------------------------
   363	# common rules for all bash build variations
   364	
   365	do-build-$(build): stamps/stamp-build-$(build)
   366	stamps/stamp-build-$(build): stamps/stamp-configure-$(build)
   367		dh_testdir
   368	ifneq (,$(profiled_build))
   369		$(MAKE) -C build-$(build) \
   370			CFLAGS='$(CFLAGS) -fprofile-generate' \
   371			YACC="$(YACC)" \
   372			TERMCAP_LIB="$(termcap_lib)" \
   373			deb_builddir=build-$(build)/ \
   374			$(debflags)
   375		-sh debian/locale-gen
   376		cp debian/run-my-gprof bash/tests/
   377		LOCPATH=$(CURDIR)/locales \
   378		    time $(MAKE) -C build-$(build) TESTSCRIPT=run-my-gprof test 2>&1 \
   379			| tee build-bash/profile-protocol
   380		$(MAKE) -C build-$(build) clean
   381		rm -f build-$(build)/lib/malloc/malloc*.gc??
   382		$(MAKE) -C build-$(build) \
   383			CFLAGS='$(CFLAGS) -fprofile-use' \
   384			YACC="$(YACC)" \
   385			TERMCAP_LIB="$(termcap_lib)" \
   386			deb_builddir=build-$(build)/ \
   387			$(debflags)
   388	else
   389		$(MAKE) -C build-$(build) \
   390			YACC="$(YACC)" \
   391			TERMCAP_LIB="$(termcap_lib)" \
   392			deb_builddir=build-$(build)/ \
   393			$(debflags)
   394	endif
   395	ifeq ($(with_gfdl),yes)
   396		$(MAKE) -C build-$(build)/doc \
   397			bash.info
   398	endif
   399		touch stamps/stamp-build-$(build)
   400	
   401	do-configure-$(build): stamps/stamp-configure-$(build)
   402	stamps/stamp-configure-$(build):
   403		dh_testdir
   404		rm -rf build-$(build)
   405		mkdir build-$(build)
   406		cd build-$(build) && \
   407		    CC="$(CC)" \
   408		    CFLAGS="$(CFLAGS)" CPPFLAGS="$(CPPFLAGS)" LDFLAGS="$(LDFLAGS)" \
   409		    YACC="$(YACC)" \
   410			../$(bash_src)/configure $(configure_args)
   411		if ! grep -q '#define HAVE_DEV_STDIN 1' build-$(build)/config.h; then \
   412		  echo "HAVE_DEV_STDIN not defined, abortig build"; \
   413		  exit 1; \
   414		fi
   415		touch stamps/stamp-configure-$(build)
   416	
   417	update-patches:
   418		export QUILT_PATCHES=$(patchdir); \
   419		export QUILT_REFRESH_ARGS="--no-timestamps --no-index -p ab"; \
   420		export QUILT_DIFF_ARGS="--no-timestamps --no-index -p ab"; \
   421		while quilt push; do quilt refresh; done
   422	
   423	#unpack-$(bash_src): stamps/stamp-unpack-$(bash_src)
   424	#stamps/stamp-unpack-$(bash_src):
   425	#	mkdir -p stamps
   426	#	rm -rf bash-$(VERSION) $(bash_src)
   427	#	rm -f stamps/stamp-patch-$(bash_src){,-*}
   428	#	tar xf bash-$(VERSION)*.tar.xz
   429	#	mv bash-$(VERSION) $(bash_src)
   430	#	rm -f bash/y.tab.?
   431	#	cp -p /usr/share/misc/config.* $(bash_src)/.
   432	#	cp -p /usr/share/misc/config.* $(bash_src)/support/.
   433	#	touch stamps/stamp-unpack-$(bash_src)
   434	
   435	remove-non-dfsg-files:
   436		rm -f doc/article.*
   437		rm -f doc/FAQ
   438		rm -f doc/aosa-bash.pdf
   439		rm -f doc/rose94.*
   440	
   441	.NOTPARALLEL: build
   442	.PHONY: unpack binary binary-arch binary-indep clean \
   443	    build bash-build static-build preinst-build \
   444	    check \
   445	    bash-configure static-configure \
   446	    binary-doc binary-bash binary-builtins binary-static \
   447	    install bash-install
   448	
   449	# Local Variables:
   450	# mode: makefile
   451	# end:

This paste has no annotations.

Colorize as:
Show Line Numbers

Lisppaste pastes can be made by anyone at any time. Imagine a fearsomely comprehensive disclaimer of liability. Now fear, comprehensively.