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.

162 lines
3.7 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. deps_ubuntu() {
  78. apt-get update && \
  79. apt-get install -y \
  80. autoconf \
  81. libtool \
  82. valac \
  83. libgirepository1.0-dev \
  84. libjson-glib-dev \
  85. libgee-0.8-dev \
  86. libssl-dev \
  87. libnotify-dev \
  88. libgtk-3-dev
  89. }
  90. install_deps() {
  91. case "$1" in
  92. fedora)
  93. deps_fedora
  94. ;;
  95. opensuse)
  96. deps_opensuse
  97. ;;
  98. archlinux)
  99. deps_archlinux
  100. ;;
  101. ubuntu)
  102. deps_ubuntu
  103. ;;
  104. *)
  105. echo "unsupported distro $1"
  106. exit 1
  107. esac
  108. }
  109. build() {
  110. autoreconf -if
  111. # TODO: out of source builds
  112. ./configure
  113. make
  114. make install
  115. }
  116. build_in_container() {
  117. install_deps $1
  118. build
  119. }
  120. spin_container() {
  121. case "$1" in
  122. fedora)
  123. DOCKER_IMG=fedora
  124. ;;
  125. archlinux)
  126. DOCKER_IMG=base/archlinux
  127. ;;
  128. opensuse)
  129. DOCKER_IMG=opensuse:tumbleweed
  130. ;;
  131. ubuntu)
  132. DOCKER_IMG=ubuntu:latest
  133. ;;
  134. *)
  135. echo "unsupported distro $1"
  136. exit 1
  137. esac
  138. # run a container, mount sources at /mnt, st
  139. docker run --rm \
  140. -v $PWD:/mnt \
  141. -w /mnt \
  142. -e IN_CONTAINER=1 \
  143. $DOCKER_IMG \
  144. /mnt/extra/travis-build "$@"
  145. }
  146. if [ "$IN_CONTAINER" = "1" ]; then
  147. build_in_container "$@"
  148. else
  149. spin_container "$@"
  150. fi