#!/usr/bin/make -f #export DH_VERBOSE=1 DEB_HOST_ARCH ?= $(shell dpkg-architecture -qDEB_HOST_ARCH) DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE) DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE) ROOT_DIR=$(shell pwd) export HOME := $(ROOT_DIR)/debian -include $(ROOT_DIR)/erts/vsn.mk -include $(ROOT_DIR)/lib/diameter/vsn.mk -include $(ROOT_DIR)/lib/erl_interface/vsn.mk -include $(ROOT_DIR)/lib/jinterface/vsn.mk -include $(ROOT_DIR)/lib/ic/vsn.mk -include $(ROOT_DIR)/lib/tools/vsn.mk -include $(ROOT_DIR)/lib/common_test/vsn.mk -include $(ROOT_DIR)/lib/snmp/vsn.mk -include $(ROOT_DIR)/lib/observer/vsn.mk -include $(ROOT_DIR)/lib/edoc/vsn.mk SOURCE_VERSION=$(shell dpkg-parsechangelog | sed -ne's!^Version: \(.*\)-.*!\1!p') PCRE_MAJOR=$(shell cat erts/emulator/pcre/pcre.h | grep PCRE_MAJOR | sed -e's/.*\s\([0-9]\+\).*/\1/') PCRE_MINOR=$(shell cat erts/emulator/pcre/pcre.h | grep PCRE_MINOR | sed -e's/.*\s\([0-9]\+\).*/\1/') PCRE_VERSION=$(PCRE_MAJOR).$(PCRE_MINOR) ABI_VERSION=17.0 MAN_DIR = $(ROOT_DIR)/debian/tmp/usr/share/man/man1 ifneq ($(findstring hurd,$(DEB_HOST_ARCH)),) ESOCKET_OPT=--disable-esock else ESOCKET_OPT=--enable-esock endif ifneq ($(findstring hurd,$(DEB_HOST_ARCH)),) KERNEL_POLL_OPT=--disable-kernel-poll else KERNEL_POLL_OPT=--enable-kernel-poll endif LIBSCTP=$(shell grep-status -s Depends -PX libsctp-dev |sed -e 's!.*\(libsctp[0-9]*\).*!\1!') LIBSCTPDEP=$(shell grep-status -s Version -PX $(LIBSCTP) | sed -e's!^Version: \(.*\)-[^-]*!$(LIBSCTP) (>= \1)!') ifeq ($(findstring hurd,$(DEB_HOST_ARCH))$(findstring bsd,$(DEB_HOST_ARCH)),) CLOCK_GETTIME_OPT=--enable-clock-gettime SYSTEMD_OPT=--enable-systemd SCTP_OPT=--enable-sctp else CLOCK_GETTIME_OPT= SYSTEMD_OPT= SCTP_OPT=--disable-sctp endif ifeq ($(findstring i386,$(DEB_HOST_ARCH)),) SSE2= else SSE2=-msse2 endif ifeq ($(findstring armel,$(DEB_HOST_ARCH)),) OPTIMIZATION=-O2 else OPTIMIZATION=-O1 endif ifeq ($(findstring debug,$(DEB_BUILD_OPTIONS)),debug) CFLAGS=-g $(OPTIMIZATION) -fno-strict-aliasing $(SSE2) GEN_OPT_FLGS=$(OPTIMIZATION) -fno-strict-aliasing $(SSE2) TYPE=debug else CFLAGS=-g $(OPTIMIZATION) -fno-strict-aliasing $(SSE2) GEN_OPT_FLGS=$(OPTIMIZATION) -fno-strict-aliasing $(SSE2) TYPE= endif JAVA_OPTIONS=-Xlint -source 1.8 -target 1.8 export LC_ALL := C.UTF-8 JOBS=$(shell nproc) MANPAGE_DIRS = $(shell find $(ROOT_DIR) -not \( -wholename '*/.pc' -prune \) \ -a \( -name '*_cmd.md' -or -name dialyzer.erl \) -exec dirname {} _cmd.md \; | tr "\n" ":") MANPAGE_NAMES = $(shell find $(ROOT_DIR) -not \( -wholename '*/.pc' -prune \) \ -a -name '*_cmd.md' -exec basename {} _cmd.md \;) dialyzer start_embedded MANPAGES = $(MANPAGE_NAMES:%=$(MAN_DIR)/%.1) vpath %_cmd.md $(MANPAGE_DIRS) # manpages builds section 1 manual pages manpages: manpages-stamp manpages-stamp: $(MANPAGES) dh_testdir touch manpages-stamp $(MAN_DIR): install -d $(MAN_DIR) $(MAN_DIR)/start_embedded.1: $(MAN_DIR)/start.1 sed -e's/START/START_EMBEDDED/' \ -e's/Bstart\([ \\]\)/Bstart_embedded\1/' <$< >$@ $(MAN_DIR)/dialyzer.1: lib/dialyzer/src/dialyzer.erl $(MAN_DIR) debian/scripts/fixmanpage $< 1 | ronn | sed -e's/start(1)/start_embedded(1)/' >$@ $(MAN_DIR)/%.1: %_cmd.md $(MAN_DIR) debian/scripts/fixmanpage $< 1 | ronn | sed -e's/start(1)/start_embedded(1)/' >$@ # Files generated from templates SCRIPTS_SRC = $(wildcard debian/erlang-*.in) $(wildcard debian/scripts/*.in) SCRIPTS = $(SCRIPTS_SRC:%.in=%) $(SCRIPTS) debian/control: %: %.in debian/rules sed -e's/@VERSION@/$(VSN)/g' \ -e's/@SOURCE_VERSION@/$(SOURCE_VERSION)/g' \ -e's/@ABI_VERSION@/$(ABI_VERSION)/g' \ -e's/@PCRE_VERSION@/$(PCRE_VERSION)/g' \ -e's/@EI_VSN@/$(EI_VSN)/g' \ -e's/@JINTERFACE_VSN@/$(JINTERFACE_VSN)/g' \ -e's/@IC_VSN@/$(IC_VSN)/g' \ -e's/@COMMON_TEST_VSN@/$(COMMON_TEST_VSN)/g' \ -e's/@SNMP_VSN@/$(SNMP_VSN)/g' \ -e's/@DIAMETER_VSN@/$(DIAMETER_VSN)/g' \ -e's/@OBSERVER_VSN@/$(OBSERVER_VSN)/g' \ -e's/@EDOC_VSN@/$(EDOC_VSN)/g' \ -e's/@TOOLS_VSN@/$(TOOLS_VSN)/g' <$< >$@ # Building the package clean: dh_testdir dh_testroot # [ ! -f Makefile ] || $(MAKE) -j $(JOBS) clean # # Remove installed erlang from debian/ rm -rvf debian/erlang-docs # # Restore replaced configure, config.guess, and config.sub files for i in `find $(ROOT_DIR) -regex '.*config\(ure\|\.guess\|\.sub\)~'` ; do \ mv -v $$i $${i%%\~} ; \ done # # Remove files, which were generated from templates rm -vf $(SCRIPTS) # # *.install were also generated on-the-fly rm -vf debian/*.install rm -vf debian/erlang-doc.links # rm -vf debian/AUTHORS # # Remove touched stamp files rm -vf *-stamp # dh_clean -Xtest.erl.orig automake: automake-stamp automake-stamp: debian/control dh_testdir # # Return error if there are known nonfree docs in upstream tarball # Return error if there are prebuilt binaries in upstream tarball err=0 ; \ for fn in `find lib/*/doc -name standard -or -name archive` ; do \ err=1 ; \ echo Found directory $$fn with non-free docs in upstream. Please remove it. ; \ done ; \ if [ -f prebuilt.files ] ; then \ err=1 ; \ echo Found prebuilt binaries in upstream. Please remove them. ; \ fi ; \ if [ $$err = 1 ] ; then \ echo ; \ echo Use uscan --download to get the upstream tarball. ; \ echo ; \ false ; \ fi # # Preserve configure scripts for i in `find $(ROOT_DIR) -not \( -wholename '*/.pc' -prune \) \ -a -name 'configure'` ; do \ cp -vf $$i $$i~ ; \ done # # Replace config.guess and config.sub by installed in /usr/share/misc. for i in `find $(ROOT_DIR) -not \( -wholename '*/.pc' -prune \) \ -a -name 'config.guess'` ; do \ cp -vfb /usr/share/misc/config.guess $$i ; \ done for i in `find $(ROOT_DIR) -not \( -wholename '*/.pc' -prune \) \ -a -name 'config.sub'` ; do \ cp -vfb /usr/share/misc/config.sub $$i ; \ done # # Regenerate configure scripts using autoconf ./otp_build update_configure --no-commit # touch automake-stamp configure: configure-stamp configure-stamp: automake-stamp dh_testdir # CFLAGS="$(CFLAGS)" \ ./configure --host=$(DEB_HOST_GNU_TYPE) \ --build=$(DEB_BUILD_GNU_TYPE) \ --prefix=/usr \ --libexecdir=/usr/bin \ --infodir=/usr/share/info \ --mandir=/usr/share/man \ --enable-hybrid-heap \ --enable-threads \ --enable-smp-support \ $(KERNEL_POLL_OPT) \ $(ESOCKET_OPT) \ $(SYSTEMD_OPT) \ $(SCTP_OPT) \ $(CLOCK_GETTIME_OPT) \ --enable-dynamic-ssl-lib \ --with-ssl-rpath=no \ --enable-ethread-pre-pentium4-compatibility \ --enable-shared-zlib \ --disable-builtin-zlib \ --without-ssl-zlib \ --disable-silent-rules # touch configure-stamp boot: boot-stamp boot-stamp: configure-stamp dh_testdir $(MAKE) -j $(JOBS) TYPE=$(TYPE) GEN_OPT_FLGS="$(GEN_OPT_FLGS)" JAVA_OPTIONS="$(JAVA_OPTIONS)" touch boot-stamp install: install-stamp install-stamp: boot-stamp dh_testdir # $(MAKE) -j $(JOBS) DESTDIR=$(ROOT_DIR)/debian/tmp TYPE=$(TYPE) install # # Replace ROOTDIR in "erl" and "start" scripts for real rootdir # If there's no erl or start then it's better to fail than silently continue for dir in debian/tmp/usr/lib/erlang/erts-$(VSN)/bin \ debian/tmp/usr/lib/erlang/bin; do \ for val in erl start; do \ sed -i 's!ROOTDIR=.*!ROOTDIR=/usr/lib/erlang!' $${dir}/$${val}; \ done; \ done # # Correct ERL_ROOT in RELEASES file sed 's!%ERL_ROOT%!/usr/lib/erlang!' \ debian/tmp/usr/lib/erlang/releases/RELEASES.src \ >debian/tmp/usr/lib/erlang/releases/RELEASES # # Get rid of windows cruft find debian/tmp -name *.bat -exec rm -v {} \; # # Fix permissions cp debian/tmp/usr/lib/erlang/erts-$(VSN)/bin/start_erl.src \ debian/tmp/usr/lib/erlang/erts-$(VSN)/bin/start_erl chmod 755 debian/tmp/usr/lib/erlang/erts-$(VSN)/bin/start_erl chmod 755 debian/tmp/usr/lib/erlang/erts-$(VSN)/bin/*.src chmod 644 debian/tmp/usr/lib/erlang/bin/start.script chmod 644 debian/tmp/usr/lib/erlang/lib/wx-*/examples/*/*.beam # # Remove some files which should be rather in erlang-doc-html package find debian/tmp/usr/lib/erlang/lib -name info -exec rm -v {} \; rm -rv debian/tmp/usr/lib/erlang/erts-$(VSN)/doc # # Remove unnecessary Install and manpage formatting scripts rm -v debian/tmp/usr/lib/erlang/Install rm -rv debian/tmp/usr/lib/erlang/misc touch install-stamp docs: docs-stamp docs-stamp: dh_testdir ifeq ($(filter nodoc,$(DEB_BUILD_PROFILES)),) PATH=$(ROOT_DIR)/bin:$$PATH $(MAKE) -j $(JOBS) docs $(MAKE) -j $(JOBS) DESTDIR=$(ROOT_DIR)/debian/erlang-docs install-docs # (cd $(ROOT_DIR)/debian/erlang-docs/usr/lib/erlang/lib ; \ perl $(ROOT_DIR)/debian/scripts/genlinks $(VSN) >$(ROOT_DIR)/debian/erlang-doc.links) install -d $(ROOT_DIR)/debian/erlang-docs/usr/lib/html mv $(ROOT_DIR)/debian/erlang-docs/usr/lib/erlang/* $(ROOT_DIR)/debian/erlang-docs/usr/lib/html # Use system-wide javascript libraries ln -sf /usr/share/javascript/jquery/jquery.min.js \ $(ROOT_DIR)/debian/erlang-docs/usr/lib/html/lib/jinterface-*/doc/html/assets/java/script-dir/jquery-[0-9]*.min.js ln -sf /usr/share/javascript/jquery-ui/themes/base/jquery-ui.min.css \ $(ROOT_DIR)/debian/erlang-docs/usr/lib/html/lib/jinterface-*/doc/html/assets/java/script-dir/jquery-ui.min.css ln -sf /usr/share/javascript/jquery-ui/jquery-ui.min.js \ $(ROOT_DIR)/debian/erlang-docs/usr/lib/html/lib/jinterface-*/doc/html/assets/java/script-dir/jquery-ui.min.js endif touch docs-stamp build: build-arch build-indep build-arch: build-stamp manpages-stamp build-indep: build-stamp docs-stamp build-stamp: install-stamp $(SCRIPTS) dh_testdir # # Place each installed file into the proper package. # See this script and the debian/patterns/* files for more informations. sh debian/scripts/analyse debian/tmp # # Add all author lists to debian/AUTHORS cat $(ROOT_DIR)/erts/AUTHORS >>debian/AUTHORS for i in $$(find $(ROOT_DIR) -name AUTHORS | sort | tail -n +3) ; do \ echo $$i ; \ echo "" >>debian/AUTHORS ; \ echo "------------------------------------------------------------------------" >>debian/AUTHORS ; \ echo "$$(basename $$(dirname $$i))" >>debian/AUTHORS ; \ echo "" >>debian/AUTHORS ; \ cat $$i >>debian/AUTHORS ; \ done # touch build-stamp binary: binary-indep binary-arch binary-indep: build-stamp docs-stamp dh_testdir dh_testroot dh_installdirs -i dh_install -i dh_lintian -i ifeq ($(filter nodoc,$(DEB_BUILD_PROFILES)),) dh_installdocs -i -A debian/README.Debian debian/AUTHORS else dh_installdocs -i -Nerlang-doc -A debian/README.Debian debian/AUTHORS endif dh_installemacsen -i dh_installexamples -i dh_installchangelogs -i dh_installman -i dh_installmenu -i dh_link -i dh_strip -i dh_compress -i -X.txt -X.erl -X.hrl -X.c -X.js -X.kwc -X.pdf -X.eix -X.src -X.beam -X.md dh_fixperms -i dh_makeshlibs -i dh_installdeb -i dh_shlibdeps -i dh_gencontrol -i dh_md5sums -i dh_builddeb -i binary-arch: build-stamp manpages-stamp dh_testdir dh_testroot dh_installdirs -a dh_install -a # #sed -i -e 's/Depends: /Depends: $${erlang:Depends}, /g' debian/control #$(ROOT_DIR)/debian/erlang-dev/usr/bin/erlang-depends -a #grep -r erlang:Depends debian/ #false # dh_lintian -a dh_installdocs -a -A debian/README.Debian debian/AUTHORS dh_installchangelogs -a dh_installemacsen -a dh_installexamples -a dh_installman -a dh_installmenu -a dh_link -a dh_installsystemd -a --name=epmd dh_strip -a dh_compress -a dh_fixperms -a dh_makeshlibs -a dh_installdeb -a dh_shlibdeps -a dh_gencontrol -a -- -Vlibsctp:Version='$(LIBSCTPDEP)' dh_md5sums -a dh_builddeb -a .PHONY: clean automake build build-arch build-indep .PHONY: binary binary-arch binary-indep .PHONY: configure boot install docs manpages