/usr/bin/jh_makepkg is in javahelper 0.54ubuntu1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
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 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 | #!/bin/bash --
# options:
# make, maven, ant, byhand
# app, library
# gcj
COMPAT=8
STANDARDS=3.9.3
set -e
. /usr/share/javahelper/jh_lib.sh
syntax()
{
echo -e "Usage: jh_makepkg [options]"
echo -e "Options:"
echo -e "\t-h --help: show this text"
echo -e "\t-V --version: show the version"
echo -e "\t-p<name> --package=<name>: Set the name of the package (defaults to directory name without version)"
echo -e "\t-m<name> --maintainer=<name>: Set the maintainer name (defaults to DEBFULLNAME, NAME, or the user's full name)"
echo -e "\t-e<email> --email=<email>: Set the maintainer email (defaults to DEBEMAIL EMAIL or user@host)"
echo -e "\t-v<version> --upstream=<version>: Set the upstream version (defaults to the directory name after a -)"
echo -e "\t-c --clean: Tidy up common problems with Java source packages. Removes .class, .jar files and pre-built javadoc trees before creating the orig.tar.gz"
echo -e "\tPick One:"
echo -e "\t-l --library: This is a library package"
echo -e "\t-a --app: This is an application package"
echo -e "\tPick One:"
echo -e "\t-t --ant: Builds with ant"
echo -e "\t-M --maven: Builds with maven (deprecated, use mh_make instead)"
echo -e "\t-k --makefiles: Builds with make"
echo -e "\t-n --none: Create own buildsystem"
echo -e "\tPick One:"
echo -e "\t-g --gcj: Build with gcj"
echo -e "\t-d --default: Build with default free platform compiler"
echo -e "\t-o --openjdk: Build with openjdk 6"
echo -e "\t-o7 --openjdk7: Build with openjdk 7"
echo -e "Environment Variables:"
echo -e "\tDEBEMAIL: Default maintainer email address"
echo -e "\tEMAIL: Default maintainer email address"
echo -e "\tDEBFULLNAME: Default maintainer name"
echo -e "\tNAME: Default maintainer name"
exit 1
}
maven_not_supported()
{
echo "Sorry, but jh_makepkg is not good at generating package templates" >&2
echo "for maven based packages." >&2
echo >&2
echo "Please consider using mh_make instead" >&2
exit 1
}
ARGS="c clean p package m maintainer e email v upstream l library a app t ant k makefile n none g gcj o openjdk o7 openjdk7 M maven d default" parseargs "$@"
if [ -n "`getarg M maven`" ]; then
maven_not_supported
fi
BUILDDIR="`pwd`"
if [ -z "`getarg v upstream`" ]; then
VERSION="`basename "$BUILDDIR" | sed -n 's/^.*-//p'`"
else
VERSION="`getarg v upstream`"
fi
if [ -z "`getarg p package`" ]; then
PACKAGE="`basename "$BUILDDIR" | sed -n 's/\(-.*\)\{0,1\}$//p'`"
else
PACKAGE="`getarg p package`"
fi
if [ -z "$VERSION" ]; then
echo "Can't determine version from directory name `basename "$BUILDDIR"`, maybe it is not in the form package-version?"
exit 1
fi
if [ -z "$PACKAGE" ]; then
echo "Can't determine package name from directory name `basename "$BUILDDIR"`, maybe it is not in the form package-version?"
exit 1
fi
if [ ! -f ../${PACKAGE}_${VERSION}.orig.tar.gz ]; then
if [ -n "`getarg c clean`" ]; then
echo "Cleaning up source tree before creating orig.tar.gz"
find . -name '*.class' -print0 | xargs -0 rm -f
find . -name '*.jar' -print0 | xargs -0 rm -f
IFS='
'
for doctree in `find . -name allclasses-frame.html`; do
TREE="`dirname $doctree`"
rm -rf "$TREE"/*
done
find * -type d -print0 | xargs -0 rmdir -p --ignore-fail-on-non-empty
fi
echo "Creating package $PACKAGE version $VERSION."
echo
echo "Building from source in $BUILDDIR"
cd ..
echo "Creating orig source tarball: ${PACKAGE}_${VERSION}.orig.tar.gz"
tar zcf "${PACKAGE}_${VERSION}.orig.tar.gz" "`basename "$BUILDDIR"`"
cd "$BUILDDIR"
fi
if [ -n "`getarg e email`" ]; then
DEBEMAIL="`getarg e email`"
fi
if [ -z "$DEBEMAIL" ]; then
DEBEMAIL="$EMAIL"
fi
if [ -z "$DEBEMAIL" ] && [ -f /etc/mailname ]; then
DEBEMAIL="`whoami`@`cat /etc/mailname`"
fi
if [ -z "$DEBEMAIL" ]; then
DEBEMAIL="`whoami`@`hostname --fqdn`"
fi
if [ -n "`getarg m maintainer`" ]; then
DEBFULLNAME="`getarg m maintainer`"
fi
if [ -z "$DEBFULLNAME" ]; then
DEBFULLNAME="$NAME"
fi
if [ -z "$DEBFULLNAME" ] ; then
DEBFULLNAME="$(getent passwd $(whoami) | cut -d: -f5 | cut -d, -f1)"
fi
echo "Packager: $DEBFULLNAME <$DEBEMAIL>"
echo
if [ -n "`getarg a app`" ]; then
TYPE="app"
elif [ -n "`getarg l library`" ]; then
TYPE="lib"
else
echo "What type of package is it? Application, or Library?"
echo "Select:"
echo -e "\t[A] Application (Default)"
echo -e "\t[L] Library"
echo -n "[Al] $ "
read t
echo
case $t in
"L"|"l")
TYPE="lib"
echo "Selected: Library"
;;
*)
TYPE="app"
echo "Selected: Application"
;;
esac
fi
case $TYPE in
"app")
SECTION=misc
SRCPACKAGE="$PACKAGE"
BINPACKAGE="$PACKAGE"
;;
"lib")
SECTION=java
SRCPACKAGE="$PACKAGE"
BINPACKAGE="$PACKAGE"
if ! echo $BINPACKAGE | grep "^lib" >/dev/null; then
BINPACKAGE="lib$BINPACKAGE"
fi
if ! echo $BINPACKAGE | grep -- "-java$" >/dev/null; then
BINPACKAGE="$BINPACKAGE-java"
fi
;;
esac
if [ -n "`getarg t ant`" ]; then
BUILD="ant"
elif [ -n "`getarg k makefiles`" ]; then
BUILD="make"
elif [ -n "`getarg n none`" ]; then
BUILD="byhand"
else
echo "What type of build system does it have? Ant, Makefiles, or None?"
echo "Select:"
echo -e "\t[A] Ant"
echo -e "\t[M] Makefiles"
echo -e "\t[V] Maven"
echo -e "\t[N] None---make one for me (Default)"
echo -n "[Namv] $ "
read t
echo
case $t in
"A"|"a")
BUILD="ant"
echo "Selected: Ant"
;;
"M"|"m")
BUILD="make"
echo "Selected: Makefiles"
;;
"V"|"v")
BUILD="maven"
echo "Selected: Maven"
;;
*)
BUILD="byhand"
echo "Selected: No upstream build system"
;;
esac
fi
case $BUILD in
"make")
;;
"ant")
DEPENDS="$DEPENDS, ant"
;;
"maven")
maven_not_supported
;;
"byhand")
;;
esac
if [ -n "`getarg d default`" ]; then
COMP="default"
elif [ -n "`getarg g gcj`" ]; then
COMP="gcj"
elif [ -n "`getarg o openjdk`" ]; then
COMP="open"
elif [ -n "`getarg o7 openjdk7`" ]; then
COMP="open7"
else
echo "Which Java runtime does it need? Which free runtime?"
echo "Select:"
echo -e "\t[F] Default Free compiler/runtime (Default)"
echo -e "\t[G] GCJ"
echo -e "\t[o] OpenJDK 6"
echo -e "\t[o7] OpenJDK 7"
echo -n "[FGoo7] $ "
read t
echo
case $t in
"O"|"o")
COMP="open"
echo "Selected: OpenJDK 6"
;;
"O7"|"o7")
COMP="open7"
echo "Selected: OpenJDK 7"
;;
"g"|"G")
COMP="gcj"
echo "Selected: GCJ"
;;
*)
COMP="default"
echo "Selected: Default Free compiler"
;;
esac
fi
case $COMP in
"gcj")
COMPILER=gcj-jdk
JAVA_HOME=/usr/lib/jvm/java-gcj
;;
"default")
COMPILER=default-jdk
JAVA_HOME=/usr/lib/jvm/default-java
;;
"open")
COMPILER=openjdk-6-jdk
JAVA_HOME="/usr/lib/jvm/java-6-openjdk-\$(shell dpkg-architecture -qDEB_HOST_ARCH)"
JVM=open
;;
"open7")
COMPILER=openjdk-7-jdk
JAVA_HOME="/usr/lib/jvm/java-7-openjdk-\$(shell dpkg-architecture -qDEB_HOST_ARCH)"
JVM=open7
;;
esac
YEAR=$(date +%Y)
mkdir -p debian
mkdir debian/source
echo '3.0 (quilt)' > debian/source/format
cat > debian/control <<END
Source: $SRCPACKAGE
Section: ${CONTRIB}$SECTION
Priority: optional
Maintainer: $DEBFULLNAME <$DEBEMAIL>
Build-Depends: debhelper (>= $COMPAT), $COMPILER, javahelper (>= $JAVATOOLS_VERSION) $DEPENDS
Standards-Version: $STANDARDS
Homepage: <homepage>
Package: $BINPACKAGE
Architecture: all
Depends: \${java:Depends}, \${misc:Depends}
Recommends: \${java:Recommends}
Description: Short Description
Long Description
END
if [ "$TYPE" = "lib" ] ; then
# add doc package template
cat >> debian/control <<END
Package: $BINPACKAGE-doc
Architecture: all
Section: doc
Depends: \${java:Depends}, \${misc:Depends}
Recommends: \${java:Recommends}
Description: Short Description - doc
Long Description
.
This package contains the Javadoc API
END
fi
cat > debian/copyright <<END
Format: [URI OF THE FORMAT SPECIFICATION, SUCH AS http://www.debian.org/doc/packaging-manuals/copyright-format/<VERSION>/]
Upstream-Name: [THE NAME UPSTREAM USES FOR THE SOFTWARE]
Upstream-contact: [THE PREFERRED ADDRESS(ES) TO REACH THE UPSTREAM PROJECT]
Source: [AN EXPLANATION FROM WHERE THE UPSTREAM SOURCE CAME FROM. TYPICALLY AN URL]
[OTHER FIELDS]
Files: *
Copyright: Copyright $YEAR John Doe <jdoe@example.com>
License: [STANDARD ABBREVIATION -- SEE "Short names" SECTION OF SPECIFICATION]
[LICENSE TEXT]
Files: debian/*
Copyright: Copyright $YEAR $DEBFULLNAME <$DEBEMAIL>
License: [STANDARD ABBREVIATION]
[LICENSE TEXT]
[OTHER FILE PARAGRAPHS]
END
echo $COMPAT > debian/compat
EDITOR=true DEBFULLNAME="$DEBFULLNAME" DEBEMAIL="$DEBEMAIL" dch --create --package $SRCPACKAGE --newversion ${VERSION}-1 --distribution unstable --urgency low
cat > debian/rules <<END
#!/usr/bin/make -f
export JAVA_HOME=${JAVA_HOME}
# Put depended upon jars in here
# export CLASSPATH=
%:
dh \$@ --with javahelper
END
case $BUILD in
"ant")
;;
"maven")
cat >> debian/rules <<END
override_dh_auto_build:
# Build the package
mvn-debian build
override_dh_auto_clean:
mvn-debian clean
END
;;
"make")
;;
"byhand")
echo ${SRCPACKAGE}.jar src > debian/javabuild
;;
esac
case $TYPE in
"app")
echo "$SRCPACKAGE.jar usr/share/$BINPACKAGE" > debian/$BINPACKAGE.install
cat >> debian/$BINPACKAGE.manifest <<END
usr/share/$BINPACKAGE/$SRCPACKAGE.jar:
Main-Class: <Main Class>
Debian-Java-Home: $JAVA_HOME
END
echo "usr/share/$BINPACKAGE/$SRCPACKAGE.jar usr/bin/$SRCPACKAGE" > debian/$BINPACKAGE.links
;;
"lib")
echo "$SRCPACKAGE.jar" > debian/$BINPACKAGE.jlibs
if [ "$BUILD" = "byhand" ]; then
echo "internal" > debian/$BINPACKAGE-doc.javadoc
else
echo "<javadoc build dir here>" > debian/$BINPACKAGE-doc.javadoc
fi
;;
esac
chmod +x debian/rules
echo "Packaging created. You will have to edit most or all of the files in debian/ before it works"
|