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.4 |
| 12 | PKG_RELEASE:=1 |
| 13 | PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 |
| 14 | PKG_SOURCE_URL:=ftp://ftp.fu-berlin.de/pub/gnu/emacs/ \ |
| 15 | @GNU/emacs/ |
| 16 | |
| 17 | PKG_MD5SUM:=070c68ad8e3c31fb3cb2414feaf5e6f0 |
| 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 | MAINTAINER=David Kuehling <dvdkhlng TA gmx TOD de> |
| 38 | # SUBMENU:=Editors |
| 39 | endef |
| 40 | |
| 41 | define Package/emacs/Default/description |
| 42 | GNU Emacs is an extensible, customizable text editor — and more. |
| 43 | At its core is an interpreter for Emacs Lisp, a dialect of the |
| 44 | Lisp programming language with extensions to support text editing. |
| 45 | endef |
| 46 | |
| 47 | define Package/emacs |
| 48 | $(call Package/emacs/Default) |
| 49 | DEPENDS:=+libncurses +emacs-data |
| 50 | TITLE+= (executable) |
| 51 | endef |
| 52 | |
| 53 | define Package/emacs/description |
| 54 | $(call Package/emacs/Default/description) |
| 55 | This package contains the Emacs executable files |
| 56 | endef |
| 57 | |
| 58 | define Package/emacs-data |
| 59 | $(call Package/emacs/Default) |
| 60 | TITLE+= (compiled lisp) |
| 61 | endef |
| 62 | |
| 63 | define Package/emacs-data/description |
| 64 | $(call Package/emacs/Default/description) |
| 65 | This package contains the compiled Lisp files needed to run Emacs. |
| 66 | endef |
| 67 | |
| 68 | define Package/emacs-ja-dic |
| 69 | $(call Package/emacs/Default) |
| 70 | TITLE+= (japanese input dictionary) |
| 71 | DEPENDS:=+emacs |
| 72 | endef |
| 73 | |
| 74 | define 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. |
| 80 | endef |
| 81 | |
| 82 | define Package/emacs-el |
| 83 | $(call Package/emacs/Default) |
| 84 | TITLE+= (lisp source) |
| 85 | endef |
| 86 | |
| 87 | define 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. |
| 91 | endef |
| 92 | |
| 93 | DUMP_EMACS=1 |
| 94 | |
| 95 | EMACS_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 | |
| 109 | HOST_CONFIGURE_ARGS += $(EMACS_STRIPTEASE_ARGS) |
| 110 | CONFIGURE_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 |
| 118 | EMACS_MAKEFILE_SED = ; |
| 119 | |
| 120 | # sed-script to apply to src/epaths.h, commands appended below |
| 121 | EMACS_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. |
| 129 | ifeq ($(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 |
| 138 | else |
| 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 |
| 154 | endif |
| 155 | |
| 156 | define Build/Prepare |
| 157 | $(call Build/Prepare/Default) |
| 158 | endef |
| 159 | |
| 160 | define Host/Configure |
| 161 | $(call Host/Configure/Default) |
| 162 | endef |
| 163 | |
| 164 | ## On the host, we only compile and install minimum Emacs components used for |
| 165 | ## bootstrapping |
| 166 | define Host/Compile |
| 167 | $(call Host/Compile/Default LD_LIBRARY_PATH=$(STAGING_DIR_HOST)/lib) |
| 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 |
