node-v8c.spec 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204
  1. ##
  2. ## node-v8c.spec -- OpenPKG RPM Package Specification
  3. ## Copyright (c) 2000-2020 OpenPKG Project <http://openpkg.org/>
  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_base 15.0.0
  25. %define V_snap 20200830
  26. # package information
  27. Name: node-v8c
  28. Summary: Node JavaScript Run-Time (V15, V8-Canary)
  29. URL: http://nodejs.org/
  30. Vendor: Node Foundation
  31. Packager: OpenPKG Project
  32. Distribution: OpenPKG Community
  33. Class: PLUS
  34. Group: Web
  35. License: MIT/BSD
  36. Version: %{V_base}.%{V_snap}
  37. Release: 20200830
  38. # package options
  39. %option with_icu yes
  40. %option with_node no
  41. # list of sources
  42. Source0: http://download.openpkg.org/components/versioned/node-v8c/node-v8c-%{V_snap}.tar.xz
  43. Source1: node.c
  44. Patch0: node-v8c.patch
  45. # build information
  46. BuildPreReq: OpenPKG, openpkg >= 20160101, make, gcc, gcc::with_cxx = yes, python2, pkgconfig
  47. PreReq: OpenPKG, openpkg >= 20160101
  48. BuildPreReq: openssl11, libexecinfo, zlib, ares, libuv, nghttp2
  49. PreReq: openssl11, libexecinfo, zlib, ares, libuv, nghttp2
  50. %if "%{with_icu}" == "yes"
  51. BuildPreReq: icu
  52. PreReq: icu
  53. %endif
  54. %if "%{with_node}" == "yes"
  55. Provides: node = %{version}
  56. %endif
  57. %description
  58. Node.js (V15, V8-Canary) provides an easy way to build scalable
  59. network servers in JavaScript. It is an event-driven I/O environment
  60. based on Google V8 JavaScript virtual machine version 8.6.0. This
  61. is the V8-Canary flavor of Node.js which always closely tracks the
  62. latest version of the V8 JavaScript virtual machine. It exists
  63. for testing purposes only and should not be used in production
  64. environments.
  65. %track
  66. prog node-v8c = {
  67. version = %{V_snap}
  68. url = http://download.openpkg.org/components/versioned/node-v8c/
  69. regex = node-v8c-(__VER__)\.tar\.xz
  70. }
  71. %prep
  72. %setup -q -n node-v8c
  73. %patch -p0
  74. %build
  75. # provide local tool wrapper scripts as we cannot
  76. # reliably pass the includes via configure variables
  77. cflags="-I`pwd`/deps/v8"
  78. cflags="$cflags -I`pwd`/deps/uv/include"
  79. cflags="$cflags -I`pwd`/deps/v8/include"
  80. %if "%{with_icu}" != "yes"
  81. cflags="$cflags -I`pwd`/deps/icu-small/source/common"
  82. %endif
  83. cflags="$cflags -I`pwd`/deps/llhttp/include"
  84. cflags="$cflags -I`pwd`/deps/http_parser"
  85. cflags="$cflags %{l_cppflags openssl11 .}"
  86. ldflags="%{l_ldflags openssl11 .}"
  87. mkdir tool
  88. for tool in gcc g++ c%{l_nil}c c++; do
  89. ( echo "#!/bin/sh"
  90. echo "exec %{l_prefix}/bin/$tool $cflags $ldflags \${1+\"\$@\"}"
  91. ) >tool/$tool
  92. chmod a+x tool/$tool
  93. done
  94. PATH="`pwd`/tool:$PATH"
  95. # configure program
  96. libs="-lexecinfo -lz"
  97. case "%{l_platform -t} " in
  98. *-linux* ) libs="$libs -ldl" ;;
  99. esac
  100. CC="gcc" \
  101. CXX="g++" \
  102. CFLAGS="%{l_cflags -O}" \
  103. CXXFLAGS="%{l_cxxflags -O} -Wno-deprecated-declarations" \
  104. CPPFLAGS="%{l_cppflags openssl11 .}" \
  105. LDFLAGS="%{l_ldflags openssl11 .}" \
  106. LIBS="$libs" \
  107. %{l_prefix}/bin/python2 ./configure \
  108. --prefix=%{l_prefix} \
  109. --shared-openssl \
  110. --shared-openssl-includes=%{l_prefix}/include/openssl11 \
  111. --shared-openssl-libpath=%{l_prefix}/lib/openssl11 \
  112. --shared-openssl-libname="ssl,crypto" \
  113. --shared-zlib \
  114. --shared-zlib-includes=%{l_prefix}/include \
  115. --shared-zlib-libpath=%{l_prefix}/lib \
  116. --shared-zlib-libname="z" \
  117. --shared-cares \
  118. --shared-cares-includes=%{l_prefix}/include \
  119. --shared-cares-libpath=%{l_prefix}/lib \
  120. --shared-cares-libname="ares" \
  121. --shared-libuv \
  122. --shared-libuv-includes=%{l_prefix}/include \
  123. --shared-libuv-libpath=%{l_prefix}/lib \
  124. --shared-libuv-libname="uv" \
  125. --shared-nghttp2 \
  126. --shared-nghttp2-includes=%{l_prefix}/include \
  127. --shared-nghttp2-libpath=%{l_prefix}/lib \
  128. --shared-nghttp2-libname="nghttp2" \
  129. %if "%{with_icu}" == "yes"
  130. --with-intl=system-icu \
  131. %else
  132. --with-intl=small-icu \
  133. %endif
  134. --with-snapshot \
  135. --without-npm \
  136. --download=none
  137. # build program
  138. %{l_make} %{l_mflags -O}
  139. # build wrapper
  140. %{l_cc} %{l_cflags -O} %{l_cppflags} -DPREFIX="\"%{l_prefix}\"" %{l_ldflags} \
  141. -o node-wrapper %{SOURCE node.c}
  142. %install
  143. # install program
  144. ( PATH="`pwd`/tool:$PATH"
  145. %{l_make} %{l_mflags} install DESTDIR=$RPM_BUILD_ROOT
  146. ) || exit $?
  147. # install wrapper
  148. %{l_shtool} mkdir -f -p -m 755 \
  149. $RPM_BUILD_ROOT%{l_prefix}/libexec/node-v8c
  150. mv $RPM_BUILD_ROOT%{l_prefix}/bin/node \
  151. $RPM_BUILD_ROOT%{l_prefix}/libexec/node-v8c/node
  152. %{l_shtool} install -c -s -m 755 \
  153. node-wrapper $RPM_BUILD_ROOT%{l_prefix}/bin/node
  154. # post-installation strip-down
  155. strip $RPM_BUILD_ROOT%{l_prefix}/bin/* >/dev/null 2>&1 || true
  156. rm -rf $RPM_BUILD_ROOT%{l_prefix}/lib/dtrace
  157. rm -rf $RPM_BUILD_ROOT%{l_prefix}/share/systemtap
  158. rm -rf $RPM_BUILD_ROOT%{l_prefix}/share/doc
  159. %if "%{with_node}" == "yes"
  160. # create NPM package installation areas
  161. %{l_shtool} mkdir -f -p -m 755 \
  162. $RPM_BUILD_ROOT%{l_prefix}/lib/node/usr \
  163. $RPM_BUILD_ROOT%{l_prefix}/lib/node/pkg
  164. %endif
  165. # post-adjust installation
  166. mv $RPM_BUILD_ROOT%{l_prefix}/bin/node \
  167. $RPM_BUILD_ROOT%{l_prefix}/bin/node-v8c
  168. mv $RPM_BUILD_ROOT%{l_prefix}/include/node \
  169. $RPM_BUILD_ROOT%{l_prefix}/include/node-v8c
  170. mv $RPM_BUILD_ROOT%{l_prefix}/man/man1/node.1 \
  171. $RPM_BUILD_ROOT%{l_prefix}/man/man1/node-v8c.1
  172. %if "%{with_node}" == "yes"
  173. # shim as Node
  174. ln -s node-v8c $RPM_BUILD_ROOT%{l_prefix}/bin/node
  175. ln -s node-v8c $RPM_BUILD_ROOT%{l_prefix}/include/node
  176. ln -s node-v8c.1 $RPM_BUILD_ROOT%{l_prefix}/man/man1/node.1
  177. %endif
  178. # determine installation files
  179. %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT %{l_files_std}
  180. %files -f files
  181. %clean