node13.spec 7.2 KB

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