Ticket #12255: 0001-hvif2png-packaging.patch
File 0001-hvif2png-packaging.patch, 6.5 KB (added by , 9 years ago) |
---|
-
new file uild/scripts/build_hvif2png_rpm
From 795c5e70190bf12574f91cc0b49bb084e2ec2568 Mon Sep 17 00:00:00 2001 From: Andrew Lindesay <apl@lindesay.co.nz> Date: Wed, 29 Jul 2015 21:38:33 +1200 Subject: [PATCH] hvif2png: packaging - builds an rpm for use with linux - builds a tarball for use with *nix systems --- build/scripts/build_hvif2png_rpm | 101 +++++++++++++++++++++++++++++++++++ build/scripts/build_hvif2png_tarball | 80 +++++++++++++++++++++++++++ 2 files changed, 181 insertions(+) create mode 100755 build/scripts/build_hvif2png_rpm create mode 100755 build/scripts/build_hvif2png_tarball diff --git a/build/scripts/build_hvif2png_rpm b/build/scripts/build_hvif2png_rpm new file mode 100755 index 0000000..051f449
- + 1 #!/bin/sh 2 3 # -------------------------------------------- 4 # This script will create an RPM file for installing the hvif2png tool into a 5 # suitable RPM-based linux environment. This was build in order to support 6 # deployment along side the Haiku Depot Web application server. Note that 7 # The RPM will require libpng to be installed. A full build of Haiku may be 8 # required in order that the version 'href' is populated properly. 9 # The only argument to this script is the top of the build-products directory 10 # which is typically ".../haiku/generated". 11 # ------------------------------------------- 12 13 syntax() { 14 echo "build_hvif2png_rpm <generated-directory>" 15 exit 1 16 } 17 18 if [ $# -lt 1 ]; then 19 syntax 20 fi 21 22 if ! command -v rpmbuild > /dev/null; then 23 echo "unable to find the rpmbuild command to produce an rpm" 24 exit 1 25 fi 26 27 osName="$(echo `uname`| tr [:upper:] [:lower:])" 28 archName="$(uname -m)" 29 genDir="$1" 30 tmpDir="${genDir}/tmp/hvif2png_rpm" 31 version=`cat "${genDir}/build/haiku-revision" | sed -e "s/[^0-9]//g"` 32 33 if [ -z "${version}" ]; then 34 echo "the version was not able to be determined - it may be necessary to undertake a full build to get the version populated" 35 exit 1 36 fi 37 38 prepLeaf="hvif2png-${version}.1-1.${archName}" 39 40 echo "generating rpm from '${genDir}' for version '${version}'" 41 42 # create the RPM directories 43 44 for d in BUILD RPMS SOURCES SPECS SRPMS "BUILDROOT/${prepLeaf}/opt/hvif2png/bin" "BUILDROOT/${prepLeaf}/opt/hvif2png/lib" ; do 45 if ! mkdir -p "${tmpDir}/${d}" ; then 46 echo "unable to create the rpm working directory; ${tmpDir}/${d}" 47 exit 1 48 fi 49 done 50 51 # copy the necessary files into the right source directory 52 53 cp "${genDir}/objects/${osName}/lib/libbe_build.so" "${tmpDir}/BUILDROOT/${prepLeaf}/opt/hvif2png/lib" 54 cp "${genDir}/objects/${osName}/lib/libroot_build.so" "${tmpDir}/BUILDROOT/${prepLeaf}/opt/hvif2png/lib" 55 cp "${genDir}/objects/${osName}/${archName}/release/tools/hvif2png/hvif2png" "${tmpDir}/BUILDROOT/${prepLeaf}/opt/hvif2png/bin" 56 57 cat << EOF > "${tmpDir}/BUILDROOT/${prepLeaf}/opt/hvif2png/bin/hvif2png.sh" 58 #!/bin/sh 59 HVIF2PNG_HOME=/opt/hvif2png 60 export LD_LIBRARY_PATH=\${HVIF2PNG_HOME}/lib:${LD_LIBRARY_PATH} 61 \${HVIF2PNG_HOME}/bin/hvif2png "\$@" 62 EOF 63 64 # build the SPEC file. 65 66 cat << EOF > "${tmpDir}/SPECS/hvif2png.spec" 67 %define _unpackaged_files_terminate_build 0 68 Name: hvif2png 69 Version: ${version}.1 70 Release: 1 71 Summary: hvif2png 72 License: MIT 73 Group: haikuos 74 Packager: haikuos 75 autoprov: yes 76 autoreq: yes 77 BuildArch: ${archName} 78 BuildRoot: ${tmpDir} 79 80 %description 81 This tool allows HVIF formatted vector artwork to be rastered to PNG bitmap images. 82 83 %install 84 85 %files 86 %dir %attr(775,root,root) "/opt/hvif2png/lib" 87 %dir %attr(775,root,root) "/opt/hvif2png/bin" 88 %attr(444,root,root) "/opt/hvif2png/lib/libbe_build.so" 89 %attr(444,root,root) "/opt/hvif2png/lib/libroot_build.so" 90 %attr(755,root,root) "/opt/hvif2png/bin/hvif2png" 91 %attr(755,root,root) "/opt/hvif2png/bin/hvif2png.sh" 92 93 EOF 94 95 # now produce the RPM 96 97 if ! rpmbuild -vv -bb --buildroot "${tmpDir}/BUILDROOT/${prepLeaf}" --define "_topdir ${tmpDir}" "${tmpDir}/SPECS/hvif2png.spec"; then 98 echo "unable to create the rpm" 99 exit 1 100 fi 101 -
new file uild/scripts/build_hvif2png_tarball
diff --git a/build/scripts/build_hvif2png_tarball b/build/scripts/build_hvif2png_tarball new file mode 100755 index 0000000..584219f
- + 1 #!/bin/sh 2 3 # -------------------------------------------- 4 # This script will create an RPM file for installing the hvif2png tool into a 5 # suitable UNIX-like environment. The launch script will support the use of 6 # 'macports' on the MacOS-X environment in order to have access to the 7 # 'libpng' software. 8 # The only argument to this script is the top of the build-products directory 9 # which is typically ".../haiku/generated". 10 # -------------------------------------------- 11 12 syntax() { 13 echo "build_hvif2png_rpm <generated-directory>" 14 exit 1 15 } 16 17 if [ $# -lt 1 ]; then 18 syntax 19 fi 20 21 osName="$(echo `uname`| tr [:upper:] [:lower:])" 22 archName="$(uname -m)" 23 genDir="$1" 24 tmpDir="${genDir}/tmp/hvif2png_tarball" 25 version=`cat "${genDir}/build/haiku-revision"` 26 libPathVar="LD_LIBRARY_PATH" 27 28 if [ 'Darwin' == "$(uname)" ]; then 29 libPathVar="DYLD_FALLBACK_LIBRARY_PATH" 30 fi 31 32 if [ -z "${version}" ]; then 33 echo "the version was not able to be determined" 34 version='noversion' 35 fi 36 37 buildRootDir="${tmpDir}/hvif2png-${version}" 38 prepLeaf="hvif2png-${version}.1-1.${archName}" 39 40 echo "generating tarball from '${genDir}' for version '${version}'" 41 42 # create the build directories 43 for d in bin lib; do 44 if ! mkdir -p "${buildRootDir}/${d}" ; then 45 echo "unable to create the tarball working directory; ${d}" 46 exit 1 47 fi 48 done 49 50 # copy the necessary files into the right source directory 51 52 cp "${genDir}/objects/${osName}/lib/libbe_build.so" "${buildRootDir}/lib" 53 cp "${genDir}/objects/${osName}/lib/libroot_build.so" "${buildRootDir}/lib" 54 cp "${genDir}/objects/${osName}/${archName}/release/tools/hvif2png/hvif2png" "${buildRootDir}/bin" 55 56 cat << EOF > "${buildRootDir}/bin/hvif2png.sh" 57 #!/bin/sh 58 HVIF2PNG_HOME="\$(dirname \$0)/.." 59 ${libPathVar}=\${HVIF2PNG_HOME}/lib:\${${libPathVar}} 60 61 # support for MacOS-X macports 62 if [ -d /opt/local/lib ]; then 63 ${libPathVar}=\${${libPathVar}}:/opt/local/lib 64 fi 65 66 export ${libPathVar} 67 \${HVIF2PNG_HOME}/bin/hvif2png "\$@" 68 EOF 69 70 if ! chmod +x "${buildRootDir}/bin/hvif2png.sh"; then 71 echo "unable to change the permission on the launch script" 72 exit 1 73 fi 74 75 if ! tar -C "${tmpDir}" -czf "${genDir}/tmp/hvif2png-${version}-${archName}.tgz" "hvif2png-${version}" ; then 76 echo "unable to create the tarball" 77 exit 1 78 fi 79 80 echo "note that the libpng libraries must be available for the hvif2png software to work."