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

Archive Download this file



interactive