OpenWrt packages
Sign in or create your account | Project List | Help
OpenWrt packages Git Source Tree
Root/
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 | |
8 | include $(TOPDIR)/rules.mk |
9 | |
10 | PKG_NAME:=emacs |
11 | PKG_VERSION:=23.2 |
12 | PKG_RELEASE:=5 |
13 | PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz |
14 | PKG_SOURCE_URL:=ftp://ftp.fu-berlin.de/pub/gnu/emacs/ \ |
15 | @GNU/emacs/ |
16 | |
17 | PKG_MD5SUM:=b6691852dae0bc142b3c12749f6b7ade |
18 | PKG_INSTALL:=1 |
19 | |
20 | PKG_BUILD_PARALLEL:=1 |
21 | HOST_BUILD_PARALLEL:=1 |
22 | |
23 | PKG_FIXUP:=libtool |
24 | PKG_REMOVE_FILES:= |
25 | |
26 | PKG_BUILD_DEPENDS:= emacs/host |
27 | |
28 | include $(INCLUDE_DIR)/host-build.mk |
29 | include $(INCLUDE_DIR)/package.mk |
30 | |
31 | define 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 |
38 | endef |
39 | |
40 | define Package/emacs/Default/description |
41 | GNU Emacs is an extensible, customizable text editor — and more. |
42 | At its core is an interpreter for Emacs Lisp, a dialect of the |
43 | Lisp programming language with extensions to support text editing. |
44 | endef |
45 | |
46 | define Package/emacs |
47 | $(call Package/emacs/Default) |
48 | DEPENDS:=+libncurses +emacs-data |
49 | TITLE+= (executable) |
50 | endef |
51 | |
52 | define Package/emacs/description |
53 | $(call Package/emacs/Default/description) |
54 | This package contains the Emacs executable files |
55 | endef |
56 | |
57 | define Package/emacs-data |
58 | $(call Package/emacs/Default) |
59 | TITLE+= (compiled lisp) |
60 | endef |
61 | |
62 | define Package/emacs-data/description |
63 | $(call Package/emacs/Default/description) |
64 | This package contains the compiled Lisp files needed to run Emacs. |
65 | endef |
66 | |
67 | define Package/emacs-ja-dic |
68 | $(call Package/emacs/Default) |
69 | TITLE+= (japanese input dictionary) |
70 | DEPENDS:=+emacs |
71 | endef |
72 | |
73 | define 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. |
79 | endef |
80 | |
81 | define Package/emacs-el |
82 | $(call Package/emacs/Default) |
83 | TITLE+= (lisp source) |
84 | endef |
85 | |
86 | define 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. |
90 | endef |
91 | |
92 | DUMP_EMACS=1 |
93 | |
94 | EMACS_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 | |
108 | HOST_CONFIGURE_ARGS += $(EMACS_STRIPTEASE_ARGS) |
109 | CONFIGURE_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 |
117 | EMACS_MAKEFILE_SED = ; |
118 | |
119 | # sed-script to apply to src/epaths.h, commands appended below |
120 | EMACS_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. |
128 | ifeq ($(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 |
137 | else |
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 |
153 | endif |
154 | |
155 | define Build/Prepare |
156 | $(call Build/Prepare/Default) |
157 | endef |
158 | |
159 | define Host/Configure |
160 | $(call Host/Configure/Default) |
161 | endef |
162 | |
163 | ## On the host, we only compile and install minimum Emacs components used for |
164 | ## bootstrapping |
165 | define Host/Compile |
166 | export LD_LIBRARY_PATH=$(STAGING_DIR_HOST)/lib; \ |
167 | $(call Host/Compile/Default) |
168 | endef |
169 | |
170 | define 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 |
174 | endef |
175 | |
176 | define Build/Configure |
177 | $(call Build/Configure/Default) |
178 | endef |
179 | |
180 | define 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) |
190 | endef |
191 | |
192 | define 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 |
197 | endef |
198 | |
199 | define Package/emacs/install |
200 | $(INSTALL_DIR) $(1)/usr |
201 | cp -r $(PKG_INSTALL_DIR)/usr/{bin,lib} $(1)/usr |
202 | endef |
203 | |
204 | define 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 -) |
215 | endef |
216 | |
217 | define 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 -) |
222 | endef |
223 | |
224 | define 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 -) |
229 | endef |
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 |