summaryrefslogtreecommitdiffstats
path: root/o3d
diff options
context:
space:
mode:
authortschmelcher@google.com <tschmelcher@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-07 18:39:12 +0000
committertschmelcher@google.com <tschmelcher@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-07 18:39:12 +0000
commit2e8f3dd5dbec1c494778713c47a42f6589ecbc86 (patch)
tree8ad97d238e4eb9408464e3d46553b869091cddbf /o3d
parent53e32fe539f0f8a9b13bbe0c348c325f20758a5f (diff)
downloadchromium_src-2e8f3dd5dbec1c494778713c47a42f6589ecbc86.zip
chromium_src-2e8f3dd5dbec1c494778713c47a42f6589ecbc86.tar.gz
chromium_src-2e8f3dd5dbec1c494778713c47a42f6589ecbc86.tar.bz2
Initial support for Linux installers. Currently just an amd64 .deb, but more later.
Review URL: http://codereview.chromium.org/149132 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@20051 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'o3d')
-rw-r--r--o3d/installer/linux/build.scons151
-rw-r--r--o3d/installer/linux/debian_amd64/changelog5
-rw-r--r--o3d/installer/linux/debian_amd64/control15
-rw-r--r--o3d/installer/linux/debian_amd64/dirs7
-rw-r--r--o3d/installer/linux/debian_amd64/google-o3d.install4
-rw-r--r--o3d/installer/linux/debian_amd64/links3
-rwxr-xr-xo3d/installer/linux/debian_amd64/postinst62
-rwxr-xr-xo3d/installer/linux/debian_amd64/prerm61
-rwxr-xr-xo3d/installer/linux/debian_amd64/rules7
-rw-r--r--o3d/main.scons3
10 files changed, 318 insertions, 0 deletions
diff --git a/o3d/installer/linux/build.scons b/o3d/installer/linux/build.scons
new file mode 100644
index 0000000..b55474e
--- /dev/null
+++ b/o3d/installer/linux/build.scons
@@ -0,0 +1,151 @@
+# Copyright 2009, Google Inc.
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above
+# copyright notice, this list of conditions and the following disclaimer
+# in the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of Google Inc. nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+import os
+import subprocess
+Import('env')
+
+# Check if Debian packaging tools are installed. If so, make a .deb package.
+if subprocess.Popen(["which", "dpkg-buildpackage"],
+ stdout=open(os.devnull, "w")).wait() == 0:
+
+ print('Found dpkg-buildpackage in PATH; will create Debian packages.');
+
+ current_source_dir = os.path.join(env['SCONSTRUCT_DIR'], 'installer/linux')
+
+ def OutputFromShellCommand(command):
+ process = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE)
+ return process.communicate()[0].strip()
+
+ def BuildDebianPackage(debian_files, package_files, output_dir=None):
+ """Creates build rules to build a Debian package from the specified sources.
+
+ Args:
+ debian_files: Array of the Debian control file sources that should be
+ copied into the package source tree, e.g., changelog, control, rules,
+ etc. Must be relative to current source dir.
+ package_files: An array of 2-tuples listing the files that should be
+ copied into the package source tree.
+ The first element is the path where the file should be placed for the
+ .install control file to find it, relative to the generated debian
+ package source directory.
+ The second element is the file source.
+ output_dir: An optional directory to place the files in. If omitted, the
+ current output directory is used.
+
+ Return:
+ A list of the (two) targets.
+ """
+ # Read the control file and changelog file to determine the package name,
+ # version, and arch that the Debian build tools will use to name the
+ # generated files.
+ control_file = None
+ changelog_file = None
+ for file in debian_files:
+ if os.path.basename(file) == "control":
+ control_file = os.path.join(current_source_dir, file)
+ elif os.path.basename(file) == "changelog":
+ changelog_file = os.path.join(current_source_dir, file)
+ if control_file == None:
+ raise Exception("Need to have a control file")
+ if changelog_file == None:
+ raise Exception("Need to have a changelog file")
+ package = OutputFromShellCommand("awk '/^Package:/ { print $2; }' "
+ + control_file)
+ version = OutputFromShellCommand("sed -nr '1 { s/.*\\((.*)\\).*/\\1/; p }' "
+ + changelog_file)
+ arch = OutputFromShellCommand("awk '/^Architecture:/ { print $2; }' "
+ + control_file)
+ package_file_name = package + "_" + version + "_" + arch
+ # Path to the outputs, minus extension.
+ if output_dir != None:
+ dest_files = os.path.join(output_dir, package_file_name)
+ else:
+ dest_files = package_file_name
+ # Path to where we will construct the debian build tree.
+ deb_build_tree = os.path.join(package_file_name, "deb_build_tree")
+ # The targets
+ targets = [dest_files + ".deb", dest_files + ".changes"]
+ # First copy the files.
+ for file in package_files:
+ env.Command(os.path.join(deb_build_tree, file[0]), file[1],
+ Copy('$TARGET', '$SOURCE'))
+ env.Depends(targets, os.path.join(deb_build_tree, file[0]))
+ # Now copy the Debian metadata sources. We have to do this all at once so
+ # that we can remove the target directory before copying, because there
+ # can't be any other stale files there or else dpkg-buildpackage may use
+ # them and give incorrect build output.
+ copied_debian_files_paths = []
+ for file in debian_files:
+ copied_debian_files_paths.append(os.path.join(deb_build_tree, "debian",
+ os.path.basename(file)))
+ env.Command(copied_debian_files_paths, debian_files,
+ """dir=$$(dirname $TARGET) && \
+ rm -Rf $$dir && \
+ mkdir -p $$dir && \
+ cp $SOURCES $$dir""")
+ env.Depends(targets, copied_debian_files_paths)
+ # TODO(tschmelcher): Change this to sign the package for Google builds once
+ # we start putting out Linux releases.
+ env.Command(targets, None,
+ """dir=$OBJ_ROOT/installer/linux/""" + deb_build_tree + """ && \
+ cd $$dir && \
+ dpkg-buildpackage -b -uc -aamd64 && \
+ cd $$OLDPWD && \
+ mv $$dir/../""" + package_file_name + """.deb \
+ $$(dirname $TARGET) && \
+ mv $$dir/../""" + package_file_name + """.changes \
+ $$(dirname $TARGET)""")
+ return targets
+
+
+ BuildDebianPackage(["debian_amd64/changelog",
+ "debian_amd64/control",
+ "debian_amd64/dirs",
+ "debian_amd64/google-o3d.install",
+ "debian_amd64/links",
+ "debian_amd64/postinst",
+ "debian_amd64/prerm",
+ "debian_amd64/rules"
+ ],
+ [("libnpo3dautoplugin.so",
+ '$ARTIFACTS_DIR/libnpo3dautoplugin.so'),
+ ("libGLEW.so.1.5", '$ARTIFACTS_DIR/libGLEW.so.1.5'),
+ ("libCg.so", '$ARTIFACTS_DIR/libCg.so'),
+ ("libCgGL.so", '$ARTIFACTS_DIR/libCgGL.so')
+ ],
+ output_dir='$ARTIFACTS_DIR')
+
+ # TODO(tschmelcher): Also build an i386 deb.
+
+else:
+ print('dpkg-buildpackage not found in PATH; Debian packages will not be '
+ 'built.');
+
+# TODO(tschmelcher): Also build an RPM and a tgz.
diff --git a/o3d/installer/linux/debian_amd64/changelog b/o3d/installer/linux/debian_amd64/changelog
new file mode 100644
index 0000000..f3babe6
--- /dev/null
+++ b/o3d/installer/linux/debian_amd64/changelog
@@ -0,0 +1,5 @@
+google-o3d (0.1.39.0-1) UNRELEASED; urgency=low
+
+ * Initial package.
+
+ -- tschmelcher <tschmelcher@google.com> Tue, 30 Jun 2009 14:24:21 -0700
diff --git a/o3d/installer/linux/debian_amd64/control b/o3d/installer/linux/debian_amd64/control
new file mode 100644
index 0000000..76e780c
--- /dev/null
+++ b/o3d/installer/linux/debian_amd64/control
@@ -0,0 +1,15 @@
+Source: google-o3d
+Section: non-free/web
+Priority: optional
+Maintainer: Tristan Schmelcher <tschmelcher@google.com>
+Build-Depends: debhelper (>= 4.0.0), cdbs (>=0.4.34ubuntu4)
+Standards-Version: 3.7.2
+
+Package: google-o3d
+Architecture: amd64
+Depends: ia32-libs, libc6-i386, lib32stdc++6, lib32gcc1, lib32z1, nspluginwrapper
+Description: Google O3D Plugin
+ O3D is an open-source web API for creating rich, interactive 3D applications in
+ the browser.
+ .
+ This package provides the NPAPI browser plugin for running O3D-based web apps.
diff --git a/o3d/installer/linux/debian_amd64/dirs b/o3d/installer/linux/debian_amd64/dirs
new file mode 100644
index 0000000..aa070db
--- /dev/null
+++ b/o3d/installer/linux/debian_amd64/dirs
@@ -0,0 +1,7 @@
+usr/lib/xulrunner/plugins
+usr/lib/mozilla/plugins
+usr/lib/iceape/plugins
+usr/lib/iceweasel/plugins
+usr/lib/firefox/plugins
+usr/lib/midbrowser/plugins
+usr/lib/xulrunner-addons/plugins
diff --git a/o3d/installer/linux/debian_amd64/google-o3d.install b/o3d/installer/linux/debian_amd64/google-o3d.install
new file mode 100644
index 0000000..0c00816
--- /dev/null
+++ b/o3d/installer/linux/debian_amd64/google-o3d.install
@@ -0,0 +1,4 @@
+libnpo3dautoplugin.so opt/google/o3d
+libGLEW.so.1.5 opt/google/o3d
+libCg.so opt/google/o3d
+libCgGL.so opt/google/o3d
diff --git a/o3d/installer/linux/debian_amd64/links b/o3d/installer/linux/debian_amd64/links
new file mode 100644
index 0000000..82b05dfa
--- /dev/null
+++ b/o3d/installer/linux/debian_amd64/links
@@ -0,0 +1,3 @@
+/opt/google/o3d/libCgGL.so /usr/lib32/libCgGL.so
+/opt/google/o3d/libCg.so /usr/lib32/libCg.so
+/opt/google/o3d/libGLEW.so.1.5 /usr/lib32/libGLEW.so.1.5
diff --git a/o3d/installer/linux/debian_amd64/postinst b/o3d/installer/linux/debian_amd64/postinst
new file mode 100755
index 0000000..3abad02
--- /dev/null
+++ b/o3d/installer/linux/debian_amd64/postinst
@@ -0,0 +1,62 @@
+#!/bin/sh
+# postinst script for google-o3d
+
+set -e
+
+# Find out which Debian-derived distro this is.
+. /etc/lsb-release
+if test "$DISTRIB_ID" = Ubuntu; then
+ distro=Ubuntu
+else
+ distro=Other
+fi
+
+# The nspluginwrapper package in Ubuntu behaves differently from upstream. By
+# default it installs the wrapped plugin to multiple directories. -n must be
+# used to suppress this. Additionally, when using -n the directory that it
+# installs to is still different. Hence the logic here.
+if test $distro = Ubuntu; then
+ WRAPPED_PLUGIN_PATH="/usr/lib/nspluginwrapper/plugins/npwrapper.libnpo3dautoplugin.so"
+ APPS="iceape iceweasel mozilla firefox xulrunner midbrowser xulrunner-addons"
+ NSPW_OPTS="-n"
+else
+ WRAPPED_PLUGIN_PATH="/usr/lib/mozilla/plugins/npwrapper.libnpo3dautoplugin.so"
+ APPS="iceape iceweasel firefox xulrunner midbrowser xulrunner-addons"
+ NSPW_OPTS=""
+fi
+
+case "$1" in
+ configure)
+ if ! which nspluginwrapper 2>&1 > /dev/null; then
+ echo "Error: nspluginwrapper not found. Please run \`sudo apt-get install nspluginwrapper' or equivalent." >&2
+ exit 1
+ fi
+ # Install the wrapper.
+ nspluginwrapper $NSPW_OPTS -i /opt/google/o3d/libnpo3dautoplugin.so
+ if test ! -f $WRAPPED_PLUGIN_PATH; then
+ echo "Can't find where the wrapped plugin was installed to." >&2
+ exit 1
+ fi
+ # Symlink to everywhere.
+ for app in $APPS; do
+ ln -sf $WRAPPED_PLUGIN_PATH /usr/lib/$app/plugins/
+ done
+ ;;
+
+ abort-upgrade|abort-remove|abort-deconfigure)
+ echo "postinst called with argument \`$1'" >&2
+ exit 1
+ ;;
+
+ *)
+ echo "postinst called with unknown argument \`$1'" >&2
+ exit 1
+ ;;
+esac
+
+# dh_installdeb will replace this with shell code automatically
+# generated by other debhelper scripts.
+
+#DEBHELPER#
+
+exit 0
diff --git a/o3d/installer/linux/debian_amd64/prerm b/o3d/installer/linux/debian_amd64/prerm
new file mode 100755
index 0000000..44c9646
--- /dev/null
+++ b/o3d/installer/linux/debian_amd64/prerm
@@ -0,0 +1,61 @@
+#!/bin/sh
+# prerm script for google-o3d
+
+set -e
+
+# Find out which Debian-derived distro this is.
+. /etc/lsb-release
+if test "$DISTRIB_ID" = Ubuntu; then
+ distro=Ubuntu
+else
+ distro=Other
+fi
+
+# The nspluginwrapper package in Ubuntu behaves differently from upstream. By
+# default it installs the wrapped plugin to multiple directories. -n must be
+# used to suppress this. Additionally, when using -n the directory that it
+# installs to is still different. Hence the logic here.
+if test $distro = Ubuntu; then
+ WRAPPED_PLUGIN_PATH="/usr/lib/nspluginwrapper/plugins/npwrapper.libnpo3dautoplugin.so"
+ APPS="iceape iceweasel mozilla firefox xulrunner midbrowser xulrunner-addons"
+else
+ WRAPPED_PLUGIN_PATH="/usr/lib/mozilla/plugins/npwrapper.libnpo3dautoplugin.so"
+ APPS="iceape iceweasel firefox xulrunner midbrowser xulrunner-addons"
+fi
+
+case "$1" in
+ remove|upgrade|deconfigure)
+ # Remove the symlinks.
+ for app in $APPS; do
+ # Don't fail if it happens to not be there. User might have removed it
+ # themselves, for example.
+ rm -f /usr/lib/$app/plugins/npwrapper.libnpo3dautoplugin.so
+ done
+ if ! which nspluginwrapper 2>&1 > /dev/null; then
+ echo "Warning: nspluginwrapper not found. Some files may be left over." >&2
+ else
+ # Remove the wrapper. Again, don't fail.
+ nspluginwrapper -r $WRAPPED_PLUGIN_PATH || { echo "Warning: Unable to remove wrapped plugin. Some files may be left over." >&2; }
+ fi
+ ;;
+
+ failed-upgrade)
+ # Executing "old-prerm upgrade" failed. This gets called to take over.
+ # If it succeeds, the upgrade continues and postinst is later called.
+ # We don't want users to get stuck on an old version, so we always continue
+ # the upgrade.
+ echo "Warning: continuing upgrade even though old version wasn't successfully deconfigured" >&2
+ ;;
+
+ *)
+ echo "prerm called with unknown argument \`$1'" >&2
+ exit 1
+ ;;
+esac
+
+# dh_installdeb will replace this with shell code automatically
+# generated by other debhelper scripts.
+
+#DEBHELPER#
+
+exit 0
diff --git a/o3d/installer/linux/debian_amd64/rules b/o3d/installer/linux/debian_amd64/rules
new file mode 100755
index 0000000..f99812c
--- /dev/null
+++ b/o3d/installer/linux/debian_amd64/rules
@@ -0,0 +1,7 @@
+#!/usr/bin/make -f
+
+# Needed for dpkg-shlibdeps to be able to find the libraries we ship with so as
+# to properly calculate our shared library dependencies.
+export LD_LIBRARY_PATH=$(shell echo $$LD_LIBRARY_PATH:$$PWD)
+
+include /usr/share/cdbs/1/rules/debhelper.mk
diff --git a/o3d/main.scons b/o3d/main.scons
index 66f4137..ac4746e 100644
--- a/o3d/main.scons
+++ b/o3d/main.scons
@@ -690,6 +690,9 @@ linux_env.Append(
LINKFLAGS = ['-m32'],
LIBS = ['pthread', 'rt'],
NACL_HTP_LIBS = ['ssl', 'crypto'],
+ BUILD_COMPONENTS = [
+ 'installer/linux'
+ ],
)
linux_cg_dir = ARGUMENTS.get('linux-cg-dir', 'hermetic')