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:=5
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
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# SUBMENU:=Editors
38endef
39
40define Package/emacs/Default/description
41GNU Emacs is an extensible, customizable text editor — and more.
42At its core is an interpreter for Emacs Lisp, a dialect of the
43Lisp programming language with extensions to support text editing.
44endef
45
46define Package/emacs
47$(call Package/emacs/Default)
48  DEPENDS:=+libncurses +emacs-data
49  TITLE+= (executable)
50endef
51
52define Package/emacs/description
53$(call Package/emacs/Default/description)
54 This package contains the Emacs executable files
55endef
56
57define Package/emacs-data
58$(call Package/emacs/Default)
59  TITLE+= (compiled lisp)
60endef
61
62define Package/emacs-data/description
63$(call Package/emacs/Default/description)
64 This package contains the compiled Lisp files needed to run Emacs.
65endef
66
67define Package/emacs-ja-dic
68$(call Package/emacs/Default)
69  TITLE+= (japanese input dictionary)
70  DEPENDS:=+emacs
71endef
72
73define Package/emacs-ja-dic/description
74$(call Package/emacs/Default/description)
75 This package contains the japanese dictionary used to input japanese Kanji
76 via Hiragana->Kanji conversion (\'set-input-method japanese\'). This
77 dictionary is huge, so huge that emacs won\'t be able to load it on systems
78 with 32MB or fewer RAM.
79endef
80
81define Package/emacs-el
82$(call Package/emacs/Default)
83  TITLE+= (lisp source)
84endef
85
86define Package/emacs-el/description
87$(call Package/emacs/Default/description)
88 This package contains the Lisp source files of Emacs that can queried via
89 C-h f in case provided documentation of an Emacs function is insufficient.
90endef
91
92DUMP_EMACS=1
93
94EMACS_STRIPTEASE_ARGS = \
95    --without-x \
96    --without-xpm \
97    --without-jpeg \
98    --without-gif \
99    --without-png \
100    --without-rsvg \
101    --without-xft \
102    --without-libotf \
103    --without-dbus \
104    --without-gconf \
105    --without-gpm \
106    --without-sound
107
108HOST_CONFIGURE_ARGS += $(EMACS_STRIPTEASE_ARGS)
109CONFIGURE_ARGS += $(EMACS_STRIPTEASE_ARGS)
110
111## Don't try that: lowering PURESIZE makes Emacs' RAM usage explode! Maybe
112## something about Elisp garbage collection!?
113#TARGET_CPPFLAGS += -DPURESIZE=16
114
115# sed-script to apply to src/Makefile of emacs sources. more commands
116# appended below
117EMACS_MAKEFILE_SED = ;
118
119# sed-script to apply to src/epaths.h, commands appended below
120EMACS_EPATHS_SED = ;
121
122## when DUMP_EMACS is unset, we keep emacs build system from doing all
123## kinds nasty tricks that won't work (well) with openwrt and uclibc.
124## Especially keep it from attempting to manually configure crt* startup file
125## linking. We won't be able to 'dump' during cross-compile anyway. Dumping
126## inside the target system seems not possible due to lack of RAM. Note that
127## we also need to sanitize the Makefile using 'sed' below.
128ifeq ($(DUMP_EMACS),)
129    MAKE_FLAGS += "LD=$(TARGET_CROSS)gcc"
130    TARGET_CPPFLAGS += -DCANNOT_DUMP -DNO_REMAP -DORDINARY_LINK
131    EMACS_MAKEFILE_SED += ; s;\(TEMACS_LDFLAGS\|STARTFILES\) =.*;\1 =;
132    EMACS_MAKEFILE_SED += ; s; /usr/lib/crt[^ ]\+; ;g
133    EMACS_EPATHS_SED += ; s;\(\#.*PATH_DUMPLOADSEARCH\).*$$$$;\1 PATH_LOADSEARCH;
134        define emacs_perform_dump
135      $(CP) $(PKG_BUILD_DIR)/src/temacs $(PKG_BUILD_DIR)/src/emacs
136        endef
137else
138    MAKE_FLAGS += LD="$(TARGET_CROSS)gcc -nostdlib"
139    TARGET_CPPFLAGS +=
140        # warning: on backfile it'd be $(TOOLCHAIN_DIR)/usr/lib
141    EMACS_MAKEFILE_SED += ; s; /usr/lib/crt\([^ ]\+\); $(TOOLCHAIN_DIR)/lib/crt\1;g
142
143    PKG_BUILD_DEPENDS += +qemu-host/host
144
145        define emacs_perform_dump
146      $(SED) \
147        's/(member (nth 3 command-line-args) .("dump" "bootstrap"))/t/g' \
148         $(PKG_BUILD_DIR)/lisp/loadup.el
149      cd $(PKG_BUILD_DIR)/src && \
150      $(STAGING_DIR_HOST)/bin/qemu-$(ARCH) -E LD_LIBRARY_PATH=$(STAGING_DIR_ROOT)/usr/lib/ \
151        -L $(STAGING_DIR_ROOT) -E LC_ALL=C ./temacs -batch -l loadup
152        endef
153endif
154
155define Build/Prepare
156    $(call Build/Prepare/Default)
157endef
158
159define Host/Configure
160    $(call Host/Configure/Default)
161endef
162
163## On the host, we only compile and install minimum Emacs components used for
164## bootstrapping
165define Host/Compile
166    export LD_LIBRARY_PATH=$(STAGING_DIR_HOST)/lib; \
167    $(call Host/Compile/Default)
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