--- emacs25-25.2+1/debian/control
+++ emacs25-25.2+1/debian/control
@@ -15,7 +15,7 @@ Build-Depends: bsd-mailx | mailx, libncu
  debhelper (>= 9), libxaw7-dev, sharutils, imagemagick, libgtk-3-dev,
  libgnutls28-dev, libxml2-dev, libselinux1-dev [linux-any],
  libasound2-dev [!hurd-i386 !kfreebsd-i386 !kfreebsd-amd64],
- libmagick++-6.q16-dev,
+ libmagick++-6.q16-dev, libgnustep-gui-dev,
  libacl1-dev,
  liboss4-salsa-dev [hurd-i386 kfreebsd-i386 kfreebsd-amd64],
  zlib1g-dev
@@ -27,8 +27,8 @@ Architecture: any
 Depends: emacs25-bin-common (= ${binary:Version}), ${shlibs:Depends}, ${misc:Depends}
 Provides: emacs25, emacsen, editor, info-browser, mail-reader, news-reader
 Suggests: emacs25-common-non-dfsg
-Conflicts: emacs25, emacs25-nox
-Replaces: emacs25, emacs25-nox
+Conflicts: emacs25, emacs25-nox, emacs25.app
+Replaces: emacs25, emacs25-nox, emacs25.app
 Description: GNU Emacs editor (with Lucid GUI support)
  GNU Emacs is the extensible self-documenting text editor.  This
  package contains a version of Emacs with support for a graphical user
@@ -55,8 +55,8 @@ Architecture: any
 Depends: emacs25-bin-common (= ${binary:Version}), ${shlibs:Depends}, ${misc:Depends}
 Provides: emacs25, editor, emacsen, info-browser, mail-reader, news-reader
 Suggests: emacs25-common-non-dfsg
-Conflicts: emacs25, emacs25-lucid
-Replaces: emacs25, emacs25-lucid
+Conflicts: emacs25, emacs25-lucid, emacs25.app
+Replaces: emacs25, emacs25-lucid, emacs25.app
 Description: GNU Emacs editor (without GUI support)
  GNU Emacs is the extensible self-documenting text editor.  This
  package contains a version of Emacs compiled without support for X,
@@ -77,8 +77,8 @@ Architecture: any
 Depends: emacs25-bin-common (= ${binary:Version}), ${shlibs:Depends}, ${misc:Depends}
 Provides: editor, emacsen, info-browser, mail-reader, news-reader
 Suggests: emacs25-common-non-dfsg
-Conflicts: emacs25-lucid, emacs25-nox
-Replaces: emacs25-lucid, emacs25-nox
+Conflicts: emacs25-lucid, emacs25-nox, emacs25.app
+Replaces: emacs25-lucid, emacs25-nox, emacs25.app
 Description: GNU Emacs editor (with GTK+ GUI support)
  GNU Emacs is the extensible self-documenting text editor.  This
  package contains a version of Emacs with a graphical user interface
@@ -94,13 +94,38 @@ Description: Debugging symbols for emacs
  GNU Emacs is the extensible self-documenting text editor.  This
  package contains the debugging symbols for the emacs25 package.
 
+Package: emacs25.app
+Architecture: any
+Depends: emacs25-bin-common (= ${binary:Version}), ${shlibs:Depends}, ${misc:Depends}
+Provides: editor, emacsen, info-browser, mail-reader, news-reader
+Suggests: emacs25-common-non-dfsg
+Conflicts: emacs25-lucid, emacs25-nox, emacs25
+Replaces: emacs25-lucid, emacs25-nox, emacs25
+Description: GNU Emacs editor (with GNUstep support)
+ GNU Emacs is the extensible self-documenting text editor.  This
+ package contains a version of Emacs with a graphical user interface
+ based on GNUstep (instead of the Lucid toolkit provided by the
+ emacs25-lucid package or the GTK+ interface provided by the
+ emacs25 package).
+
+Package: emacs25.app-dbg
+Section: debug
+Priority: extra
+Architecture: any
+Depends: emacs25.app-dbg (= ${binary:Version}), ${misc:Depends}
+Description: Debugging symbols for emacs25.app
+ GNU Emacs is the extensible self-documenting text editor.  This
+ package contains the debugging symbols for the emacs25.app
+ package.
+
 Package: emacs25-bin-common
 Architecture: any
 Depends: emacs25-common (= ${source:Version}), ${shlibs:Depends}, ${misc:Depends}
 Description: GNU Emacs editor's shared, architecture dependent files
