mconnect - KDE Connect protocol implementation in Vala/C
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

118 lines
2.8 KiB

  1. #!/bin/bash -xe
  2. #
  3. # This program is free software; you can redistribute it and/or modify
  4. # it under the terms of the GNU General Public License version 2 as
  5. # published by the Free Software Foundation.
  6. #
  7. # This program is distributed in the hope that it will be useful,
  8. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. # GNU General Public License for more details.
  11. #
  12. # You should have received a copy of the GNU General Public License along
  13. # with this program; if not, write to the Free Software Foundation, Inc.,
  14. # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  15. #
  16. # AUTHORS
  17. # Maciek Borzecki <maciek.borzecki (at] gmail.com>
  18. # Travis build script. The script reexecs itself inside the container (setting
  19. # IN_CONTAINER=1). The proceeds to install build dependencies and runs through
  20. # the whole build process. Source tree is bind-mounted at /mnt and the container
  21. # has its workdir set to /mnt
  22. #
  23. # NOTE: it is assumed that the script is run while at the top of source tree
  24. # (i.e. $PWD is your checked out tree, this crucial for properly mounting the
  25. # source code into the container).
  26. deps_fedora() {
  27. dnf install --best -y --refresh \
  28. automake \
  29. autoconf \
  30. libtool \
  31. pkgconfig \
  32. gcc \
  33. vala \
  34. gobject-introspection-devel \
  35. json-glib-devel \
  36. libgee-devel \
  37. openssl-devel \
  38. libnotify-devel \
  39. at-spi2-core-devel \
  40. gtk3-devel
  41. }
  42. deps_archlinux() {
  43. pacman -Syu --noconfirm \
  44. base-devel \
  45. autoconf \
  46. automake \
  47. libtool \
  48. pkg-config \
  49. gcc \
  50. vala \
  51. glib2 \
  52. gobject-introspection \
  53. json-glib \
  54. libgee \
  55. openssl \
  56. libnotify \
  57. at-spi2-core \
  58. gtk3
  59. }
  60. install_deps() {
  61. case "$1" in
  62. fedora)
  63. deps_fedora
  64. ;;
  65. archlinux)
  66. deps_archlinux
  67. ;;
  68. *)
  69. echo "unsupported distro $1"
  70. exit 1
  71. esac
  72. }
  73. build() {
  74. autoreconf -if
  75. # TODO: out of source builds
  76. ./configure
  77. make
  78. make install
  79. }
  80. build_in_container() {
  81. install_deps $1
  82. build
  83. }
  84. spin_container() {
  85. case "$1" in
  86. fedora)
  87. DOCKER_IMG=fedora
  88. ;;
  89. archlinux)
  90. DOCKER_IMG=base/archlinux
  91. ;;
  92. *)
  93. echo "unsupported distro $1"
  94. exit 1
  95. esac
  96. # run a container, mount sources at /mnt, st
  97. docker run --rm \
  98. -v $PWD:/mnt \
  99. -w /mnt \
  100. -e IN_CONTAINER=1 \
  101. $DOCKER_IMG \
  102. /mnt/extra/travis-build "$@"
  103. }
  104. if [ "$IN_CONTAINER" = "1" ]; then
  105. build_in_container "$@"
  106. else
  107. spin_container "$@"
  108. fi