Root/emacs/Makefile

1#
2# Copyright (C) David Kuehling <dvdkhlng TA gmx TOD de>
3#
4# License GPLv2 or later. NO WARRANTY.
5#
6# OpenWRT package for the complete GNU Emacs editor
7
8include $(TOPDIR)/rules.mk
9
10PKG_NAME:=emacs
11PKG_VERSION:=23.2
12PKG_RELEASE:=3
13PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
14PKG_SOURCE_URL:=ftp://ftp.fu-berlin.de/pub/gnu/emacs/ \
15    @GNU/emacs/
16
17PKG_MD5SUM:=b6691852dae0bc142b3c12749f6b7ade
18PKG_INSTALL:=1
19PKG_FIXUP:=libtool
20
21PKG_BUILD_DEPENDS:= emacs/host libtool/host
22
23include $(INCLUDE_DIR)/host-build.mk
24include $(INCLUDE_DIR)/package.mk
25
26define Package/emacs/Default
27  SUBMENU:=Emacs
28  SECTION:=utils
29  CATEGORY:=Utilities
30  TITLE:=The GNU Emacs Editor a.k.a. \"Emacs OS\"
31  URL:=http://www.gnu.org/software/emacs/
32# SUBMENU:=Editors
33endef
34
35define Package/emacs/Default/description
36GNU Emacs is an extensible, customizable text editor — and more.
37At its core is an interpreter for Emacs Lisp, a dialect of the
38Lisp programming language with extensions to support text editing.
39endef
40
41define Package/emacs
42$(call Package/emacs/Default)
43  DEPENDS:=+libncurses +emacs-data
44  TITLE+= (executable)
45endef
46
47define Package/emacs/description
48$(call Package/emacs/Default/description)
49 This package contains the Emacs executable files
50endef
51
52define Package/emacs-data
53$(call Package/emacs/Default)
54  TITLE+= (compiled lisp)
55endef
56
57define Package/emacs-data/description
58$(call Package/emacs/Default/description)
59 This package contains the compiled Lisp files needed to run Emacs.
60endef
61
62define Package/emacs-ja-dic
63$(call Package/emacs/Default)
64  TITLE+= (japanese input dictionary)
65  DEPENDS:=+emacs
66endef
67
68define Package/emacs-ja-dic/description
69$(call Package/emacs/Default/description)
70 This package contains the japanese dictionary used to input japanese Kanji
71 via Hiragana->Kanji conversion (\'set-input-method japanese\'). This
72 dictionary is huge, so huge that emacs won\'t be able to load it on systems
73 with 32MB or fewer RAM.
74endef
75
76define Package/emacs-el
77$(call Package/emacs/Default)
78  TITLE+= (lisp source)
79endef
80
81define Package/emacs-el/description
82$(call Package/emacs/Default/description)
83 This package contains the Lisp source files of Emacs that can queried via
84 C-h f in case provided documentation of an Emacs function is insufficient.
85endef
86
87EMACS_STRIPTEASE_ARGS = \
88    --without-x \
89    --without-xpm \
90    --without-jpeg \
91    --without-gif \
92    --without-png \
93    --without-rsvg \
94    --without-xft \
95    --without-libotf \
96    --without-dbus \
97    --without-gconf
98
99HOST_CONFIGURE_ARGS += $(EMACS_STRIPTEASE_ARGS)
100CONFIGURE_ARGS += $(EMACS_STRIPTEASE_ARGS)
101MAKE_FLAGS += "LD=$(TARGET_CROSS)gcc"
102
103## Don't try that: lowering PURESIZE makes Emacs' RAM usage explode! Maybe
104## something about Elisp garbage collection!?
105#TARGET_CPPFLAGS += -DPURESIZE=16
106
107## Keep emacs build system from doing all kinds nasty tricks that won't work
108## (well) with openwrt and uclibc. Especially keep it from attempting to
109## manually configure crt* startup file linking. We won't be able to 'dump'
110## during cross-compile anyway. Dumping inside the target system seems not
111## possible due to lack of RAM. Note that we also need to sanitize the
112## Makefile using 'sed' below.
113TARGET_CPPFLAGS += -DCANNOT_DUMP -DNO_REMAP -DORDINARY_LINK
114
115define Build/Prepare
116    $(call Build/Prepare/Default)
117endef
118
119define Host/Configure
120    $(call Host/Configure/Default)
121endef
122
123## On the host, we only compile and install minimum Emacs components used for
124## bootstrapping
125define Host/Compile
126    export LD_LIBRARY_PATH=$(STAGING_DIR_HOST)/lib; \
127    $(call Host/Compile/Default)
128endef
129
130define Host/Install
131    $(call Host/Install/Default)
132    $(INSTALL_BIN) $(HOST_BUILD_DIR)/lib-src/make-docfile $(STAGING_DIR_HOST)/bin/emacs-make-docfile
133    $(INSTALL_BIN) $(HOST_BUILD_DIR)/src/prefix-args $(STAGING_DIR_HOST)/bin/emacs-prefix-args
134endef
135
136define Build/Configure
137    $(call Build/Configure/Default)
138endef
139
140define Build/Compile
141    $(call Build/Compile/Default, -C lib-src -o test-distrib)
142    ln -sf $(STAGING_DIR_HOST)/bin/emacs-make-docfile $(PKG_BUILD_DIR)/lib-src/make-docfile
143    ln -sf $(STAGING_DIR_HOST)/bin/emacs-prefix-args $(PKG_BUILD_DIR)/src/prefix-args
144    sed -ie 's;\(TEMACS_LDFLAGS\|STARTFILES\) =.*;\1 =;' $(PKG_BUILD_DIR)/src/Makefile
145# sed -ie 's; /usr/lib/crt[^ ]\+; $(TOOLCHAIN_DIR)/usr/lib/crt;g' $(PKG_BUILD_DIR)/src/Makefile
146    sed -ie 's; /usr/lib/crt[^ ]\+; ;g' $(PKG_BUILD_DIR)/src/Makefile
147    sed -ie 's;\(#.*PATH_DUMPLOADSEARCH\).*$$$$;\1 PATH_LOADSEARCH;' $(PKG_BUILD_DIR)/src/epaths.h
148    $(call Build/Compile/Default, -C src -o lib-src -o prefix-args -o ../lib-src/make-docfile temacs ../etc/DOC)
149    cp -v $(PKG_BUILD_DIR)/src/temacs $(PKG_BUILD_DIR)/src/emacs
150    $(call Build/Compile/Default, -C lisp EMACS=$(STAGING_DIR_HOST)/bin/emacs)
151    $(call Build/Compile/Default, -C leim BUILT-EMACS=$(STAGING_DIR_HOST)/bin/emacs)
152endef
153
154define Build/Install
155    sed -ie 's;./src/emacs\( --version\);$(STAGING_DIR_HOST)/bin/emacs \1;g' \
156        $(PKG_BUILD_DIR)/Makefile
157    $(call Build/Install/Default,install-arch-indep install-arch-dep install-leim INSTALL_STRIP="" "MFLAGS=-o test-distrib")
158    $(INSTALL_DATA) ./files/site-start.el $(PKG_INSTALL_DIR)/usr/share/emacs/$(PKG_VERSION)/site-lisp
159endef
160
161define Package/emacs/install
162    $(INSTALL_DIR) $(1)/usr
163    cp -r $(PKG_INSTALL_DIR)/usr/{bin,lib} $(1)/usr
164endef
165
166define Package/emacs-data/install
167    $(INSTALL_DIR) $(1)/
168    (cd $(PKG_INSTALL_DIR)/ && \
169      tar -cf - --exclude "*.el.gz" \
170        --exclude "images" \
171        --exclude "refcards" \
172        --exclude "schema" \
173        --exclude "NEWS*" \
174        --exclude "ja-dic" \
175        usr/share) \
176        | (cd $(1)/ && tar -xvf -)
177endef
178
179define Package/emacs-ja-dic/install
180    $(INSTALL_DIR) $(1)/usr
181    (cd $(PKG_INSTALL_DIR)/usr && tar -cf - \
182        --exclude "*.el.gz" share/emacs/$(PKG_VERSION)/leim/ja-dic) \
183        | (cd $(1)/usr && tar -xvf -)
184endef
185
186define Package/emacs-el/install
187    $(INSTALL_DIR) $(1)/usr
188    (cd $(PKG_INSTALL_DIR)/usr && find share -name "*.el.gz" \
189      | tar -cf - -T - --exclude "ja-dic" ) \
190     | (cd $(1)/usr && tar -xvf -)
191endef
192
193
194$(eval $(call HostBuild))
195$(eval $(call BuildPackage,emacs))
196$(eval $(call BuildPackage,emacs-data))
197$(eval $(call BuildPackage,emacs-ja-dic))
198$(eval $(call BuildPackage,emacs-el))
199
200
201# The following comments configure the Emacs editor. Just ignore them.
202# Local Variables:
203# compile-command: "make -C ~/h/src/qi/openwrt-xburst package/emacs/compile -j2 V=99"
204# End:
205

Archive Download this file



interactive