Core commit. Compile and run on the OpenPandora
[mupen64plus-pandora.git] / source / mupen64plus-core / tools / install_binary_bundle.sh
CommitLineData
451ab91e 1#!/bin/sh
2#
3# mupen64plus binary bundle install script
4#
5# Copyright 2007-2013 The Mupen64Plus Development Team
6#
7# This program is free software; you can redistribute it and/or
8# modify it under the terms of the GNU General Public License
9# as published by the Free Software Foundation; either version 2
10# of the License, or (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU General Public License for more details.
16#
17# You should have received a copy of the GNU General Public License
18# along with this program; if not, write to the Free Software
19# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
20# 02110-1301, USA.
21#
22
23set -e
24
25export PATH=/bin:/usr/bin
26
27GINSTALLFLAG=-D
28
29if `which ginstall >/dev/null 2>&1`; then
30 INSTALL=ginstall
31elif install --help >/dev/null 2>&1; then
32 INSTALL=install
33elif [ -e "`which install 2>/dev/null`" ]; then
34 printf "warning: GNU install not found, assuming BSD install\n" >&2
35 INSTALL=install
36 GINSTALLFLAG=
37else
38 printf "error: install tool not found\n" >&2
39 exit 1
40fi
41
42INSTALL_STRIP_FLAG="${INSTALL_STRIP_FLAG:=-s}"
43
44usage()
45{
46printf "usage: $(basename $0) [PREFIX] [SHAREDIR] [BINDIR] [LIBDIR] [PLUGINDIR] [MANDIR]
47\tPREFIX - installation directories prefix (default: /usr/local)
48\tSHAREDIR - path to Mupen64Plus shared data files (default: \$PREFIX/share/mupen64plus)
49\tBINDIR - path to Mupen64Plus binary program files (default: \$PREFIX/bin)
50\tLIBDIR - path to Mupen64Plus core library (default: \$PREFIX/lib)
51\tPLUGINDIR - path to Mupen64Plus plugin libraries (default: \$PREFIX/lib/mupen64plus)
52\tMANDIR - path to manual files (default: \$PREFIX/share/man)
53"
54}
55
56if [ $# -gt 6 ]; then
57 usage
58 exit 1
59fi
60
61PREFIX="${1:-/usr/local}"
62SHAREDIR="${2:-${PREFIX}/share/mupen64plus}"
63BINDIR="${3:-${PREFIX}/bin}"
64LIBDIR="${4:-${PREFIX}/lib}"
65PLUGINDIR="${5:-${PREFIX}/lib/mupen64plus}"
66MANDIR="${6:-${PREFIX}/share/man}"
67
68# simple check for permissions
69if [ -d "${SHAREDIR}" -a ! -w "${SHAREDIR}" ]; then
70 printf "Error: you do not have permission to install at: ${SHAREDIR}\nMaybe you need to be root?\n"
71 exit 1
72fi
73if [ -d "${BINDIR}" -a ! -w "${BINDIR}" ]; then
74 printf "Error: you do not have permission to install at: ${BINDIR}\nMaybe you need to be root?\n"
75 exit 1
76fi
77if [ -d "${LIBDIR}" -a ! -w "${LIBDIR}" ]; then
78 printf "Error: you do not have permission to install at: ${LIBDIR}\nMaybe you need to be root?\n"
79 exit 1
80fi
81if [ -d "${PLUGINDIR}" -a ! -w "${PLUGINDIR}" ]; then
82 printf "Error: you do not have permission to install at: ${PLUGINDIR}\nMaybe you need to be root?\n"
83 exit 1
84fi
85if [ -d "${MANDIR}" -a ! -w "${MANDIR}" ]; then
86 printf "Error: you do not have permission to install at: ${MANDIR}\nMaybe you need to be root?\n"
87 exit 1
88fi
89
90printf "Installing Mupen64Plus Binary Bundle to ${PREFIX}\n"
91# Mupen64Plus-Core
92$INSTALL -d -v "${LIBDIR}"
93$INSTALL -m 0644 "${INSTALL_STRIP_FLAG}" libmupen64plus.so.2.* "${LIBDIR}"
94/sbin/ldconfig
95$INSTALL -d -v "${SHAREDIR}"
96$INSTALL -m 0644 font.ttf "${SHAREDIR}"
97$INSTALL -m 0644 mupen64plus.cht "${SHAREDIR}"
98$INSTALL -m 0644 mupen64plus.ini "${SHAREDIR}"
99$INSTALL -d -v "${SHAREDIR}/doc"
100$INSTALL -m 0644 doc/* "${SHAREDIR}/doc"
101# Mupen64Plus-ROM
102$INSTALL -m 0644 m64p_test_rom.v64 "${SHAREDIR}"
103# Mupen64Plus-UI-Console
104$INSTALL -d -v "${BINDIR}"
105$INSTALL $GINSTALLFLAG -m 0755 mupen64plus "${BINDIR}"
106$INSTALL -d -v "${MANDIR}/man6"
107$INSTALL -m 0644 man6/mupen64plus.6 "${MANDIR}/man6"
108# Plugins
109$INSTALL -d -v "${PLUGINDIR}"
110$INSTALL -m 0644 "${INSTALL_STRIP_FLAG}" mupen64plus-audio-sdl.so "${PLUGINDIR}"
111$INSTALL -m 0644 "${INSTALL_STRIP_FLAG}" mupen64plus-input-sdl.so "${PLUGINDIR}"
112$INSTALL -m 0644 "${INSTALL_STRIP_FLAG}" mupen64plus-rsp-hle.so "${PLUGINDIR}"
113$INSTALL -m 0644 "${INSTALL_STRIP_FLAG}" mupen64plus-video-rice.so "${PLUGINDIR}"
114$INSTALL -m 0644 "${INSTALL_STRIP_FLAG}" mupen64plus-video-glide64mk2.so "${PLUGINDIR}"
115$INSTALL -m 0644 RiceVideoLinux.ini "${SHAREDIR}"
116$INSTALL -m 0644 InputAutoCfg.ini "${SHAREDIR}"
117$INSTALL -m 0644 Glide64mk2.ini "${SHAREDIR}"
118
119printf "Installation successful.\n"
120