-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmake-deb.sh.in
145 lines (113 loc) · 5.71 KB
/
make-deb.sh.in
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
#!/bin/bash
# managedFlu - OpenFOAM C++ interactive functionality API
# Copyright (C) 2011- Alexey Petrov
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# See http://sourceforge.net/projects/pythonflu
#
# Author : Alexey PETROV, Andrey Simurzin
#--------------------------------------------------------------------------------------
# Prepare variables for substition in control,changelog etc files
export DEBEMAIL='[email protected]'
export DEBFULLNAME="Alexey Petrov"
#--------------------------------------------------------------------------------------
silent_dh_make()
{
template_folder=$1
package_name=$2
package_version=$3
expect <<EOD
spawn dh_make -s -createorig -c gpl --templates ${template_folder} -p ${package_name}_${package_version}
expect "Hit <enter> to confirm:"
send "\r"
wait 10
expect eof
EOD
}
#--------------------------------------------------------------------------------------
# read build option "launchpad"( key "-S" -source for "dpkg-buildpackage" ) or "deb"(key "-b" binary for "dpkg-buildpackage" )
build_option=$1
managedflu_version=@PACKAGE_VERSION@
package_name="managedflu@FOAM_PACKAGE_SUFFIX@"
build_version=@BUILD_VERSION@
package_version=${managedflu_version}-${build_version}
curr_folder=@abs_top_builddir@
package_folder=${curr_folder}/${package_name}_${package_version}
template_folder=${curr_folder}/deb-template
pgp_key_id=@PGP_KEY_ID@
foam_user_bin=@FOAM_USER_BIN@
foam_user_lib=@FOAM_USER_LIB@
build_dir_name=`dirname ${foam_user_bin}`
build_dir_name=`basename ${build_dir_name}`
#--------------------------------------------------------------------------------------
# Prepare folder for deb-packaging and copy folder "Foam" to it
# first cleaning package files, folders with the same name( ${package_name}-${package_version} ) from the last attempt
rm -rf ${package_name}-${package_version}*
rm -rf ${package_name}_${package_version}*
install -d ${package_folder} ${package_folder}/admin ${package_folder}/bin ${package_folder}/lib
echo "--------------------------------------------------------------------------------"
echo "Copying files to ${package_folder}"
echo "--------------------------------------------------------------------------------"
cp -rf src ${package_folder}
cp -rf admin/managedflu*.m4 ${package_folder}/admin/
cp -rf @abs_top_builddir@/lib/* ${package_folder}/lib
if [ "@FOAM_VERSION@" = "020000" ]; then
cp -rf @abs_top_builddir@/bin/* ${package_folder}/bin
fi
#--------------------------------------------------------------------------------------
# remove all unnecessary from the ${package_folder}
echo "cleaning h, o, etc..."
echo "--------------------------------------------------------------------------------"
(cd ${package_folder}/src && find \( -name "*.dep" -o -name "*.cpp" -o -name "*.o" -o -name "Makefile.in" -o -name "Makefile" \) -delete)
(cd ${package_folder}/src && rm -rf `find \( -type d -name ${build_dir_name} \) -print` )
#--------------------------------------------------------------------------------------
# create folder debian with control,changelog, etc files
echo "create debian folder and all necessary files( control, changelog etc ) in it "
echo "--------------------------------------------------------------------------------"
cp ${template_folder}/Makefile ${package_folder}
cp ${curr_folder}/ChangeLog deb-template/changelog
( cd ${package_folder} && silent_dh_make ${template_folder} ${package_name} ${package_version} )
echo "--------------------------------------------------------------------------------"
#--------------------------------------------------------------------------------------
# replace readme and copyrights
echo "copying readme and copyrights"
cp -f ${curr_folder}/README ${package_folder}/debian/README.Debian
cp -f ${curr_folder}/README ${package_folder}/debian/README.source
cp -f ${curr_folder}/deb-template/copyright ${package_folder}/debian/
echo "--------------------------------------------------------------------------------"
#---------------------------------------------------------------------------------------
# create package
echo "create package"
echo "--------------------------------------------------------------------------------"
pgp_key_option="-k${pgp_key_id}"
if [ "x${pgp_key_id}" = "x" ];then
pgp_key_option=""
fi
# special case for maverick, natty to avoid quilt version error( it seems, it is dh_make dpkg_build bug )
if [ "x@UBUNTU_CODENAME@" != "xlucid" ];then
rm -f ${package_folder}/debian/source/format
fi
if [ "${build_option}" = "launchpad" ]; then
( cd ${package_folder} && dpkg-buildpackage -rfakeroot -S ${pgp_key_option} )
echo "--------------------------------------------------------------------------------"
echo "upload to launchpad"
echo "--------------------------------------------------------------------------------"
changes_file="${package_name}_${managedflu_version}-${build_version}~@UBUNTU_CODENAME@_source.changes"
dput ppa:asimurzin/hh@OS_ARCHITECTURE@ ${changes_file}
fi
if [ "${build_option}" = "deb" ]; then
( cd ${package_folder} && dpkg-buildpackage -rfakeroot ${pgp_key_option} -b )
fi
#---------------------------------------------------------------------------------------