createPandocBundle.sh revision 2557:35017c286513
14Srgrimes#!/bin/bash -e 24Srgrimes# 34Srgrimes# Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. 44Srgrimes# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 54Srgrimes# 64Srgrimes# This code is free software; you can redistribute it and/or modify it 74Srgrimes# under the terms of the GNU General Public License version 2 only, as 84Srgrimes# published by the Free Software Foundation. Oracle designates this 94Srgrimes# particular file as subject to the "Classpath" exception as provided 104Srgrimes# by Oracle in the LICENSE file that accompanied this code. 114Srgrimes# 124Srgrimes# This code is distributed in the hope that it will be useful, but WITHOUT 134Srgrimes# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 144Srgrimes# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 154Srgrimes# version 2 for more details (a copy is included in the LICENSE file that 164Srgrimes# accompanied this code). 174Srgrimes# 184Srgrimes# You should have received a copy of the GNU General Public License version 194Srgrimes# 2 along with this work; if not, write to the Free Software Foundation, 204Srgrimes# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 214Srgrimes# 224Srgrimes# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 234Srgrimes# or visit www.oracle.com if you need additional information or have any 244Srgrimes# questions. 254Srgrimes# 264Srgrimes# Create a bundle in the current directory, containing what's needed to run 274Srgrimes# the 'pandoc' program by the OpenJDK build. 284Srgrimes 294SrgrimesTMPDIR=`mktemp -d -t pandocbundle-XXXX` 304Srgrimestrap "rm -rf \"$TMPDIR\"" EXIT 314Srgrimes 324SrgrimesORIG_DIR=`pwd` 334Srgrimescd "$TMPDIR" 344SrgrimesPANDOC_VERSION=1.17.2 354SrgrimesFULL_PANDOC_VERSION=1.17.2-1 364SrgrimesPACKAGE_VERSION=1.0 37621SrgrimesTARGET_PLATFORM=linux_x64 384473SbdeBUNDLE_NAME=pandoc-$TARGET_PLATFORM-$PANDOC_VERSION+$PACKAGE_VERSION.tar.gz 394Srgrimes 404Srgrimeswget https://github.com/jgm/pandoc/releases/download/$PANDOC_VERSION/pandoc-$FULL_PANDOC_VERSION-amd64.deb 41719Swollman 42719Swollmanmkdir pandoc 43719Swollmancd pandoc 444Srgrimesar p ../pandoc-$FULL_PANDOC_VERSION-amd64.deb data.tar.gz | tar xz 454Srgrimescd .. 464Srgrimes 474Srgrimes# Pandoc depends on libgmp.so.10, which in turn depends on libc. No readily 484Srgrimes# available precompiled binaries exists which match the requirement of 494Srgrimes# support for older linuxes (glibc 2.12), so we'll compile it ourselves. 504Srgrimes 514SrgrimesLIBGMP_VERSION=6.1.2 524Srgrimes 534Srgrimeswget https://gmplib.org/download/gmp/gmp-$LIBGMP_VERSION.tar.xz 544Srgrimesmkdir gmp 554Srgrimescd gmp 564Srgrimestar xf ../gmp-$LIBGMP_VERSION.tar.xz 574Srgrimescd gmp-$LIBGMP_VERSION 584Srgrimes./configure --prefix=$TMPDIR/pandoc/usr 594Srgrimesmake 604Srgrimesmake install 614Srgrimescd ../.. 624Srgrimes 634Srgrimescat > pandoc/pandoc << EOF 644Srgrimes#!/bin/bash 654Srgrimes# Get an absolute path to this script 664Srgrimesthis_script_dir=\`dirname \$0\` 671051Sdgthis_script_dir=\`cd \$this_script_dir > /dev/null && pwd\` 681051Sdgexport LD_LIBRARY_PATH="\$this_script_dir/usr/lib:\$LD_LIBRARY_PATH" 694Srgrimesexec \$this_script_dir/usr/bin/pandoc "\$@" 704SrgrimesEOF 714Srgrimeschmod +x pandoc/pandoc 724Srgrimestar -cvzf ../$BUNDLE_NAME pandoc 734Srgrimescp ../$BUNDLE_NAME "$ORIG_DIR" 744Srgrimes