samba.spec 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  1. ##
  2. ## samba.spec -- OpenPKG RPM Specification
  3. ## Copyright (c) 2000-2003 Cable & Wireless Deutschland GmbH
  4. ## Copyright (c) 2000-2003 The OpenPKG Project <http://www.openpkg.org/>
  5. ## Copyright (c) 2000-2003 Ralf S. Engelschall <rse@engelschall.com>
  6. ##
  7. ## Permission to use, copy, modify, and distribute this software for
  8. ## any purpose with or without fee is hereby granted, provided that
  9. ## the above copyright notice and this permission notice appear in all
  10. ## copies.
  11. ##
  12. ## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
  13. ## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  14. ## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
  15. ## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
  16. ## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  17. ## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  18. ## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
  19. ## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  20. ## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  21. ## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  22. ## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  23. ## SUCH DAMAGE.
  24. ##
  25. # package information
  26. Name: samba
  27. Summary: SMB/CIFS Server
  28. URL: http://www.samba.org/
  29. Vendor: Andrew Tridgell
  30. Packager: The OpenPKG Project
  31. Distribution: OpenPKG [BASE]
  32. Group: Filesystem
  33. License: GPL
  34. Version: 2.2.7a
  35. Release: 20030103
  36. # package options
  37. %option with_pam no
  38. # list of sources
  39. Source0: http://download.samba.org/samba/ftp/samba-%{version}.tar.bz2
  40. Source1: smb.conf
  41. Source2: smb.hosts
  42. Source3: rc.samba
  43. # build information
  44. Prefix: %{l_prefix}
  45. BuildRoot: %{l_buildroot}
  46. BuildPreReq: OpenPKG, openpkg >= 20030103, openssl
  47. PreReq: OpenPKG, openpkg >= 20030103
  48. %if "%{with_pam}" == "yes"
  49. BuildPreReq: PAM
  50. PreReq: PAM
  51. %endif
  52. AutoReq: no
  53. AutoReqProv: no
  54. %description
  55. Samba is an open source software suite that provides seamless file
  56. and print services to SMB/CIFS clients.
  57. %prep
  58. %setup -q
  59. %build
  60. ( cd source
  61. CC="%{l_cc}"
  62. CFLAGS="%{l_cflags -O}"
  63. CPPFLAGS="-I%{l_prefix}/include -I%{l_prefix}/include/openssl"
  64. LDFLAGS="-L%{l_prefix}/lib"
  65. %if "%{with_pam}" == "yes"
  66. CPPFLAGS="$CPPFLAGS -I`%{l_prefix}/etc/rc --query pam_incdir`" \
  67. LDFLAGS="$LDFLAGS -L`%{l_prefix}/etc/rc --query pam_libdir`" \
  68. %endif
  69. export CC
  70. export CFLAGS
  71. export LDFLAGS
  72. ./configure \
  73. --prefix=%{l_prefix} \
  74. --localstatedir=%{l_prefix}/var/samba/run \
  75. --sysconfdir=%{l_prefix}/etc/samba \
  76. --with-privatedir=%{l_prefix}/var/samba/run \
  77. --with-sambaconfdir=%{l_prefix}/etc/samba \
  78. --with-lockdir=%{l_prefix}/var/samba/run \
  79. --with-swatdir=%{l_prefix}/share/samba \
  80. --with-codepagedir=%{l_prefix}/share/samba \
  81. --with-ssl --with-sslinc=%{l_prefix}/include \
  82. --with-included-popt \
  83. %if "%{with_pam}" == "yes"
  84. --with-pam \
  85. %endif
  86. --with-vfs
  87. %{l_make} %{l_mflags -O} \
  88. CONFIGFILE=%{l_prefix}/etc/samba/smb.conf \
  89. LMHOSTSFILE=%{l_prefix}/etc/samba/smb.hosts
  90. )
  91. %install
  92. rm -rf $RPM_BUILD_ROOT
  93. %{l_shtool} mkdir -f -p -m 755 \
  94. $RPM_BUILD_ROOT%{l_prefix} \
  95. $RPM_BUILD_ROOT%{l_prefix}/etc/samba \
  96. $RPM_BUILD_ROOT%{l_prefix}/var/samba \
  97. $RPM_BUILD_ROOT%{l_prefix}/share/samba \
  98. $RPM_BUILD_ROOT%{l_prefix}/libexec/samba \
  99. $RPM_BUILD_ROOT%{l_prefix}/var/samba/run \
  100. $RPM_BUILD_ROOT%{l_prefix}/var/samba/spool \
  101. $RPM_BUILD_ROOT%{l_prefix}/var/samba/netlogon \
  102. $RPM_BUILD_ROOT%{l_prefix}/var/samba/profiles
  103. ( cd source
  104. %{l_make} %{l_mflags} install \
  105. prefix=$RPM_BUILD_ROOT%{l_prefix} \
  106. BASEDIR=$RPM_BUILD_ROOT%{l_prefix} \
  107. CONFIGDIR=$RPM_BUILD_ROOT%{l_prefix}/etc/samba \
  108. VARDIR=$RPM_BUILD_ROOT%{l_prefix}/var/samba/run \
  109. SWATDIR=$RPM_BUILD_ROOT%{l_prefix}/share/samba \
  110. CODEPAGEDIR=$RPM_BUILD_ROOT%{l_prefix}/share/samba \
  111. CONFIGFILE=%{l_prefix}/etc/samba/smb.conf \
  112. LMHOSTSFILE=%{l_prefix}/etc/samba/smb.hosts
  113. )
  114. l_hostname=`%{l_shtool} echo -e %h%d`
  115. %{l_shtool} install -c -m 644 \
  116. -e 's;@l_prefix@;%{l_prefix};g' \
  117. -e "s;@l_hostname@;$l_hostname;g" \
  118. %{SOURCE smb.conf} \
  119. %{SOURCE smb.hosts} \
  120. $RPM_BUILD_ROOT%{l_prefix}/etc/samba/
  121. for file in make_printerdef make_smbcodepage make_unicodemap \
  122. testparm testprns; do
  123. mv $RPM_BUILD_ROOT%{l_prefix}/bin/$file \
  124. $RPM_BUILD_ROOT%{l_prefix}/libexec/samba/$file
  125. done
  126. rm -rf $RPM_BUILD_ROOT%{l_prefix}/share/samba/using_samba
  127. rm -rf $RPM_BUILD_ROOT%{l_prefix}/share/samba/help
  128. rm -rf $RPM_BUILD_ROOT%{l_prefix}/share/samba/images
  129. rm -rf $RPM_BUILD_ROOT%{l_prefix}/share/samba/include
  130. strip $RPM_BUILD_ROOT%{l_prefix}/bin/* >/dev/null 2>&1 || true
  131. strip $RPM_BUILD_ROOT%{l_prefix}/sbin/* >/dev/null 2>&1 || true
  132. %{l_shtool} mkdir -f -p -m 755 $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d
  133. %{l_shtool} install -c -m 755 -e 's;@l_prefix@;%{l_prefix};g' \
  134. %{SOURCE rc.samba} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
  135. %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
  136. %{l_files_std} \
  137. '%config %{l_prefix}/etc/samba/*' \
  138. '%attr(1777,%{l_musr},%{l_mgrp}) %{l_prefix}/var/samba/spool' \
  139. '%attr(1777,%{l_musr},%{l_mgrp}) %{l_prefix}/var/samba/profiles'
  140. %files -f files
  141. %clean
  142. rm -rf $RPM_BUILD_ROOT
  143. %post
  144. %if "%{with_pam}" == "yes"
  145. # add PAM configuration entry
  146. if [ $1 -eq 1 ]; then
  147. $RPM_INSTALL_PREFIX/sbin/pamtool --add --smart --name=smbd
  148. fi
  149. %endif
  150. %preun
  151. %if "%{with_pam}" == "yes"
  152. # remove PAM configuration entry
  153. if [ $1 -eq 0 ]; then
  154. $RPM_INSTALL_PREFIX/sbin/pamtool --remove --smart --name=smbd
  155. fi
  156. %endif