#!/usr/bin/make -f # add DEB_* variables to the environment include /usr/share/dpkg/architecture.mk include /usr/share/dpkg/pkg-info.mk # determine whether this is a stable or development build VERSION=$(shell echo $(DEB_SOURCE) | sed s/wine//g) ifeq (x$(VERSION), x) PRIORITY=70 DEBSUFFIX=-stable else PRIORITY=50 DEBSUFFIX=$(VERSION) endif export DEBSUFFIX # installation paths MANDIR=usr/share/man DATDIR=usr/share/wine$(VERSION) INCDIR=usr/include/wine$(VERSION) LIBDIR=usr/lib/$(DEB_HOST_MULTIARCH)/wine$(VERSION) # enable verbose build log export DH_VERBOSE=1 # specify buildflags (stack protector and LTO are not yet supported upstream) export DEB_BUILD_MAINT_OPTIONS=hardening=+all,-stackprotector optimize=-lto # configure options CONFLAGS=--with-gnutls \ --without-oss \ --without-sane \ --without-netapi \ --disable-tests \ --enable-werror \ --enable-maintainer-mode \ --libdir=/$(LIBDIR) \ --bindir=/$(LIBDIR) \ --mandir=/$(MANDIR) \ --includedir=/$(INCDIR) \ --datarootdir=/$(DATDIR) \ CFLAGS="$(shell dpkg-buildflags --get CFLAGS)" \ LDFLAGS="$(shell dpkg-buildflags --get LDFLAGS)" \ # enable support for x86 PE32 applications on amd64 ifeq ($(DEB_HOST_ARCH), amd64) CONFLAGS+=--enable-archs=x86_64,i386 endif # enable support for arm PE32 applications on arm64 ifeq ($(DEB_HOST_ARCH), arm64) CONFLAGS+=--enable-archs=aarch64,arm endif # build with mingw on intel architectures ifneq (,$(filter $(DEB_HOST_ARCH),i386 amd64)) CONFLAGS+=--with-mingw ZLIB_PE_LIBS=z endif # ignore arm-specific unused functions ifneq (,$(filter $(DEB_HOST_ARCH),armhf arm64)) export DEB_CFLAGS_MAINT_APPEND+=-Wno-unused-function endif # extra information to add to the version string export VENDOR=$(shell dpkg-vendor --query vendor | sed s/Debian/debian/) $(DEB_VERSION) # parse wine's cpu string from DEB_HOST_MULTIARCH export WINE_CPU=$(shell echo $(DEB_HOST_MULTIARCH) | cut -d- -f1) # use date of the latest changelog update as the build date export WIDL_TIME_OVERRIDE=$(SOURCE_DATE_EPOCH) # additional files to generate INSTALLS=$(shell ls debian/*VERSION* | sed s/VERSION/$(VERSION)/) \ debian/bug-control \ debian/control debian/control.check: debian/control.in debian/control.stable.in # generate "$(shell echo $@)" sed "s/VERSION/$(VERSION)/g;s/DEBSUFFIX/$(DEBSUFFIX)/g" < $< > $@ ifeq (x$(DEBSUFFIX),x-stable) echo >> $@ cat debian/control.stable.in >> $@ endif debian/wine$(VERSION)%: debian/wineVERSION% # generate "$(shell echo $@)" sed "s/VERSION/$(VERSION)/g;s/DEB_HOST_MULTIARCH/$(DEB_HOST_MULTIARCH)/g;s/DEBSUFFIX/$(DEBSUFFIX)/g" < $< > $@ debian/wine32$(VERSION)%: debian/wine32VERSION% # generate "$(shell echo $@)" sed "s/VERSION/$(VERSION)/g;s/DEB_HOST_MULTIARCH/$(DEB_HOST_MULTIARCH)/g;s/DEBSUFFIX/$(DEBSUFFIX)/g" < $< > $@ debian/wine64$(VERSION)%: debian/wine64VERSION% # generate "$(shell echo $@)" sed "s/VERSION/$(VERSION)/g;s/DEB_HOST_MULTIARCH/$(DEB_HOST_MULTIARCH)/g;s/DEBSUFFIX/$(DEBSUFFIX)/g" < $< > $@ debian/libwine$(VERSION)%: debian/libwineVERSION% # generate "$(shell echo $@)" sed "s/VERSION/$(VERSION)/g;s/DEB_HOST_MULTIARCH/$(DEB_HOST_MULTIARCH)/g;s/DEBSUFFIX/$(DEBSUFFIX)/g;s/PRIORITY/$(PRIORITY)/g" < $< > $@ # append 16-bit PE files to the libwine packages (only relevant on i386 and amd64) ifneq (,$(filter $(DEB_HOST_ARCH),i386 amd64)) debian/libwine$(VERSION).install: debian/libwineVERSION.install # generate "$(shell echo $@)" sed "s/VERSION/$(VERSION)/g;s/DEB_HOST_MULTIARCH/$(DEB_HOST_MULTIARCH)/g;s/DEBSUFFIX/$(DEBSUFFIX)/g;s/PRIORITY/$(PRIORITY)/g" < $< > $@ echo >> $@ echo "# 16-bit windows PE files" >> $@ echo "debian/tmp/usr/lib/*/*/*/*.vxd" >> $@ echo "debian/tmp/usr/lib/*/*/*/*.dll16" >> $@ echo "debian/tmp/usr/lib/*/*/*/*.drv16" >> $@ echo "debian/tmp/usr/lib/*/*/*/*.exe16" >> $@ echo "debian/tmp/usr/lib/*/*/*/*.mod16" >> $@ endif debian/bug-control: debian/bug-control.in sed s/VERSION/$(VERSION)/g < $< > $@ %: @./debian/scripts/check-control # delegate "$(shell echo $@)" to debhelper dh $@ override_dh_auto_configure: # cc version $(CC) --version # mingw version $(DEB_HOST_GNU_CPU)-w64-mingw32-gcc --version || echo "" # automatically generated files ./tools/make_unicode ./tools/make_requests ./tools/make_specfiles cd dlls/dsound && ./make_fir cd dlls/opengl32 && ./make_opengl cd dlls/winevulkan && ./make_vulkan -x /usr/share/vulkan/registry/vk.xml -X /usr/share/vulkan/registry/video.xml # autotools files ln -sf /usr/share/misc/config.sub tools ln -sf /usr/share/misc/config.guess tools # image files used to generate icons for parts of wine ln -sf ../../dlls/user32/resources/oic_hand.svg dlls/display.drv16/oic_hand.svg ln -sf ../../dlls/user32/resources/oic_note.svg dlls/comctl32/idi_tt_info_md.svg ln -sf ../../dlls/user32/resources/oic_note.svg dlls/comctl32/idi_tt_info_sm.svg ln -sf ../../dlls/user32/resources/oic_bang.svg dlls/comctl32/idi_tt_warn_md.svg ln -sf ../../dlls/user32/resources/oic_bang.svg dlls/comctl32/idi_tt_warn_sm.svg ln -sf ../../dlls/user32/resources/oic_hand.svg dlls/comctl32/idi_tt_error_md.svg ln -sf ../../dlls/user32/resources/oic_hand.svg dlls/comctl32/idi_tt_error_sm.svg ln -sf ../../dlls/shell32/resources/move.svg dlls/comctl32/idi_dragarrow.svg ln -sf ../../dlls/shell32/resources/image.svg programs/regedit/bin.svg ln -sf ../../dlls/shell32/resources/folder.svg programs/regedit/folder.svg ln -sf ../../dlls/shell32/resources/document.svg programs/regedit/string.svg ln -sf ../../dlls/shell32/resources/mycomputer.svg programs/regedit/computer.svg ln -sf ../../dlls/shell32/resources/folder_open.svg programs/regedit/folderopen.svg ln -sf ../../dlls/shell32/resources/window.svg programs/taskmgr/window.svg ln -sf ../../dlls/shell32/resources/window.svg programs/taskmgr/windowsm.svg ln -sf ../../dlls/shell32/resources/drive.svg dlls/comdlg32/hdisk.svg ln -sf ../../dlls/shell32/resources/folder.svg dlls/comdlg32/folder.svg ln -sf ../../dlls/shell32/resources/network.svg dlls/comdlg32/network.svg ln -sf ../../dlls/shell32/resources/folder_open.svg dlls/comdlg32/folder2.svg ln -sf ../../dlls/shell32/resources/disk_drive.svg dlls/comdlg32/floppy.svg ln -sf ../../dlls/shell32/resources/optical_drive.svg dlls/comdlg32/cdrom.svg ifneq (,$(filter $(DEB_HOST_ARCH),i386 amd64)) # ensure system zlib files are used for i386 and amd64 rm -rf libs/zlib endif # execute wine's configure script ./configure $(CONFLAGS) override_dh_auto_build-indep: # only build fonts for the architecture-independent packages make -C tools/sfnt2fon make -C fonts override_dh_auto_build-arch: # build wine's headers upfront to avoid incompatible mingw versions make -C include dh_auto_build override_dh_auto_test: # disabled, there are currently too many failing tests override_dh_prep: dh_prep -X debian/tmp override_dh_install-indep: dh_install # create font symlinks ./debian/scripts/font-symlinks override_dh_auto_install-indep: $(INSTALLS) mkdir -p debian/tmp # copy documentation cp README.md debian/tmp/README cp ANNOUNCE.md debian/tmp/NEWS cp programs/winedbg/README debian/tmp/README.winedbg # copy scripts cp debian/scripts/wine.in debian/tmp/wine$(DEBSUFFIX) sed "s|DEBSUFFIX|$(DEBSUFFIX)|g" debian/scripts/apploader.in > debian/tmp/apploader # build manpages make $(shell find . ! -path "./.pc/*" -name *\\.man\\.in | sed s/\\.in//) # append suffix to manpage file names for file in $$(find . ! -path "./debian/*" -name \*.man); do \ rename=$$(basename $$file | sed "s/\\./$(DEBSUFFIX)./;s/UTF-8\\.//"); \ cp $$file debian/tmp/$$rename || true; \ done # files to exclude from the architecture-independent packages rm -f debian/tmp/notepad*.man debian/tmp/winemine*.man # extract hicolor icon from logo.svg sed '/image\/png/d;s|width="611"|width="209"|' programs/winecfg/logo.svg > debian/tmp/wine$(DEBSUFFIX).svg override_dh_auto_install-arch: $(INSTALLS) mkdir -p debian/tmp # copy documentation cp VERSION debian/tmp/collection$(DEBSUFFIX) cp README.md debian/tmp/README cp ANNOUNCE.md debian/tmp/NEWS cp tools/winedump/README debian/tmp/README.winedump # copy scripts sed "s|BINDIR|$(LIBDIR)|g" debian/scripts/winegcc.in > debian/tmp/winegcc$(DEBSUFFIX) sed "s|DEB_HOST_MULTIARCH|$(DEB_HOST_MULTIARCH)|g;s|VERSION|$(VERSION)|g" debian/scripts/wine$(DEB_HOST_ARCH_BITS).in \ > debian/tmp/wine$(DEB_HOST_ARCH_BITS)$(DEBSUFFIX) # install dh_installdirs dh_auto_install # append suffix to manpage file names cp loader/wine.man loader/wine32.man cp loader/wine.man loader/wine64.man for file in $$(find . ! -path "./debian/*" -name \*.man); do \ rename=$$(basename $$file | sed "s/\\./$(DEBSUFFIX)./;s/UTF-8\\.//"); \ cp $$file debian/tmp/$$rename || true; \ done # copy wine-preloader mv debian/tmp/$(LIBDIR)/wine-preloader debian/tmp/$(LIBDIR)/wine-preloader.static || \ cp debian/scripts/wine-preloader.static debian/tmp/$(LIBDIR)/wine-preloader.static # files to exclude from the architecture-dependent packages rm -rf debian/tmp/usr/share/man rm -f debian/tmp/usr/share/*/fonts/*.fon rm -f debian/tmp/usr/share/*/fonts/*.ttf rm -f debian/tmp/notepad*.man debian/tmp/winemine*.man # do not try to strip archive files on arm, they currently cause dh_strip to fail ifneq (,$(filter $(DEB_HOST_ARCH),armhf arm64)) override_dh_strip: dh_strip --exclude \.a endif override_dh_makeshlibs: # avoid unnecessary calls to ldconfig dh_makeshlibs --no-scripts -- -V override_dh_shlibdeps: mkdir -p debian/tmp ./debian/scripts/config2elf debian/tmp/elf.recommends ./debian/scripts/config2elf debian/tmp/elf.depends "libfontconfig|libfreetype|libncurses" dpkg-shlibdeps --warnings=1 -v -pdlopen \ -dDepends -edebian/tmp/elf.depends \ -dRecommends -edebian/tmp/elf.recommends \ -Tdebian/libwine$(VERSION).substvars 2>/dev/null dh_shlibdeps -- -v -l/$(LIBDIR)/$(WINE_CPU)-unix override_dh_bugfiles: dh_bugfiles -A override_dh_missing: dh_missing -X elf.depends -X elf.recommends -X wine.desktop override_dh_clean: dh_clean -- $(INSTALLS) override_dh_auto_clean: ifeq (,$(filter $(DEB_HOST_ARCH),i386 amd64)) # remove zlib patch on non x86 architectures QUILT_PATCHES=debian/patches quilt pop -af || true QUILT_PATCHES=debian/patches quilt delete system/zlib.patch || true endif QUILT_PATCHES=debian/patches quilt push -af || true dh_auto_clean