- GNU Emacs is the extensible self-documenting text editor.
- This package contains the architecture dependent infrastructure
- that's shared by emacs25, emacs25-lucid, and emacs25-nox.
+ GNU Emacs is the extensible self-documenting text editor.  This
+ package contains the architecture dependent infrastructure that's
+ shared by emacs25, emacs25-lucid, emacs25.app and
+ emacs25-nox.
 
 Package: emacs25-common
 Architecture: all
@@ -110,9 +135,10 @@ Suggests: emacs25-el, emacs25-common-non
 Conflicts: emacs25-el (<< ${source:Version}), cedet, eieio, speedbar, gnus-bonus-el
 Breaks: apel (<< 10.8+0.20120427-4)
 Description: GNU Emacs editor's shared, architecture independent infrastructure
- GNU Emacs is the extensible self-documenting text editor.
- This package contains the architecture independent infrastructure
- that's shared by emacs25, emacs25-lucid, and emacs25-nox.
+ GNU Emacs is the extensible self-documenting text editor.  This
+ package contains the architecture independent infrastructure that's
+ shared by emacs25, emacs25-lucid, emacs25.app and
+ emacs25-nox.
 
 Package: emacs25-el
 Architecture: all
--- emacs25-25.2+1/debian/control.in
+++ emacs25-25.2+1/debian/control.in
@@ -15,7 +15,7 @@ Build-Depends: bsd-mailx | mailx, libncu
  debhelper (>= 9), libxaw7-dev, sharutils, imagemagick, libgtk-3-dev,
  libgnutls28-dev, libxml2-dev, libselinux1-dev [linux-any],
  libasound2-dev [!hurd-i386 !kfreebsd-i386 !kfreebsd-amd64],
- libmagick++-6.q16-dev,
+ libmagick++-6.q16-dev, libgnustep-gui-dev,
  libacl1-dev,
  liboss4-salsa-dev [hurd-i386 kfreebsd-i386 kfreebsd-amd64],
  zlib1g-dev
@@ -27,8 +27,8 @@ Architecture: any
 Depends: @DEB_FLAVOR@-bin-common (= ${binary:Version}), ${shlibs:Depends}, ${misc:Depends}
 Provides: @DEB_FLAVOR@, emacsen, editor, info-browser, mail-reader, news-reader
 Suggests: @DEB_FLAVOR@-common-non-dfsg
-Conflicts: @DEB_FLAVOR@, @DEB_FLAVOR@-nox
-Replaces: @DEB_FLAVOR@, @DEB_FLAVOR@-nox
+Conflicts: @DEB_FLAVOR@, @DEB_FLAVOR@-nox, @DEB_FLAVOR@.app
+Replaces: @DEB_FLAVOR@, @DEB_FLAVOR@-nox, @DEB_FLAVOR@.app
 Description: GNU Emacs editor (with Lucid GUI support)
  GNU Emacs is the extensible self-documenting text editor.  This
  package contains a version of Emacs with support for a graphical user
@@ -55,8 +55,8 @@ Architecture: any
 Depends: @DEB_FLAVOR@-bin-common (= ${binary:Version}), ${shlibs:Depends}, ${misc:Depends}
 Provides: @DEB_FLAVOR@, editor, emacsen, info-browser, mail-reader, news-reader
 Suggests: @DEB_FLAVOR@-common-non-dfsg
