js.spec 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298
  1. ##
  2. ## js.spec -- OpenPKG RPM Package Specification
  3. ## Copyright (c) 2000-2008 OpenPKG Foundation e.V. <http://openpkg.net/>
  4. ##
  5. ## Permission to use, copy, modify, and distribute this software for
  6. ## any purpose with or without fee is hereby granted, provided that
  7. ## the above copyright notice and this permission notice appear in all
  8. ## copies.
  9. ##
  10. ## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
  11. ## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  12. ## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
  13. ## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
  14. ## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  15. ## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  16. ## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
  17. ## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  18. ## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  19. ## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  20. ## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  21. ## SUCH DAMAGE.
  22. ##
  23. # package version
  24. %define V_js 1.6.20070208
  25. %define V_javascript 1.11
  26. %define V_javascript_spidermonkey 0.19
  27. %define V_javascript_squish 0.07
  28. %define V_javascript_code 0.08
  29. %define V_javascript_jslint 0.06
  30. %define V_javascript_engine 0.027
  31. %define V_jsmin 20080803
  32. %define V_jsapigen 0.2.0
  33. # package information
  34. Name: js
  35. Summary: Mozilla JavaScript (JS)
  36. URL: http://www.mozilla.org/js/
  37. Vendor: Brendan Eich et al.
  38. Packager: OpenPKG Foundation e.V.
  39. Distribution: OpenPKG Community
  40. Class: PLUS
  41. Group: Language
  42. License: MPL/GPL/LGPL
  43. Version: %{V_js}
  44. Release: 20080925
  45. # package options
  46. %option with_file yes
  47. %option with_dso yes
  48. %option with_jsapigen no
  49. %option with_perl no
  50. %option with_editline no
  51. %option with_utf8 no
  52. # list of sources
  53. Source0: ftp://ftp.ossp.org/pkg/lib/js/js-%{V_js}.tar.gz
  54. Source1: http://www.cpan.org/modules/by-authors/id/C/CL/CLAESJAC/JavaScript-%{V_javascript}.tar.gz
  55. Source2: http://www.cpan.org/modules/by-module/JavaScript/JavaScript-SpiderMonkey-%{V_javascript_spidermonkey}.tar.gz
  56. Source3: http://www.cpan.org/modules/by-module/JavaScript/JavaScript-Squish-%{V_javascript_squish}.tar.gz
  57. Source4: http://www.cpan.org/modules/by-module/JavaScript/JavaScript-Code-%{V_javascript_code}.tar.gz
  58. Source5: http://www.cpan.org/modules/by-module/JavaScript/JavaScript-JSLint-%{V_javascript_jslint}.tar.gz
  59. Source6: http://www.cpan.org/modules/by-module/JavaScript/JE-%{V_javascript_engine}.tar.gz
  60. Source7: http://switch.dl.sourceforge.net/jsapigen/jsapigen-%{V_jsapigen}.tar.gz
  61. Source8: ftp://ftp.openpkg.org/sources/CPY/VERSIONED/jsmin/jsmin-%{V_jsmin}.c
  62. Patch0: js.patch
  63. # build information
  64. Prefix: %{l_prefix}
  65. BuildRoot: %{l_buildroot}
  66. BuildPreReq: OpenPKG, openpkg >= 20040130, gcc, make
  67. PreReq: OpenPKG, openpkg >= 20040130
  68. %if "%{with_perl}" == "yes"
  69. BuildPreReq: perl, perl-openpkg
  70. PreReq: perl
  71. %endif
  72. %if "%{with_editline}" == "yes"
  73. BuildPreReq: editline
  74. PreReq: editline
  75. %endif
  76. %if "%{with_jsapigen}" == "yes"
  77. BuildPreReq: flex, bison
  78. %endif
  79. AutoReq: no
  80. AutoReqProv: no
  81. %description
  82. This is the JavaScript (JS) reference implementation in C
  83. from Mozilla, aka JSRef or SpiderMonkey. JavaScript is the
  84. Netscape-developed object scripting language used in millions of web
  85. pages and server applications worldwide. Netscape's JavaScript is a
  86. superset of the ECMA-262 Edition 3 (ECMAScript) standard scripting
  87. language. This package is based on the OSSP js distribution of
  88. Mozilla JavaScript and also optionally provides Perl bindings.
  89. %track
  90. prog js = {
  91. version = %{V_js}
  92. url = ftp://ftp.ossp.org/pkg/lib/js/
  93. regex = js-(__VER__)\.tar\.gz
  94. }
  95. prog js:JavaScript = {
  96. version = %{V_javascript}
  97. url = http://www.cpan.org/modules/by-authors/id/C/CL/CLAESJAC/
  98. regex = JavaScript-(__VER__)\.tar\.gz
  99. }
  100. prog js:JavaScript-SpiderMonkey = {
  101. version = %{V_javascript_spidermonkey}
  102. url = http://www.cpan.org/modules/by-module/JavaScript/
  103. regex = JavaScript-SpiderMonkey-(__VER__)\.tar\.gz
  104. }
  105. prog js:JavaScript-Squish = {
  106. version = %{V_javascript_squish}
  107. url = http://www.cpan.org/modules/by-module/JavaScript/
  108. regex = JavaScript-Squish-(__VER__)\.tar\.gz
  109. }
  110. prog js:JavaScript-Code = {
  111. version = %{V_javascript_code}
  112. url = http://www.cpan.org/modules/by-module/JavaScript/
  113. regex = JavaScript-Code-(__VER__)\.tar\.gz
  114. }
  115. prog js:JavaScript-JSLint = {
  116. version = %{V_javascript_jslint}
  117. url = http://www.cpan.org/modules/by-module/JavaScript/
  118. regex = JavaScript-JSLint-(__VER__)\.tar\.gz
  119. }
  120. prog js:JavaScript-Engine = {
  121. version = %{V_javascript_engine}
  122. url = http://www.cpan.org/modules/by-module/JavaScript/
  123. regex = JE-(__VER__)\.tar\.gz
  124. }
  125. prog js:jsapigen = {
  126. version = %{V_jsapigen}
  127. url = http://prdownloads.sourceforge.net/jsapigen/
  128. regex = jsapigen-(__VER__)\.tar\.gz
  129. }
  130. prog js:jsmin = {
  131. version = %{V_jsmin}
  132. url = ftp://ftp.openpkg.org/sources/CPY/VERSIONED/jsmin/
  133. regex = jsmin-(__VER__)\.c
  134. }
  135. %prep
  136. %setup -q -c
  137. %setup -q -D -T -a 1
  138. %setup -q -D -T -a 2
  139. %setup -q -D -T -a 3
  140. %setup -q -D -T -a 4
  141. %setup -q -D -T -a 5
  142. %setup -q -D -T -a 6
  143. %setup -q -D -T -a 7
  144. %patch -p0
  145. %build
  146. # build components
  147. %if "%{with_perl}" == "yes"
  148. %{l_prefix}/bin/perl-openpkg prepare
  149. %endif
  150. ( cd js-%{V_js}
  151. CC="%{l_cc}" \
  152. CFLAGS="%{l_cflags -O}" \
  153. GREP="grep" \
  154. ./configure \
  155. --prefix=%{l_prefix} \
  156. --mandir=%{l_prefix}/man \
  157. %if "%{with_perl}" == "yes"
  158. --with-perl=%{l_prefix}/bin/perl \
  159. %endif
  160. %if "%{with_editline}" == "yes"
  161. --with-editline=%{l_prefix} \
  162. %endif
  163. %if "%{with_file}" != "yes"
  164. --without-file \
  165. %endif
  166. %if "%{with_dso}" == "yes"
  167. --with-dso \
  168. %endif
  169. %if "%{with_utf8}" == "yes"
  170. --with-utf8 \
  171. %endif
  172. --disable-shared
  173. %{l_make} %{l_mflags}
  174. ) || exit $?
  175. # build add-on tool "jsmin"
  176. %{l_cc} -o jsmin %{SOURCE jsmin-%{V_jsmin}.c}
  177. # build add-on tool "jsapigen"
  178. %if "%{with_jsapigen}" == "yes"
  179. ( cd jsapigen-%{V_jsapigen}
  180. CC="%{l_cc}" \
  181. CFLAGS="%{l_cflags -O}" \
  182. GREP="grep" \
  183. ./configure \
  184. --prefix=%{l_prefix} \
  185. --mandir=%{l_prefix}/man
  186. %{l_make} %{l_mflags}
  187. ) || exit $?
  188. %endif
  189. %if "%{with_perl}" == "yes"
  190. # build add-on Perl bindings
  191. ( cd JavaScript-%{V_javascript}
  192. export JS_LIB="../js-%{V_js}/.libs"
  193. export JS_INC="../js-%{V_js}/src"
  194. %if "%{with_utf8}" == "yes"
  195. export JS_UTF8="1"
  196. %endif
  197. %{l_prefix}/bin/perl-openpkg configure build
  198. ) || exit $?
  199. ( cd JavaScript-SpiderMonkey-%{V_javascript_spidermonkey}
  200. %{l_shtool} subst \
  201. -e 's;\.\./js/src;../js-%{V_js}/src;' \
  202. -e 's;\.\./js/.libs;../js-%{V_js}/.libs;' \
  203. Makefile.PL
  204. %{l_prefix}/bin/perl-openpkg configure build
  205. ) || exit $?
  206. ( cd JavaScript-Squish-%{V_javascript_squish}
  207. %{l_prefix}/bin/perl-openpkg configure build
  208. ) || exit $?
  209. ( cd JavaScript-Code-%{V_javascript_code}
  210. %{l_prefix}/bin/perl-openpkg configure build
  211. ) || exit $?
  212. ( cd JavaScript-JSLint-%{V_javascript_jslint}
  213. %{l_prefix}/bin/perl-openpkg configure build
  214. ) || exit $?
  215. ( cd JE-%{V_javascript_engine}
  216. %{l_prefix}/bin/perl-openpkg configure build
  217. ) || exit $?
  218. %endif
  219. %install
  220. # create installation hierarchy
  221. rm -rf $RPM_BUILD_ROOT
  222. %{l_shtool} mkdir -f -p -m 755 \
  223. $RPM_BUILD_ROOT%{l_prefix}/bin \
  224. $RPM_BUILD_ROOT%{l_prefix}/include/js \
  225. $RPM_BUILD_ROOT%{l_prefix}/lib \
  226. $RPM_BUILD_ROOT%{l_prefix}/lib/pkgconfig
  227. # install vendor components
  228. ( cd js-%{V_js}
  229. %{l_make} %{l_mflags} install DESTDIR=$RPM_BUILD_ROOT
  230. strip $RPM_BUILD_ROOT%{l_prefix}/bin/* >/dev/null 2>&1 || true
  231. ) || exit $?
  232. # install add-on tool "jsmin"
  233. %{l_shtool} install -c -s -m 755 \
  234. jsmin $RPM_BUILD_ROOT%{l_prefix}/bin/
  235. # install add-on tool "jsapigen"
  236. %if "%{with_jsapigen}" == "yes"
  237. %{l_shtool} install -c -s -m 755 \
  238. jsapigen-%{V_jsapigen}/src/jsapigen \
  239. $RPM_BUILD_ROOT%{l_prefix}/bin/
  240. %endif
  241. %if "%{with_perl}" == "yes"
  242. # install add-on Perl bindings
  243. ( cd JavaScript-%{V_javascript}
  244. %{l_prefix}/bin/perl-openpkg install
  245. ) || exit $?
  246. ( cd JavaScript-SpiderMonkey-%{V_javascript_spidermonkey}
  247. %{l_prefix}/bin/perl-openpkg install
  248. ) || exit $?
  249. ( cd JavaScript-Squish-%{V_javascript_squish}
  250. %{l_prefix}/bin/perl-openpkg install
  251. ) || exit $?
  252. ( cd JavaScript-Code-%{V_javascript_code}
  253. %{l_prefix}/bin/perl-openpkg install
  254. ) || exit $?
  255. ( cd JavaScript-JSLint-%{V_javascript_jslint}
  256. mv $RPM_BUILD_ROOT%{l_prefix}/bin/jslint $RPM_BUILD_ROOT%{l_prefix}/bin/jslint-orig
  257. %{l_prefix}/bin/perl-openpkg install
  258. mv $RPM_BUILD_ROOT%{l_prefix}/bin/jslint $RPM_BUILD_ROOT%{l_prefix}/bin/jslint-perl
  259. mv $RPM_BUILD_ROOT%{l_prefix}/bin/jslint-orig $RPM_BUILD_ROOT%{l_prefix}/bin/jslint
  260. ) || exit $?
  261. ( cd JE-%{V_javascript_engine}
  262. %{l_prefix}/bin/perl-openpkg install
  263. ) || exit $?
  264. %endif
  265. %if "%{with_perl}" == "yes"
  266. %{l_prefix}/bin/perl-openpkg -F perl-openpkg-files fixate cleanup
  267. %else
  268. >perl-openpkg-files
  269. %endif
  270. # determine installation files
  271. %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
  272. %{l_files_std} `cat perl-openpkg-files`
  273. %files -f files
  274. %clean
  275. rm -rf $RPM_BUILD_ROOT