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.

142 lines
3.3 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_opensuse() {
  43. zypper install -y \
  44. make \
  45. automake \
  46. autoconf \
  47. libtool \
  48. pkgconfig \
  49. gcc \
  50. vala \
  51. gobject-introspection-devel \
  52. json-glib-devel \
  53. libgee-devel \
  54. openssl-devel \
  55. libnotify-devel \
  56. at-spi2-core-devel \
  57. gtk3-devel
  58. }
  59. deps_archlinux() {
  60. pacman -Syu --noconfirm \
  61. base-devel \
  62. autoconf \
  63. automake \
  64. libtool \
  65. pkg-config \
  66. gcc \
  67. vala \
  68. glib2 \
  69. gobject-introspection \
  70. json-glib \
  71. libgee \
  72. openssl \
  73. libnotify \
  74. at-spi2-core \
  75. gtk3
  76. }
  77. install_deps() {
  78. case "$1" in
  79. fedora)
  80. deps_fedora
  81. ;;
  82. opensuse)
  83. deps_opensuse
  84. ;;
  85. archlinux)
  86. deps_archlinux
  87. ;;
  88. *)
  89. echo "unsupported distro $1"
  90. exit 1
  91. esac
  92. }
  93. build() {
  94. autoreconf -if
  95. # TODO: out of source builds
  96. ./configure
  97. make
  98. make install
  99. }
  100. build_in_container() {
  101. install_deps $1
  102. build
  103. }
  104. spin_container() {
  105. case "$1" in
  106. fedora)
  107. DOCKER_IMG=fedora
  108. ;;
  109. archlinux)
  110. DOCKER_IMG=base/archlinux
  111. ;;
  112. opensuse)
  113. DOCKER_IMG=opensuse:tumbleweed
  114. ;;
  115. *)
  116. echo "unsupported distro $1"
  117. exit 1
  118. esac
  119. # run a container, mount sources at /mnt, st
  120. docker run --rm \
  121. -v $PWD:/mnt \
  122. -w /mnt \
  123. -e IN_CONTAINER=1 \
  124. $DOCKER_IMG \
  125. /mnt/extra/travis-build "$@"
  126. }
  127. if [ "$IN_CONTAINER" = "1" ]; then
  128. build_in_container "$@"
  129. else
  130. spin_container "$@"
  131. fi