提交 4ce0f57a authored 作者: Travis Cross's avatar Travis Cross

debian: add new and vastly improved packaging for Debian

We now break out each module and component of FreeSWITCH into a
separate individually-installable package.  For each package with
executables or modules, we also build a package that includes the
stripped debugging symbols so that users can be helpful when they
discover bugs in FreeSWITCH.

As of this commit, we successfully build 263 distinct binary packages
starting from a clean minimal image on both Debian Sid and Debian
Squeeze.

To keep this manageable, we include a program that generates the
various Debian packaging files from a consolidated description of the
modules and their metadata.  The program can even generate this
configuration file by walking the FreeSWITCH source tree.

To provide a smooth user experience, we provide meta-packages that
install sensible sets of modules and other components.

All files are installed into the traditional and customary Linux
directories that you would expect in accordance with the Filesystem
Hierarchy Standard (FHS).

This commit also adds support for running FreeSWITCH as a forked
systemd service in Debian.

For more information about the technical details of the source
packaging, how to build the binary packages from source, and how you
can contribute, please read debian/README.source.

To learn about how this packaging affects you as a user and how to use
the finished Debian packages, read debian/README.Debian.
Signed-off-by: 's avatarTravis Cross <tc@traviscross.com>
上级 9181e8e5
...@@ -57,6 +57,7 @@ core.* ...@@ -57,6 +57,7 @@ core.*
!/w32/Setup/inno_setup/vcredist_x86.exe !/w32/Setup/inno_setup/vcredist_x86.exe
/.version /.version
/.stamp-*
/a.out.dSYM /a.out.dSYM
/AUTHORS /AUTHORS
/ChangeLog /ChangeLog
......
# gitignore
/.stamp-bootstrap
/control
/control-modules.*
/files
/modules.conf
/modules_.conf
/freeswitch-autotools.install
/freeswitch-mod-*.install
/freeswitch-conf-*.install
/freeswitch-sounds-*.install
/*.log
/*.substvars
/*.debhelper
/tmp
/freeswitch/
/freeswitch-dbg/
/freeswitch-dev/
/freeswitch-doc/
/freeswitch-mod-*/
/freeswitch-sounds-*/
FreeSWITCH for Debian
--------------
This debian packaging breaks out every module of freeswitch into a
separate package, so be sure to verify that you are actually
installing all the modules that you need.
As a break from the past, we now install all files into their correct
FHS locations.
This package does not install any configuration for freeswitch into
/etc/freeswitch. We leave you, the system administrator completely
responsible for that directory. If you install one of the conf
packages, it will install the corresponding sample configuration to
/usr/share/freeswitch/conf and you'll need to copy the bits you need
to /etc/freeswitch.
-- Travis Cross <tc@traviscross.com>, Sat, 5 May 2012 06:31:24 +0000
FreeSWITCH for Debian
--------------
You may be reading this because you're wondering where all the files
are in debian/, such as control.
Because FreeSWITCH has so many modules it was necessary to create a
system to autogenerate the majority of the packaging. This in done
mostly in the file debian/bootstrap.sh. This bootstrap needs to run
before any other step of the packaging, though we do try to
autogenerate it when possible.
The build dependencies, runtime dependencies, and other details about
modules can be configured in the debian/control-modules file. Even
though this file looks a bit like a debian control file and has a
similar format, we are parsing this file ourselves so the format is a
bit more restricted.
debian/control-modules currently supports the following fields:
# lines that begin with the hash character are comments
#
# every block must start with a Module field
Module: <category>/<module_name>
Description: <short description>
<long description> # empty lines with "."s are not yet supported
Build-Depends: <build deps for this module>
Depends: <runtime deps for this module>
Recommends: <recommended packages>
Suggests: <suggested packages>
Distro-Conflicts: <distributions on which this module should not be built> # not yet implemented
During bootstrap we build a file control-modules.gen. If the
control-modules file is properly formatted, this generated file should
be identical. This is a sanity check mechanism for our parsing, as
well as a way to automatically reorganize the file.
If the file debian/modules.conf is present, we read that file and only
build and package the files listed there. Otherwise, we build every
module except the ones that either should not be packaged, or for
which we don't yet have good packaging.
The format of debian/modules.conf is:
## comments should start with two hash characters
<category>/<module_name>
To build this package, I recommend running the following from the root
directory of your FS git working tree:
mkdir ../sounds
export FS_SOUNDS_DIR=$(pwd)/../sounds
git clean -fdx && git reset --hard HEAD
(cd debian && ./bootstrap.sh)
schedtool -B -e git-buildpackage --git-verbose -us -uc
-- Travis Cross <tc@traviscross.com>, Sat, 5 May 2012 08:04:19 +0000
差异被折叠。
freeswitch (1.2~alpha1-1) unstable; urgency=low
* Initial release of FreeSWITCH in new debian packaging.
* The debian packaging has been completely rewritten from the ground up.
* We now install to the correct locations outlined in the Filesystem
Hierarchy Standard (FHS).
* All modules are packaged separately from the core.
* We have a handy system for autogenerating the final packaging
configuration from a consolidated configuration file.
-- Travis Cross <tc@traviscross.com> Sat, 05 May 2012 07:10:14 +0000
差异被折叠。
Format: http://dep.debian.net/deps/dep5
Upstream-Name: freeswitch
Source: http://freeswitch.org/
Files: debian/*
Copyright: 2012 Travis Cross <tc@traviscross.com>
License: MPL or GPL2+ (at your option)
#!/bin/bash
##### -*- mode:shell-script; indent-tabs-mode:nil; sh-basic-offset:2 -*-
##### Author: Travis Cross <tc@traviscross.com>
create_dbg_pkgs () {
for x in debian/*; do
test ! -d $x && continue
test "$x" = "tmp" -o "$x" = "source" && continue
test ! "$x" = "${x%-dbg}" && continue
test ! -d $x/usr/lib/debug && continue
mkdir -p $x-dbg/usr/lib
mv $x/usr/lib/debug $x-dbg/usr/lib/
done
}
create_dbg_pkgs
/usr/include
/usr/lib/freeswitch/mod/*.la
/usr/lib/*.{a,la}
/usr/lib/pkgconfig
/usr/share/freeswitch/htdocs/license.txt
/usr/share/freeswitch/htdocs/slim.swf
/usr/share/freeswitch/htdocs/slimtest.htm
;;;;; Author: Travis Cross <tc@traviscross.com>
[Unit]
Description=freeswitch
After=syslog.target network.target local-fs.target
[Service]
; service
Type=forking
PIDFile=/run/freeswitch/freeswitch.pid
PermissionsStartOnly=true
ExecStartPre=/bin/mkdir -p /run/freeswitch
ExecStartPre=/bin/chown freeswitch:freeswitch /run/freeswitch
ExecStart=/usr/bin/freeswitch -nc -nonat
TimeoutSec=45s
Restart=always
; exec
WorkingDirectory=/run/freeswitch
User=freeswitch
Group=freeswitch
LimitCORE=infinity
LimitNOFILE=100000
LimitNPROC=60000
LimitSTACK=240
LimitRTPRIO=infinity
LimitRTTIME=7000000
IOSchedulingClass=realtime
IOSchedulingPriority=2
CPUSchedulingPolicy=rr
CPUSchedulingPriority=89
UMask=0007
[Install]
WantedBy=multi-user.target
/lib/systemd/system/freeswitch.service
# /etc/default/freeswitch
DAEMON_OPTS=""
#!/bin/sh
### -*- mode:shell-script; indent-tabs-mode:nil; sh-basic-offset:2 -*-
### BEGIN INIT INFO
# Provides: freeswitch
# Required-Start: $network $local_fs
# Required-Stop:
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: FreeSWITCH Softswitch
# Description: FreeSWITCH Softswitch
### END INIT INFO
# Author: Travis Cross <tc@traviscross.com>
PATH=/sbin:/usr/sbin:/bin:/usr/bin
DESC=freeswitch
NAME=freeswitch
DAEMON=/usr/bin/freeswitch
DAEMON_ARGS="-u freeswitch -g freeswitch -rp -nc -nonat"
USER=freeswitch
PIDFILE=/var/run/$NAME/$NAME.pid
SCRIPTNAME=/etc/init.d/$NAME
WORKDIR=/var/lib/$NAME
[ -x $DAEMON ] || exit 0
[ -r /etc/default/$NAME ] && . /etc/default/$NAME
. /lib/init/vars.sh
. /lib/lsb/init-functions
do_start() {
start-stop-daemon --start --quiet \
--pidfile $PIDFILE --exec $DAEMON --name $NAME --user $USER \
--test > /dev/null \
|| return 1
ulimit -s 240
start-stop-daemon --start --quiet \
--pidfile $PIDFILE --exec $DAEMON --name $NAME --user $USER \
--chdir $WORKDIR -- $DAEMON_ARGS $DAEMON_OPTS \
|| return 2
return 0
}
stop_fs() {
start-stop-daemon --stop --quiet \
--pidfile $PIDFILE --name $NAME --user $USER \
--retry=TERM/30/KILL/5
}
stop_fs_children() {
start-stop-daemon --stop --quiet \
--exec $DAEMON \
--oknodo --retry=0/30/KILL/5
}
do_stop() {
stop_fs
RETVAL="$?"
[ "$RETVAL" -eq 2 ] && return 2
stop_fs_children
[ "$?" -eq 2 ] && return 2
rm -f $PIDFILE
return "$RETVAL"
}
do_reload() {
start-stop-daemon --stop --quiet \
--pidfile $PIDFILE --name $NAME --user $USER \
--signal HUP
}
case "$1" in
start)
[ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC " "$NAME"
do_start
case "$?" in
0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
esac
;;
stop)
[ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
do_stop
case "$?" in
0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
esac
;;
status)
status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $?
;;
reload|force-reload)
log_daemon_msg "Reloading $DESC" "$NAME"
do_reload
log_end_msg $?
;;
restart)
log_daemon_msg "Restarting $DESC" "$NAME"
do_stop
case "$?" in
0|1)
do_start
case "$?" in
0) log_end_msg 0 ;;
1|*) log_end_msg 1 ;;
esac
;;
*) log_end_msg 1 ;;
esac
;;
*)
echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload}" >&2
exit 3
;;
esac
exit 0
/usr/bin
/usr/lib/libfreeswitch.so*
/usr/share/freeswitch/scripts
#!/bin/sh
set -e
case "$1" in
configure)
if ! getent group freeswitch >/dev/null; then
groupadd --system freeswitch
fi
if ! getent passwd freeswitch >/dev/null; then
useradd --system -g freeswitch -Gaudio \
-d /var/run/freeswitch \
-s /bin/false \
-e '' \
-c 'FreeSWITCH' \
freeswitch
fi
for x in \
/var/lib/freeswitch \
/var/lib/freeswitch/db \
/var/lib/freeswitch/recordings \
/var/lib/freeswitch/storage \
/var/log/freeswitch \
/var/run/freeswitch;
do
mkdir -p $x
chown -R freeswitch:freeswitch $x
chmod -R o-rwx,g+u $x
done
;;
abort-upgrade|abort-remove|abort-deconfigure)
;;
*)
echo "postinst called with unknown argument \`$1'" >&2
exit 1
;;
esac
#DEBHELPER#
exit 0
#!/bin/sh
set -e
case "$1" in
purge|remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)
if [ "$1" = "purge" ]; then
if getent passwd freeswitch >/dev/null; then
userdel freeswitch
fi
if getent group freeswitch >/dev/null; then
groupdel freeswitch
fi
for x in \
/var/lib/freeswitch \
/var/log/freeswitch \
/var/run/freeswitch;
do
rm -rf $x
done
fi
;;
*)
echo "postrm called with unknown argument \`$1'" >&2
exit 1
;;
esac
#DEBHELPER#
exit 0
#!/bin/sh
set -e
case "$1" in
install|upgrade)
;;
abort-upgrade)
;;
*)
echo "preinst called with unknown argument \`$1'" >&2
exit 1
;;
esac
#DEBHELPER#
exit 0
#!/bin/sh
set -e
case "$1" in
remove|upgrade|deconfigure)
;;
failed-upgrade)
;;
*)
echo "prerm called with unknown argument \`$1'" >&2
exit 1
;;
esac
#DEBHELPER#
exit 0
# git-buildpackage
[git-buildpackage]
verbose=True
ignore-branch=True
ignore-new=True
upstream-branch=master
debian-branch=master
upstream-tree=branch
tag=False
force-create=True
compression=xz
compression-level=9ev
builder=debuild --prepend-path=/usr/lib/ccache -eFS_* -eCCACHE_* -i\.git -I.git -Zxz -z9
#!/usr/bin/make -f
# -*- mode:makefile -*-
#export DH_VERBOSE=1
FS_CFLAGS?=-ggdb3 -O2
FS_CPPFLAGS?=
FS_CXXFLAGS?=$(FS_CFLAGS)
FS_INSTALL_SOUNDS?=true
export PATH?=/usr/lib/ccache:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
export CFLAGS=$(FS_CFLAGS)
export CPPFLAGS=$(FS_CPPFLAGS)
export CXXFLAGS=$(FS_CXXFLAGS)
show_vars= \
echo; \
echo "Making target $@"; \
echo "PATH='$(PATH)'"; \
echo "CFLAGS='$(CFLAGS)'"; \
echo "CXXFLAGS='$(CXXFLAGS)'"; \
echo "CCACHE_DIR='$(CCACHE_DIR)'"; \
echo "FS_INSTALL_SOUNDS='$(FS_INSTALL_SOUNDS)'"; \
echo;
binary:
@$(call show_vars)
dh $@
binary-arch:
@$(call show_vars)
dh $@
binary-indep:
@$(call show_vars)
dh $@
build: debian/.stamp-bootstrap
@$(call show_vars)
dh $@
clean:
dh $@
override_dh_auto_clean:
dh_clean
.stamp-bootstrap:
@$(call show_vars)
./bootstrap.sh -j
touch $@
.stamp-configure: .stamp-bootstrap
@$(call show_vars)
touch noreg
cp debian/modules_.conf modules.conf
./configure -C --enable-portable-binary --disable-dependency-tracking \
--host=$(DEB_HOST_GNU_TYPE) --build=$(DEB_BUILD_GNU_TYPE) \
--with-gnu-ld --with-python --with-erlang --with-openssl \
--enable-core-odbc-support --enable-zrtp \
--prefix=/usr --localstatedir=/var \
--sysconfdir=/etc/freeswitch \
--with-modinstdir=/usr/lib/freeswitch/mod \
--with-rundir=/var/run/freeswitch \
--with-logfiledir=/var/log/freeswitch \
--with-dbdir=/var/lib/freeswitch/db \
--with-htdocsdir=/usr/share/freeswitch/htdocs \
--with-soundsdir=/usr/share/freeswitch/sounds \
--with-grammardir=/usr/share/freeswitch/grammar \
--with-scriptdir=/usr/share/freeswitch/scripts \
--with-recordingsdir=/var/lib/freeswitch/recordings
touch $@
override_dh_auto_configure: .stamp-configure
.stamp-build: .stamp-configure
@$(call show_vars)
make
touch $@
override_dh_auto_build: .stamp-build
override_dh_auto_test:
override_dh_strip:
dh_strip -a -k
./debian/create-dbg-pkgs.sh
override_dh_auto_install:
dh_auto_install
-$(FS_INSTALL_SOUNDS) && DESTDIR=debian/tmp make cd-sounds-install cd-moh-install
mkdir -p debian/tmp/lib/systemd/system
install -m0644 debian/freeswitch-systemd.freeswitch.service debian/tmp/lib/systemd/system/freeswitch.service
override_dh_installinit:
dh_installinit -pfreeswitch-sysvinit --name=freeswitch
debian-bootstrap: debian/.stamp-bootstrap
debian/.stamp-bootstrap:
(cd debian && ./bootstrap.sh)
touch $@
binary-basetest:
@$(call show_vars)
echo "applications/mod_commands" > debian/modules.conf
(cd debian && ./bootstrap.sh)
dh binary
binary-quicktest:
@$(call show_vars)
echo "applications/mod_commands" > debian/modules.conf
(cd debian && ./bootstrap.sh)
env FS_INSTALL_SOUNDS=false dh binary \
-Nfreeswitch-sounds-music-8k \
-Nfreeswitch-sounds-music-16k \
-Nfreeswitch-sounds-music-32k \
-Nfreeswitch-sounds-music-48k \
-Nfreeswitch-sounds-en-us-callie-8k \
-Nfreeswitch-sounds-en-us-callie-16k \
-Nfreeswitch-sounds-en-us-callie-32k \
-Nfreeswitch-sounds-en-us-callie-48k
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论