openssl.spec 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198
  1. ##
  2. ## openssl.spec -- OpenPKG RPM Package Specification
  3. ## Copyright (c) 2000-2012 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_openssl 1.0.0g
  25. %define V_zlib 1.2.6
  26. # package information
  27. Name: openssl
  28. Summary: Cryptography and SSL/TLS Toolkit
  29. URL: http://www.openssl.org/
  30. Vendor: The OpenSSL Project
  31. Packager: OpenPKG Foundation e.V.
  32. Distribution: OpenPKG Community
  33. Class: CORE
  34. Group: SSL
  35. License: BSD-style
  36. Version: %{V_openssl}
  37. Release: 20120130
  38. # package options
  39. %option with_zlib no
  40. %option with_idea no
  41. %option with_threads no
  42. %option with_pic no
  43. %option with_npn no
  44. # list of sources
  45. Source0: ftp://ftp.openssl.org/source/openssl-%{V_openssl}.tar.gz
  46. Source1: http://www.zlib.net/zlib-%{V_zlib}.tar.gz
  47. Patch0: openssl.patch
  48. Patch1: openssl.patch.npn
  49. # build information
  50. BuildPreReq: OpenPKG, openpkg >= 20100101, perl, make, gcc
  51. PreReq: OpenPKG, openpkg >= 20100101, perl
  52. %if "%{with_zlib}" == "yes"
  53. BuildPreReq: zlib
  54. PreReq: zlib
  55. %endif
  56. %description
  57. The OpenSSL Project is a collaborative effort to develop a robust,
  58. commercial-grade, full-featured, and Open Source toolkit implementing the
  59. Secure Sockets Layer (SSL v2/v3) and Transport Layer Security (TLS v1)
  60. protocols with full-strength cryptography world-wide. The project is
  61. managed by a worldwide community of volunteers that use the Internet to
  62. communicate, plan, and develop the OpenSSL tookit and its related
  63. documentation.
  64. %track
  65. prog openssl:openssl = {
  66. version = %{V_openssl}
  67. url = ftp://ftp.openssl.org/source/
  68. regex = openssl-(\d+\.\d+\.\d+[a-z]?)\.tar\.gz
  69. }
  70. prog openssl:zlib = {
  71. version = %{V_zlib}
  72. url = http://www.zlib.net/
  73. regex = zlib-(__VER__)\.tar\.gz
  74. }
  75. %prep
  76. %setup -q
  77. %if "%{with_zlib}" == "yes"
  78. %setup -q -D -T -a 1
  79. %endif
  80. %patch -p0
  81. %if "%{with_npn}" == "yes"
  82. %patch -p0 -P 1
  83. %endif
  84. %build
  85. %{l_shtool} subst \
  86. -e 's;-march=pentium;;g' \
  87. -e 's;-m486;-march=i486;g' \
  88. Configure
  89. %{l_shtool} subst \
  90. -e 's;BN_LLONG *;;' \
  91. Configure
  92. %{l_shtool} subst \
  93. -e 's;test "$OSTYPE" = msdosdjgpp;true;' \
  94. util/point.sh
  95. %{l_shtool} subst \
  96. -e 's;^\(#define DEVRANDOM_EGD\);\1 "%{l_prefix}/var/prngd/prngd.socket",;' \
  97. e_os.h
  98. %{l_shtool} subst \
  99. -e 's;^\(my $openssl\)\;;\1 = "%{l_prefix}/bin/openssl"\;;' \
  100. tools/c_rehash.in
  101. %if "%{with_zlib}" == "yes"
  102. %{l_shtool} subst \
  103. -e "s;\\(-DZLIB_SHARED\\);-I`pwd`/zlib-%{V_zlib} \\1;" \
  104. Configure
  105. %{l_shtool} subst \
  106. -e 's;, "z",;, "%{l_prefix}/lib/openssl/zlib.so",;' \
  107. crypto/comp/c_zlib.c
  108. %endif
  109. %if "%{with_zlib}" == "yes"
  110. ( cd zlib-%{V_zlib}
  111. CC="%{l_cc}" \
  112. CFLAGS="%{l_cflags -O}" \
  113. ./configure \
  114. --prefix=%{l_prefix} \
  115. --shared
  116. %{l_make} %{l_mflags -O}
  117. ) || exit $?
  118. %endif
  119. %{l_prefix}/bin/perl util/perlpath.pl %{l_prefix}/bin/perl
  120. options="no-shared no-dso"
  121. %if "%{with_pic}" == "yes"
  122. options="$options -fPIC"
  123. case "%{l_platform -t}" in
  124. amd64-* ) options="$options no-asm" ;;
  125. sparc64-freebsd* ) options="$options no-asm" ;;
  126. esac
  127. %else
  128. case "%{l_platform -t}" in
  129. amd64-* ) options="$options -fPIC no-asm" ;;
  130. ia64-* ) options="$options -fPIC" ;;
  131. sparc64-freebsd* ) options="$options -fPIC no-asm" ;;
  132. esac
  133. %endif
  134. %if "%{with_zlib}" == "yes"
  135. options="$options zlib-dynamic"
  136. %else
  137. options="$options no-zlib"
  138. %endif
  139. %if "%{with_idea}" != "yes"
  140. options="$options no-idea"
  141. %endif
  142. %if "%{with_threads}" == "yes"
  143. options="$options threads"
  144. %else
  145. options="$options no-threads"
  146. %endif
  147. PERL=%{l_prefix}/bin/perl \
  148. ./config \
  149. --prefix=%{l_prefix} \
  150. --openssldir=%{l_prefix}/etc/openssl \
  151. --libdir=lib \
  152. $options
  153. %{l_make} %{l_mflags}
  154. %install
  155. %{l_make} %{l_mflags} install INSTALL_PREFIX=$RPM_BUILD_ROOT
  156. strip $RPM_BUILD_ROOT%{l_prefix}/bin/openssl >/dev/null 2>&1 || true
  157. ( cd $RPM_BUILD_ROOT%{l_prefix}
  158. rmdir lib/engines
  159. rm -rf etc/openssl/private
  160. rm -rf etc/openssl/certs
  161. rm -rf etc/openssl/misc
  162. rm -rf etc/openssl/lib
  163. mv etc/openssl/man man
  164. mv bin/c_rehash bin/openssl-crehash
  165. cd man
  166. for dir in man[1-9]; do
  167. for file in `cd $dir; echo *`; do
  168. mv $dir/$file $dir/openssl_$file
  169. done
  170. done
  171. ) || exit $?
  172. %if "%{with_zlib}" == "yes"
  173. %{l_shtool} mkdir -f -p -m 755 \
  174. $RPM_BUILD_ROOT%{l_prefix}/libexec/openssl
  175. %{l_shtool} install -c -m 644 \
  176. zlib-%{V_zlib}/libz.so \
  177. $RPM_BUILD_ROOT%{l_prefix}/libexec/openssl/zlib.so
  178. %endif
  179. %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
  180. %{l_files_std} \
  181. '%config %{l_prefix}/etc/openssl/openssl.cnf'
  182. %files -f files
  183. %clean