recipe 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. # Build recipe for mercurial.
  2. #
  3. # Copyright (C) 2022 Matias Fonzo, <selk@dragora.org>.
  4. #
  5. # Licensed under the Apache License, Version 2.0 (the "License");
  6. # you may not use this file except in compliance with the License.
  7. # You may obtain a copy of the License at
  8. #
  9. # http://www.apache.org/licenses/LICENSE-2.0
  10. #
  11. # Unless required by applicable law or agreed to in writing, software
  12. # distributed under the License is distributed on an "AS IS" BASIS,
  13. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14. # See the License for the specific language governing permissions and
  15. # limitations under the License.
  16. # Exit immediately on any error
  17. set -e
  18. program=mercurial
  19. version=6.2.2
  20. release=1
  21. # Define a category for the output of the package name
  22. pkgcategory=devel
  23. tarname=${program}-${version}.tar.gz
  24. # Remote source(s)
  25. fetch=https://www.mercurial-scm.org/release/$tarname
  26. description="
  27. A fast scalable distributed SCM system.
  28. Mercurial is a distributed SCM tool written in Python. It is used by
  29. a number of large projects that require fast, reliable distributed
  30. revision control, such as Mozilla.
  31. "
  32. homepage=https://www.mercurial-scm.org
  33. license=GPLv2+
  34. docs="CONTRIBUTING CONTRIBUTORS COPYING PKG-INFO README* relnotes/6.2"
  35. docsdir="${docdir}/${program}-${version}"
  36. build()
  37. {
  38. unpack "${tardir}/$tarname"
  39. cd "$srcdir"
  40. # Set sane permissions
  41. chmod -R u+w,go-w,a+rX-s .
  42. python3 setup.py build
  43. python3 setup.py install --prefix=/usr --root="$destdir" --optimize=1
  44. # Install Mercurial server from contrib directory
  45. make -j${jobs} -C contrib/chg PREFIX=/usr DESTDIR="$destdir" install
  46. strip --strip-unneeded "${destdir}/usr/bin/chg"
  47. # Install wrapper for SSH access, and an extension for Tk
  48. install -p -m 755 contrib/hg-ssh "${destdir}/usr/bin"
  49. install -p -m 755 contrib/hgk "${destdir}/usr/bin"
  50. # Install syntax files for Emacs, Vim
  51. for file in contrib/*.el
  52. do
  53. install -p -m 644 "$file" \
  54. -D "${destdir}/usr/share/emacs/site-lisp/$file"
  55. done
  56. unset -v file
  57. install -p -m 644 contrib/vim/HGAnnotate.vim \
  58. -D "${destdir}/usr/share/vim/vimfiles/syntax/HGAnnotate.vim"
  59. # Add custom instructions for SSL certificate to Mercurial config
  60. mkdir -p "${destdir}/etc/mercurial"
  61. cat << EOF > "${destdir}/etc/mercurial/hgrc"
  62. [web]
  63. cacerts = /etc/ssl/certs/ca-certificates.crt
  64. EOF
  65. # To handle config file(s)
  66. touch "${destdir}/etc/mercurial/.graft-config"
  67. # Copy documentation
  68. mkdir -p "${destdir}/$docsdir"
  69. cp -p $docs "${destdir}/$docsdir"
  70. }