node11.spec 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207
  1. ##
  2. ## node11.spec -- OpenPKG RPM Package Specification
  3. ## Copyright (c) 2000-2018 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 11.0.0
  25. %define V_snap_type nightly
  26. %define V_snap_date 20180808
  27. %define V_snap_hash 6ad12d47f5
  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: node11
  32. Summary: Node JavaScript Run-Time (V11)
  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: 20180808
  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: node11.patch
  49. # build information
  50. BuildPreReq: OpenPKG, openpkg >= 20160101, make, gcc >= 5.2, gcc::with_cxx = yes, python, pkgconfig
  51. PreReq: OpenPKG, openpkg >= 20160101
  52. BuildPreReq: openssl11, libexecinfo, zlib, ares, http-parser, libuv, nghttp2
  53. PreReq: openssl11, libexecinfo, zlib, ares, http-parser, 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 (V10) 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 6.8.275.24.
  65. %track
  66. prog node11: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 node11: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 node11: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 -I`pwd`/deps/v8/include %{l_cppflags openssl11 .}"
  88. ldflags="%{l_ldflags openssl11 .}"
  89. mkdir tool
  90. for tool in gcc g++ c%{l_nil}c c++; do
  91. ( echo "#!/bin/sh"
  92. echo "exec %{l_prefix}/bin/$tool $cflags $ldflags \${1+\"\$@\"}"
  93. ) >tool/$tool
  94. chmod a+x tool/$tool
  95. done
  96. PATH="`pwd`/tool:$PATH"
  97. # configure program
  98. libs="-lexecinfo -lz"
  99. case "%{l_platform -t} " in
  100. *-linux* ) libs="$libs -ldl" ;;
  101. esac
  102. CC="gcc" \
  103. CXX="g++" \
  104. CFLAGS="%{l_cflags -O}" \
  105. CXXFLAGS="%{l_cxxflags -O} -Wno-deprecated-declarations" \
  106. CPPFLAGS="%{l_cppflags openssl11 .}" \
  107. LDFLAGS="%{l_ldflags openssl11 .}" \
  108. LIBS="$libs" \
  109. %{l_prefix}/bin/python ./configure \
  110. --prefix=%{l_prefix} \
  111. --shared-openssl \
  112. --shared-openssl-includes=%{l_prefix}/include/openssl11 \
  113. --shared-openssl-libpath=%{l_prefix}/lib/openssl11 \
  114. --shared-openssl-libname="ssl,crypto" \
  115. --shared-zlib \
  116. --shared-zlib-includes=%{l_prefix}/include \
  117. --shared-zlib-libpath=%{l_prefix}/lib \
  118. --shared-zlib-libname="z" \
  119. --shared-http-parser \
  120. --shared-http-parser-includes=%{l_prefix}/include \
  121. --shared-http-parser-libpath=%{l_prefix}/lib \
  122. --shared-http-parser-libname="http_parser" \
  123. --shared-cares \
  124. --shared-cares-includes=%{l_prefix}/include \
  125. --shared-cares-libpath=%{l_prefix}/lib \
  126. --shared-cares-libname="ares" \
  127. --shared-libuv \
  128. --shared-libuv-includes=%{l_prefix}/include \
  129. --shared-libuv-libpath=%{l_prefix}/lib \
  130. --shared-libuv-libname="uv" \
  131. --shared-nghttp2 \
  132. --shared-nghttp2-includes=%{l_prefix}/include \
  133. --shared-nghttp2-libpath=%{l_prefix}/lib \
  134. --shared-nghttp2-libname="nghttp2" \
  135. %if "%{with_icu}" == "yes"
  136. --with-intl=system-icu \
  137. %else
  138. --with-intl=small-icu \
  139. %endif
  140. --without-snapshot \
  141. --without-npm
  142. # build program
  143. %{l_make} %{l_mflags -O}
  144. # build wrapper
  145. %{l_cc} %{l_cflags -O} %{l_cppflags} -DPREFIX="\"%{l_prefix}\"" %{l_ldflags} \
  146. -o node-wrapper %{SOURCE node.c}
  147. %install
  148. # install program
  149. %{l_make} %{l_mflags} install DESTDIR=$RPM_BUILD_ROOT
  150. # install wrapper
  151. %{l_shtool} mkdir -f -p -m 755 \
  152. $RPM_BUILD_ROOT%{l_prefix}/libexec/node11
  153. mv $RPM_BUILD_ROOT%{l_prefix}/bin/node \
  154. $RPM_BUILD_ROOT%{l_prefix}/libexec/node11/node
  155. %{l_shtool} install -c -s -m 755 \
  156. node-wrapper $RPM_BUILD_ROOT%{l_prefix}/bin/node
  157. # post-installation strip-down
  158. strip $RPM_BUILD_ROOT%{l_prefix}/bin/* >/dev/null 2>&1 || true
  159. rm -rf $RPM_BUILD_ROOT%{l_prefix}/lib/dtrace
  160. rm -rf $RPM_BUILD_ROOT%{l_prefix}/share/systemtap
  161. rm -rf $RPM_BUILD_ROOT%{l_prefix}/share/doc
  162. %if "%{with_node}" == "yes"
  163. # create NPM package installation areas
  164. %{l_shtool} mkdir -f -p -m 755 \
  165. $RPM_BUILD_ROOT%{l_prefix}/lib/node/usr \
  166. $RPM_BUILD_ROOT%{l_prefix}/lib/node/pkg
  167. %endif
  168. # post-adjust installation
  169. mv $RPM_BUILD_ROOT%{l_prefix}/bin/node \
  170. $RPM_BUILD_ROOT%{l_prefix}/bin/node11
  171. mv $RPM_BUILD_ROOT%{l_prefix}/include/node \
  172. $RPM_BUILD_ROOT%{l_prefix}/include/node11
  173. mv $RPM_BUILD_ROOT%{l_prefix}/man/man1/node.1 \
  174. $RPM_BUILD_ROOT%{l_prefix}/man/man1/node11.1
  175. %if "%{with_node}" == "yes"
  176. # shim as Node
  177. ln -s node11 $RPM_BUILD_ROOT%{l_prefix}/bin/node
  178. ln -s node11 $RPM_BUILD_ROOT%{l_prefix}/include/node
  179. ln -s node11.1 $RPM_BUILD_ROOT%{l_prefix}/man/man1/node.1
  180. %endif
  181. # determine installation files
  182. %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT %{l_files_std}
  183. %files -f files
  184. %clean