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.

166 lines
3.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. gnutls-devel \
  38. libnotify-devel \
  39. at-spi2-core-devel \
  40. gtk3-devel \
  41. glib-networking
  42. }
  43. deps_opensuse() {
  44. zypper install -y \
  45. make \
  46. automake \
  47. autoconf \
  48. libtool \
  49. pkgconfig \
  50. gcc \
  51. vala \
  52. gobject-introspection-devel \
  53. json-glib-devel \
  54. libgee-devel \
  55. gnutls-devel \
  56. libnotify-devel \
  57. at-spi2-core-devel \
  58. gtk3-devel \
  59. glib-networking
  60. }
  61. deps_archlinux() {
  62. pacman -Syu --noconfirm \
  63. base-devel \
  64. autoconf \
  65. automake \
  66. libtool \
  67. pkg-config \
  68. gcc \
  69. vala \
  70. glib2 \
  71. gobject-introspection \
  72. json-glib \
  73. libgee \
  74. libnotify \
  75. at-spi2-core \
  76. gtk3 \
  77. gnutls \
  78. glib-networking
  79. }
  80. deps_ubuntu() {
  81. apt-get update && \
  82. apt-get install -y \
  83. autoconf \
  84. libtool \
  85. valac \
  86. libgirepository1.0-dev \
  87. libjson-glib-dev \
  88. libgee-0.8-dev \
  89. libgnutls28-dev \
  90. libnotify-dev \
  91. libgtk-3-dev \
  92. glib-networking
  93. }
  94. install_deps() {
  95. case "$1" in
  96. fedora)
  97. deps_fedora
  98. ;;
  99. opensuse)
  100. deps_opensuse
  101. ;;
  102. archlinux)
  103. deps_archlinux
  104. ;;
  105. ubuntu)
  106. deps_ubuntu
  107. ;;
  108. *)
  109. echo "unsupported distro $1"
  110. exit 1
  111. esac
  112. }
  113. build() {
  114. autoreconf -if && \
  115. ./configure && \
  116. make && \
  117. make check && \
  118. make install
  119. }
  120. build_in_container() {
  121. install_deps $1
  122. build
  123. }
  124. spin_container() {
  125. case "$1" in
  126. fedora)
  127. DOCKER_IMG=fedora
  128. ;;
  129. archlinux)
  130. DOCKER_IMG=base/archlinux
  131. ;;
  132. opensuse)
  133. DOCKER_IMG=opensuse:tumbleweed
  134. ;;
  135. ubuntu)
  136. DOCKER_IMG=ubuntu:latest
  137. ;;
  138. *)
  139. echo "unsupported distro $1"
  140. exit 1
  141. esac
  142. # run a container, mount sources at /mnt, st
  143. docker run --rm \
  144. -v $PWD:/mnt \
  145. -w /mnt \
  146. -e IN_CONTAINER=1 \
  147. $DOCKER_IMG \
  148. /mnt/extra/travis-build "$@"
  149. }
  150. if [ "$IN_CONTAINER" = "1" ]; then
  151. build_in_container "$@"
  152. else
  153. spin_container "$@"
  154. fi