-Conflicts: @DEB_FLAVOR@, @DEB_FLAVOR@-lucid
-Replaces: @DEB_FLAVOR@, @DEB_FLAVOR@-lucid
+Conflicts: @DEB_FLAVOR@, @DEB_FLAVOR@-lucid, @DEB_FLAVOR@.app
+Replaces: @DEB_FLAVOR@, @DEB_FLAVOR@-lucid, @DEB_FLAVOR@.app
 Description: GNU Emacs editor (without GUI support)
  GNU Emacs is the extensible self-documenting text editor.  This
  package contains a version of Emacs compiled without support for X,
@@ -77,8 +77,8 @@ Architecture: any
 Depends: @DEB_FLAVOR@-bin-common (= ${binary:Version}), ${shlibs:Depends}, ${misc:Depends}
 Provides: editor, emacsen, info-browser, mail-reader, news-reader
 Suggests: @DEB_FLAVOR@-common-non-dfsg
-Conflicts: @DEB_FLAVOR@-lucid, @DEB_FLAVOR@-nox
-Replaces: @DEB_FLAVOR@-lucid, @DEB_FLAVOR@-nox
+Conflicts: @DEB_FLAVOR@-lucid, @DEB_FLAVOR@-nox, @DEB_FLAVOR@.app
+Replaces: @DEB_FLAVOR@-lucid, @DEB_FLAVOR@-nox, @DEB_FLAVOR@.app
 Description: GNU Emacs editor (with GTK+ GUI support)
  GNU Emacs is the extensible self-documenting text editor.  This
  package contains a version of Emacs with a graphical user interface
@@ -94,13 +94,38 @@ Description: Debugging symbols for @DEB_
  GNU Emacs is the extensible self-documenting text editor.  This
  package contains the debugging symbols for the @DEB_FLAVOR@ package.
 
+Package: @DEB_FLAVOR@.app
+Architecture: any
+Depends: @DEB_FLAVOR@-bin-common (= ${binary:Version}), ${shlibs:Depends}, ${misc:Depends}
+Provides: editor, emacsen, info-browser, mail-reader, news-reader
+Suggests: @DEB_FLAVOR@-common-non-dfsg
+Conflicts: @DEB_FLAVOR@-lucid, @DEB_FLAVOR@-nox, @DEB_FLAVOR@
+Replaces: @DEB_FLAVOR@-lucid, @DEB_FLAVOR@-nox, @DEB_FLAVOR@
+Description: GNU Emacs editor (with GNUstep support)
+ GNU Emacs is the extensible self-documenting text editor.  This
+ package contains a version of Emacs with a graphical user interface
+ based on GNUstep (instead of the Lucid toolkit provided by the
+ @DEB_FLAVOR@-lucid package or the GTK+ interface provided by the
+ @DEB_FLAVOR@ package).
+
+Package: @DEB_FLAVOR@.app-dbg
+Section: debug
+Priority: extra
+Architecture: any
+Depends: @DEB_FLAVOR@.app-dbg (= ${binary:Version}), ${misc:Depends}
+Description: Debugging symbols for @DEB_FLAVOR@.app
+ GNU Emacs is the extensible self-documenting text editor.  This
+ package contains the debugging symbols for the @DEB_FLAVOR@.app
+ package.
+
 Package: @DEB_FLAVOR@-bin-common
 Architecture: any
 Depends: @DEB_FLAVOR@-common (= ${source:Version}), ${shlibs:Depends}, ${misc:Depends}
 Description: GNU Emacs editor's shared, architecture dependent files
- GNU Emacs is the extensible self-documenting text editor.
- This package contains the architecture dependent infrastructure
- that's shared by @DEB_FLAVOR@, @DEB_FLAVOR@-lucid, and @DEB_FLAVOR@-nox.
+ GNU Emacs is the extensible self-documenting text editor.  This
+ package contains the architecture dependent infrastructure that's
+ shared by @DEB_FLAVOR@, @DEB_FLAVOR@-lucid, @DEB_FLAVOR@.app and
+ @DEB_FLAVOR@-nox.
 
 Package: @DEB_FLAVOR@-common
 Architecture: all
