summaryrefslogtreecommitdiff
path: root/emacs
diff options
context:
space:
mode:
authorRobin Haberkorn <robin.haberkorn@googlemail.com>2011-01-02 23:27:23 +0100
committerRobin Haberkorn <robin.haberkorn@googlemail.com>2011-01-02 23:27:23 +0100
commit9352995934adec8059077af241c35ccd1573bd80 (patch)
tree60286e266b3b31b90b952ac37e12a1ebbcdd2eb6 /emacs
parentef3b84d78197acbd45d73a9b1ae44b47b5904290 (diff)
parent880bca260c4ce91554a49b2475232cf5c0ffd447 (diff)
downloadqipackages-fork-9352995934adec8059077af241c35ccd1573bd80.tar.gz
Merge branch 'master' of git://projects.qi-hardware.com/openwrt-packagesHEADmaster
Conflicts: links/Makefile
Diffstat (limited to 'emacs')
-rw-r--r--emacs/Makefile204
-rw-r--r--emacs/files/site-start.el27
-rw-r--r--emacs/patches/010-fix-init-env.patch15
-rw-r--r--emacs/patches/010-tune-loadup.patch31
4 files changed, 277 insertions, 0 deletions
diff --git a/emacs/Makefile b/emacs/Makefile
new file mode 100644
index 0000000..166f482
--- /dev/null
+++ b/emacs/Makefile
@@ -0,0 +1,204 @@
+#
+# Copyright (C) David Kuehling <dvdkhlng TA gmx TOD de>
+#
+# License GPLv2 or later. NO WARRANTY.
+#
+# OpenWRT package for the complete GNU Emacs editor
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=emacs
+PKG_VERSION:=23.2
+PKG_RELEASE:=3
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=ftp://ftp.fu-berlin.de/pub/gnu/emacs/ \
+ @GNU/emacs/
+
+PKG_MD5SUM:=b6691852dae0bc142b3c12749f6b7ade
+PKG_INSTALL:=1
+PKG_FIXUP:=libtool
+
+PKG_BUILD_DEPENDS:= emacs/host libtool/host
+
+include $(INCLUDE_DIR)/host-build.mk
+include $(INCLUDE_DIR)/package.mk
+
+define Package/emacs/Default
+ SUBMENU:=Emacs
+ SECTION:=utils
+ CATEGORY:=Utilities
+ TITLE:=The GNU Emacs Editor a.k.a. \"Emacs OS\"
+ URL:=http://www.gnu.org/software/emacs/
+# SUBMENU:=Editors
+endef
+
+define Package/emacs/Default/description
+GNU Emacs is an extensible, customizable text editor — and more.
+At its core is an interpreter for Emacs Lisp, a dialect of the
+Lisp programming language with extensions to support text editing.
+endef
+
+define Package/emacs
+$(call Package/emacs/Default)
+ DEPENDS:=+libncurses +emacs-data
+ TITLE+= (executable)
+endef
+
+define Package/emacs/description
+$(call Package/emacs/Default/description)
+ This package contains the Emacs executable files
+endef
+
+define Package/emacs-data
+$(call Package/emacs/Default)
+ TITLE+= (compiled lisp)
+endef
+
+define Package/emacs-data/description
+$(call Package/emacs/Default/description)
+ This package contains the compiled Lisp files needed to run Emacs.
+endef
+
+define Package/emacs-ja-dic
+$(call Package/emacs/Default)
+ TITLE+= (japanese input dictionary)
+ DEPENDS:=+emacs
+endef
+
+define Package/emacs-ja-dic/description
+$(call Package/emacs/Default/description)
+ This package contains the japanese dictionary used to input japanese Kanji
+ via Hiragana->Kanji conversion (\'set-input-method japanese\'). This
+ dictionary is huge, so huge that emacs won\'t be able to load it on systems
+ with 32MB or fewer RAM.
+endef
+
+define Package/emacs-el
+$(call Package/emacs/Default)
+ TITLE+= (lisp source)
+endef
+
+define Package/emacs-el/description
+$(call Package/emacs/Default/description)
+ This package contains the Lisp source files of Emacs that can queried via
+ C-h f in case provided documentation of an Emacs function is insufficient.
+endef
+
+EMACS_STRIPTEASE_ARGS = \
+ --without-x \
+ --without-xpm \
+ --without-jpeg \
+ --without-gif \
+ --without-png \
+ --without-rsvg \
+ --without-xft \
+ --without-libotf \
+ --without-dbus \
+ --without-gconf
+
+HOST_CONFIGURE_ARGS += $(EMACS_STRIPTEASE_ARGS)
+CONFIGURE_ARGS += $(EMACS_STRIPTEASE_ARGS)
+MAKE_FLAGS += "LD=$(TARGET_CROSS)gcc"
+
+## Don't try that: lowering PURESIZE makes Emacs' RAM usage explode! Maybe
+## something about Elisp garbage collection!?
+#TARGET_CPPFLAGS += -DPURESIZE=16
+
+## Keep emacs build system from doing all kinds nasty tricks that won't work
+## (well) with openwrt and uclibc. Especially keep it from attempting to
+## manually configure crt* startup file linking. We won't be able to 'dump'
+## during cross-compile anyway. Dumping inside the target system seems not
+## possible due to lack of RAM. Note that we also need to sanitize the
+## Makefile using 'sed' below.
+TARGET_CPPFLAGS += -DCANNOT_DUMP -DNO_REMAP -DORDINARY_LINK
+
+define Build/Prepare
+ $(call Build/Prepare/Default)
+endef
+
+define Host/Configure
+ $(call Host/Configure/Default)
+endef
+
+## On the host, we only compile and install minimum Emacs components used for
+## bootstrapping
+define Host/Compile
+ export LD_LIBRARY_PATH=$(STAGING_DIR_HOST)/lib; \
+ $(call Host/Compile/Default)
+endef
+
+define Host/Install
+ $(call Host/Install/Default)
+ $(INSTALL_BIN) $(HOST_BUILD_DIR)/lib-src/make-docfile $(STAGING_DIR_HOST)/bin/emacs-make-docfile
+ $(INSTALL_BIN) $(HOST_BUILD_DIR)/src/prefix-args $(STAGING_DIR_HOST)/bin/emacs-prefix-args
+endef
+
+define Build/Configure
+ $(call Build/Configure/Default)
+endef
+
+define Build/Compile
+ $(call Build/Compile/Default, -C lib-src -o test-distrib)
+ ln -sf $(STAGING_DIR_HOST)/bin/emacs-make-docfile $(PKG_BUILD_DIR)/lib-src/make-docfile
+ ln -sf $(STAGING_DIR_HOST)/bin/emacs-prefix-args $(PKG_BUILD_DIR)/src/prefix-args
+ sed -ie 's;\(TEMACS_LDFLAGS\|STARTFILES\) =.*;\1 =;' $(PKG_BUILD_DIR)/src/Makefile
+# sed -ie 's; /usr/lib/crt[^ ]\+; $(TOOLCHAIN_DIR)/usr/lib/crt;g' $(PKG_BUILD_DIR)/src/Makefile
+ sed -ie 's; /usr/lib/crt[^ ]\+; ;g' $(PKG_BUILD_DIR)/src/Makefile
+ sed -ie 's;\(#.*PATH_DUMPLOADSEARCH\).*$$$$;\1 PATH_LOADSEARCH;' $(PKG_BUILD_DIR)/src/epaths.h
+ $(call Build/Compile/Default, -C src -o lib-src -o prefix-args -o ../lib-src/make-docfile temacs ../etc/DOC)
+ cp -v $(PKG_BUILD_DIR)/src/temacs $(PKG_BUILD_DIR)/src/emacs
+ $(call Build/Compile/Default, -C lisp EMACS=$(STAGING_DIR_HOST)/bin/emacs)
+ $(call Build/Compile/Default, -C leim BUILT-EMACS=$(STAGING_DIR_HOST)/bin/emacs)
+endef
+
+define Build/Install
+ sed -ie 's;./src/emacs\( --version\);$(STAGING_DIR_HOST)/bin/emacs \1;g' \
+ $(PKG_BUILD_DIR)/Makefile
+ $(call Build/Install/Default,install-arch-indep install-arch-dep install-leim INSTALL_STRIP=-s "MFLAGS=-o test-distrib")
+ $(INSTALL_DATA) ./files/site-start.el $(PKG_INSTALL_DIR)/usr/share/emacs/$(PKG_VERSION)/site-lisp
+endef
+
+define Package/emacs/install
+ $(INSTALL_DIR) $(1)/usr
+ cp -r $(PKG_INSTALL_DIR)/usr/{bin,lib} $(1)/usr
+endef
+
+define Package/emacs-data/install
+ $(INSTALL_DIR) $(1)/
+ (cd $(PKG_INSTALL_DIR)/ && \
+ tar -cf - --exclude "*.el.gz" \
+ --exclude "images" \
+ --exclude "refcards" \
+ --exclude "schema" \
+ --exclude "NEWS*" \
+ --exclude "ja-dic" \
+ usr/share) \
+ | (cd $(1)/ && tar -xvf -)
+endef
+
+define Package/emacs-ja-dic/install
+ $(INSTALL_DIR) $(1)/usr
+ (cd $(PKG_INSTALL_DIR)/usr && tar -cf - \
+ --exclude "*.el.gz" share/emacs/$(PKG_VERSION)/leim/ja-dic) \
+ | (cd $(1)/usr && tar -xvf -)
+endef
+
+define Package/emacs-el/install
+ $(INSTALL_DIR) $(1)/usr
+ (cd $(PKG_INSTALL_DIR)/usr && find share -name "*.el.gz" \
+ | tar -cf - -T - --exclude "ja-dic" ) \
+ | (cd $(1)/usr && tar -xvf -)
+endef
+
+
+$(eval $(call HostBuild))
+$(eval $(call BuildPackage,emacs))
+$(eval $(call BuildPackage,emacs-data))
+$(eval $(call BuildPackage,emacs-ja-dic))
+$(eval $(call BuildPackage,emacs-el))
+
+
+# The following comments configure the Emacs editor. Just ignore them.
+# Local Variables:
+# compile-command: "make -C ~/h/src/qi/openwrt-xburst package/emacs/compile -j2 V=99"
+# End:
diff --git a/emacs/files/site-start.el b/emacs/files/site-start.el
new file mode 100644
index 0000000..e760ec8
--- /dev/null
+++ b/emacs/files/site-start.el
@@ -0,0 +1,27 @@
+;; Emacs startup file for OpenWRT Emacs package
+;;
+;; Copyright (C) 2010 David Kuehling <dvdkhlng TA gmx TOD de>
+;; License: GPLv2 or later; NO WARRANTY.
+;;
+
+;; load documentation for internal functions. This is skipped by loadup.el
+;; when not dumping so we do it here.
+(Snarf-documentation "DOC")
+
+;; On openwrt 'ls' is provided by busybox. That version of 'ls' does not
+;; support the --dired option, make Emacs work around that.
+(setq dired-use-ls-dired nil)
+
+;; Allow us to output international characters to the terminal
+(set-terminal-coding-system 'utf-8)
+
+;; Do not show the menu bar. What use is it without a mouse?
+;; (Note that you can still use the menu via <Esc> x menu-bar-open
+;; or tmm-menubar
+(menu-bar-mode 0)
+
+;; ugly work-around for load-history entry (require . t-mouse) added by
+;; linux.el Not good, as it costs some memory.
+(setq load-history
+ (apply 'nconc (mapcar (lambda (v) (if (stringp (car v)) (list v) nil))
+ load-history)))
diff --git a/emacs/patches/010-fix-init-env.patch b/emacs/patches/010-fix-init-env.patch
new file mode 100644
index 0000000..a03a9c4
--- /dev/null
+++ b/emacs/patches/010-fix-init-env.patch
@@ -0,0 +1,15 @@
+Index: emacs23.2-openwrt-q/src/emacs.c
+===================================================================
+--- emacs23.2-openwrt-q.orig/src/emacs.c 2010-12-18 20:24:35.000000000 +0100
++++ emacs23.2-openwrt-q/src/emacs.c 2010-12-18 20:28:41.000000000 +0100
+@@ -1735,6 +1735,10 @@
+ #endif /* HAVE_NTGUI */
+ }
+
++ /* syms_of_callproc() resets process-environment to nil; generating it again
++ * here, as workaround (probably only hits us since we're not dumping */
++ set_initial_environment();
++
+ init_charset ();
+
+ init_editfns (); /* init_process uses Voperating_system_release. */
diff --git a/emacs/patches/010-tune-loadup.patch b/emacs/patches/010-tune-loadup.patch
new file mode 100644
index 0000000..0043c43
--- /dev/null
+++ b/emacs/patches/010-tune-loadup.patch
@@ -0,0 +1,31 @@
+Index: emacs23.2-openwrt-q/lisp/loadup.el
+===================================================================
+--- emacs23.2-openwrt-q.orig/lisp/loadup.el 2010-12-18 20:22:56.000000000 +0100
++++ emacs23.2-openwrt-q/lisp/loadup.el 2010-12-18 20:23:14.000000000 +0100
+@@ -47,6 +47,14 @@
+
+ ;;; Code:
+
++;; This reduces memory usage by a few MB. So far no negative consequences
++;; have been witnessed.
++(setq inhibit-load-charset-map t)
++
++;; Purify does in fact _safe_ memory (more efficient than normal' heap?) so
++;; do not disable it for now.
++;(setq purify-flag nil)
++
+ ;; Add subdirectories to the load-path for files that might get
+ ;; autoloaded when bootstrapping.
+ (if (or (equal (nth 3 command-line-args) "bootstrap")
+@@ -80,9 +88,10 @@
+ (load "emacs-lisp/backquote")
+ (load "subr")
+
++;; not doing garbage collection this often decreases start-up time by 5s
+ ;; Do it after subr, since both after-load-functions and add-hook are
+ ;; implemented in subr.el.
+-(add-hook 'after-load-functions '(lambda (f) (garbage-collect)))
++;(add-hook 'after-load-functions '(lambda (f) (garbage-collect)))
+
+ ;; We specify .el in case someone compiled version.el by mistake.
+ (load "version.el")