Project

General

Profile

Statistics
| Branch: | Tag: | Revision:

gdp / adm / gdp-setup.sh @ master

History | View | Annotate | Download (3.66 KB)

1
#!/bin/sh
2

    
3
#
4
#  Set up GDP environment for compilation
5
#
6
#	This is overkill if you're not compiling.
7
#
8

    
9
cd `dirname $0`/..
10
root=`pwd`
11
. $root/adm/common-support.sh
12

    
13
info "Setting up packages for GDP compilation."
14
info "This is overkill if you are only installing binaries."
15

    
16
info "Installing packages needed by GDP for $OS"
17

    
18
info "Updating the package database"
19
case "$PKGMGR" in
20
    "brew")
21
	brew=`which brew`
22
	if [ -f $brew ]; then
23
		brewUser=`ls -l $brew | awk '{print $3}'`
24
		# Only use sudo to update brew if the brew binary is owned by
25
		# root.  This avoids "Cowardly refusing to 'sudo brew update'"
26
		if [ "$brewUser" = "root" ]; then
27
		    sudo brew update
28
		else
29
		    brew update
30
		fi
31
	fi
32
	;;
33

    
34
    "macports")
35
	sudo port selfupdate
36
	;;
37

    
38
    "brewports")
39
	fatal "You must choose between Homebrew and Macports.  Macports suggested."
40
	;;
41
esac
42

    
43

    
44
case "$OS" in
45
    "ubuntu" | "debian" | "raspbian")
46
	sudo apt-get update
47
	sudo apt-get clean
48
	package build-essential
49
	package libevent-dev
50
	package libevent-pthreads
51
	package libsqlite3-dev
52
	if [ ! -f /etc/apt/sources.list.d/mariadb.list ]
53
	then
54
		package curl
55
		curl -sS https://downloads.mariadb.com/MariaDB/mariadb_repo_setup | sudo bash
56
		# clean out old cruft that gets in the way
57
		sudo apt remove libmariadb-client-lgpl-dev libmysqlclient-dev
58
	fi
59
	package libmariadb3
60
	package libmariadb-dev
61
	package libmariadb-dev-compat
62
	package zlib1g-dev
63
	package libssl-dev
64
	package uuid-dev
65
	package lighttpd
66
	package libjansson-dev
67
	package libprotobuf-c-dev
68
	package protobuf-c-compiler
69
	package libprotobuf-dev
70
	package libavahi-common-dev
71
	package libavahi-client-dev
72
	package avahi-daemon
73
	if [ -e /etc/systemd/system ]
74
	then
75
		package libsystemd-dev
76
	fi
77
	if ! ls /etc/apt/sources.list.d/mosquitto* > /dev/null 2>&1
78
	then
79
		package software-properties-common
80
		info "Setting up mosquitto repository"
81
		sudo apt-add-repository ppa:mosquitto-dev/mosquitto-ppa
82
	fi
83
	package libmosquitto-dev
84
	package mosquitto-clients
85
	package pandoc
86
	;;
87

    
88
    "darwin")
89
	package libevent
90
	package openssl
91
	package lighttpd
92
	package jansson
93
	package protobuf-c
94
	package sqlite3
95
	package mariadb-10.2
96
	if [ "$PKGMGR" = "brew" ]
97
	then
98
		package mosquitto
99

    
100
		warn "Homebrew doesn't install OpenSSL in system directories."
101
		info "I'll try to compensate, but it may cause linking problems."
102
		info "Macports does not seem to have this problem."
103

    
104
		warn "Homebrew doesn't support Avahi."
105
		info "Avahi is used for Zeroconf (automatic client"
106
		info "configuration.  Under Darwin, Avahi is difficult"
107
		info "to build without editing files.  To build gdp without"
108
		info "Zeroconf use 'make all_noavahi'"
109
	else
110
		package avahi
111
		warn "Macports doesn't support Mosquitto: install by hand."
112
		info "See https://mosquitto.org/ for instructions."
113
	fi
114
	package pandoc
115
	;;
116

    
117
    "freebsd")
118
	package libevent2
119
	package openssl
120
	package lighttpd
121
	package jansson
122
	package protobuf-c
123
	package avahi
124
	package mosquitto
125
	package sqlite3
126
	package mariadb102-client
127
	package hs-pandoc
128
	;;
129

    
130
    "gentoo" | "redhat")
131
	# untested
132
	package libevent-devel
133
	package openssl-devel
134
	package lighttpd
135
	package jansson-devel
136
	package avahi-devel
137
	package sqlite3-devel
138
	package mariadb102-devel
139
	package mosquitto
140
	if [ -e /etc/systemd/system ]
141
	then
142
		package systemd-dev
143
	fi
144
	package uuid-devel
145
	warn "Yum doesn't support Pandoc: install by hand"
146
	;;
147

    
148
    "centos")
149
	# untested
150
	package epel-release
151
	package libevent-devel
152
	package openssl-devel
153
	package lighttpd
154
	package jansson-devel
155
	package avahi-devel
156
	package sqlite3-devel
157
	package mariadb102-devel
158
	package mosquitto
159
	if [ -e /etc/systemd/system ]
160
	then
161
		package systemd-dev
162
	fi
163
	package pandoc
164
	;;
165

    
166
    *)
167
	fatal "$0: unknown OS $OS"
168
	;;
169
esac
170

    
171
# vim: set ai sw=8 sts=8 ts=8 :