@@ -110,9 +135,10 @@ Suggests: @DEB_FLAVOR@-el, @DEB_FLAVOR@-
 Conflicts: @DEB_FLAVOR@-el (<< ${source:Version}), cedet, eieio, speedbar, gnus-bonus-el
 Breaks: apel (<< 10.8+0.20120427-4)
 Description: GNU Emacs editor's shared, architecture independent infrastructure
- GNU Emacs is the extensible self-documenting text editor.
- This package contains the architecture independent infrastructure
- that's shared by @DEB_FLAVOR@, @DEB_FLAVOR@-lucid, and @DEB_FLAVOR@-nox.
+ GNU Emacs is the extensible self-documenting text editor.  This
+ package contains the architecture independent infrastructure that's
+ shared by @DEB_FLAVOR@, @DEB_FLAVOR@-lucid, @DEB_FLAVOR@.app and
+ @DEB_FLAVOR@-nox.
 
 Package: @DEB_FLAVOR@-el
 Architecture: all
--- emacs25-25.2+1/debian/patches/0013-Remove-conflicting-declataration.patch
+++ emacs25-25.2+1/debian/patches/0013-Remove-conflicting-declataration.patch
@@ -0,0 +1,12 @@
+--- emacs25-25.2+1.orig/src/nsterm.m
++++ emacs25-25.2+1/src/nsterm.m
+@@ -69,9 +69,6 @@
+ #endif
+ 
+ 
+-extern NSString *NSMenuDidBeginTrackingNotification;
+-
+-
+ /* ==========================================================================
+ 
+    NSTRACE, Trace support.
--- emacs25-25.2+1/debian/patches/series
+++ emacs25-25.2+1/debian/patches/series
@@ -10,3 +10,4 @@
 0010-Don-t-downcase-real-xref-in-elisp-mode-tests.patch
 0011-Disable-eieio-test-method-order-list-6.patch
 0012-A-remote-execution-exploit-via-enriched-text-has-bee.patch
+0013-Remove-conflicting-declataration.patch
--- emacs25-25.2+1/debian/rules
+++ emacs25-25.2+1/debian/rules
@@ -149,6 +149,11 @@ nonpersistent_autogen_install_files := \
   debian/$(flavor)-lucid.lintian-overrides \
   debian/$(flavor)-lucid.postinst \
   debian/$(flavor)-lucid.prerm \
+  debian/$(flavor).app.README.Debian \
+  debian/$(flavor).app.desktop \
+  debian/$(flavor).app.lintian-overrides \
+  debian/$(flavor).app.postinst \
+  debian/$(flavor).app.prerm \
   debian/$(flavor).README.Debian \
   debian/$(flavor).desktop \
   debian/$(flavor).lintian-overrides \
@@ -174,11 +179,13 @@ pkgdir_bin_common := $(CURDIR)/debian/$(
 pkgdir_x := $(CURDIR)/debian/$(flavor)
 pkgdir_nox := $(CURDIR)/debian/$(flavor)-nox
 pkgdir_lucid := $(CURDIR)/debian/$(flavor)-lucid
+pkgdir_gnustep := $(CURDIR)/debian/$(flavor).app
 pkgdir_el := $(CURDIR)/debian/$(flavor)-el
 
 install_dir_x := $(CURDIR)/debian/install-x
 install_dir_nox := $(CURDIR)/debian/install-nox
 install_dir_lucid := $(CURDIR)/debian/install-lucid
+install_dir_gnustep := $(CURDIR)/debian/install-gnustep
 
 local_lpath := /etc/$(flavor):/etc/emacs
 local_lpath := $(local_lpath):/usr/local/share/emacs/$(runtime_ver)/site-lisp
@@ -252,6 +259,9 @@ debian/$(flavor)-nox.%: pkg_name := $(fl
 debian/$(flavor)-lucid.%: xsupport := "lucid"
 debian/$(flavor)-lucid.%: pkg_name := $(flavor)-lucid
 
+debian/$(flavor).app.%: xsupport := "gnustep"
+debian/$(flavor).app.%: pkg_name := $(flavor).app
+
 debian/$(flavor)-common.%: pkg_name := $(flavor)-common
 debian/$(flavor)-bin-common.%: pkg_name := $(flavor)-bin-common
 
@@ -276,6 +286,9 @@ debian/$(flavor)-nox.%: debian/emacsVER.
 debian/$(flavor)-lucid.%: debian/emacsVER.% debian/changelog
 	$(call deb_sub,$<,$@)
 
+debian/$(flavor).app.%: debian/emacsVER.% debian/changelog
+	$(call deb_sub,$<,$@)
+
 debian/$(flavor)-term.desktop: debian/emacsVER-term.desktop debian/changelog
 	$(call deb_sub,$<,$@)
 
@@ -328,6 +341,11 @@ confflags_lucid += --with-x-toolkit=luci
 confflags_lucid += --with-toolkit-scroll-bars
 confflags_lucid += --without-gsettings
 
+# gnustep configure flags
+confflags_gnustep := $(confflags) 
+confflags_gnustep += --with-ns
+confflags_gnustep += --disable-ns-self-contained
+
 define cfg_tree
   cd $(1) && \
     CFLAGS="$(CFLAGS)" CPPFLAGS="$(CPPFLAGS)" LDFLAGS="$(LDFLAGS)" \
@@ -350,17 +368,18 @@ override_dh_auto_configure:
 
 debian/stamp-configured: $(autogen_build_files)
         # If the deps for this target change, start over
-	rm -rf debian/build-src debian/build-x debian/build-lucid debian/build-nox
+	rm -rf debian/build-src debian/build-x debian/build-lucid debian/build-nox debian/build-gnustep
 	mkdir debian/build-src
 	cp -a $$(ls -A | egrep -v '^(\.git|\.pc|debian)$$') debian/build-src
 	cp -a /usr/share/misc/config.guess /usr/share/misc/config.sub \
 	  debian/build-src
 	cd debian/build-src && ./autogen.sh
-	mkdir debian/build-lucid debian/build-nox debian/build-x
+	mkdir debian/build-lucid debian/build-nox debian/build-x debian/build-gnustep
         # Create one VPATH build per-flavor
 	$(call cfg_tree,debian/build-x,$(confflags_x))
 	$(call cfg_tree,debian/build-nox,$(confflags_nox))
 	$(call cfg_tree,debian/build-lucid,$(confflags_lucid))
+	$(call cfg_tree,debian/build-gnustep,$(confflags_gnustep))
 	touch $@
 
 override_dh_auto_build: debian/stamp-configured
@@ -369,12 +388,14 @@ override_dh_auto_build: debian/stamp-con
 	$(call build_cmd,debian/build-x)
 	$(call build_cmd,debian/build-nox)
 	$(call build_cmd,debian/build-lucid)
+	$(call build_cmd,debian/build-gnustep)
 
 override_dh_auto_test:
   ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
 	$(MAKE) -C debian/build-lucid check
 	$(MAKE) -C debian/build-nox check
 	$(MAKE) -C debian/build-x check
+	$(MAKE) -C debian/build-gnustep check
   endif
 
 define install_common_binpkg_bits
@@ -400,12 +421,13 @@ endef
 
 override_dh_auto_install: $(autogen_install_files)
 	rm -rf \
-	  $(install_dir_x) $(install_dir_nox) $(install_dir_lucid) \
+	  $(install_dir_x) $(install_dir_nox) $(install_dir_lucid) $(install_dir_gnustep)\
 	  $(pkgdir_common)/* \
 	  $(pkgdir_bin_common)/* \
 	  $(pkgdir_x)/* \
 	  $(pkgdir_nox)/* \
 	  $(pkgdir_lucid)/* \
+	  $(pkgdir_gnustep)/* \
 	  $(pkgdir_el)/*
 
 	$(call emacs_inst,build-x,$(install_dir_x))
@@ -585,6 +607,37 @@ override_dh_auto_install: $(autogen_inst
         endif
 
         ##################################################
+        # emacsXY.app
+        ifneq (,$(findstring $(flavor).app, $(shell dh_listpackages)))
+	  $(call emacs_inst,build-gnustep,$(install_dir_gnustep))
+	  $(call install_common_binpkg_bits,\
+	    $(install_dir_gnustep),$(pkgdir_gnustep),$(flavor).app,gnustep)
+
+	  # Install the app bundle; it must be versioned so that more
+	  # than one Emacs major version can be installed.
+	  install -d $(pkgdir_gnustep)/usr/share/GNUstep \
+	    $(pkgdir_gnustep)/usr/lib/GNUstep/Applications/Emacs$(major_ver).app
+	  $(RM) $(pkgdir_gnustep)/usr/bin/$(flavor)-gnustep
+	  mv debian/build-gnustep/nextstep/Emacs.app/Emacs \
+	    $(pkgdir_gnustep)/usr/lib/GNUstep/Applications/Emacs$(major_ver).app
+	  mv debian/build-gnustep/nextstep/Emacs.app/Resources \
+	    $(pkgdir_gnustep)/usr/share/GNUstep/Emacs$(major_ver).app
+	  dh_link -p$(flavor).app \
+	    usr/lib/GNUstep/Applications/Emacs$(major_ver).app/Emacs \
+	    usr/bin/$(flavor)-gnustep
+	  dh_link -p$(flavor).app \
+	    usr/share/GNUstep/Emacs$(major_ver).app \
+	    usr/lib/GNUstep/Applications/Emacs$(major_ver).app/Resources
+          # install desktop entries
+	  install -d $(pkgdir_gnustep)/usr/share/applications
+	  install -m 0644 \
+	    debian/$(flavor).app.desktop \
+	    debian/$(flavor)-term.desktop \
+	    $(pkgdir_gnustep)/usr/share/applications/
+	  rm -rf $(install_dir_gnustep)
+        endif
+
+        ##################################################
         # emacsXY-el
         ifneq (,$(findstring $(flavor)-el, $(shell dh_listpackages)))
 	  install -d $(pkgdir_el)
@@ -599,12 +652,14 @@ override_dh_auto_install: $(autogen_inst
 	rm -rf $(install_dir_x)
 	rm -rf $(install_dir_nox)
 	rm -rf $(install_dir_lucid)
+	rm -rf $(install_dir_gnustep)
 
 .PHONY: override_dh_strip
 override_dh_strip:
 	dh_strip -p$(flavor) --dbg-package=$(flavor)-dbg
 	dh_strip -p$(flavor)-lucid --dbg-package=$(flavor)-lucid-dbg
 	dh_strip -p$(flavor)-nox --dbg-package=$(flavor)-nox-dbg
+	dh_strip -p$(flavor).app --dbg-package=$(flavor).app-dbg
 	dh_strip
 
 # This won't be necessary once strip-nondeterminism is fixed.
@@ -650,11 +705,13 @@ override_dh_clean: $(persistent_autogen_
 	  debian/build-nox \
 	  debian/build-src \
 	  debian/build-x \
+	  debian/build-gnustep \
 	  debian/elgz-canary \
 	  debian/elgz-info \
 	  debian/emacsVER-common.README.00 \
 	  debian/emacsVER-common.README.01 \
 	  debian/install-lucid \
 	  debian/install-nox \
+	  debian/install-gnustep \
 	  debian/install-x
 	rm -f $(nonpersistent_autogen_files)
