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

Archive Download this file



interactive