From 77d66b2249634e818b6e8f74252ba9fcc4d62441 Mon Sep 17 00:00:00 2001 From: Ahti Nurminen Date: Tue, 24 Apr 2018 09:37:15 +0300 Subject: [PATCH] First release --- README.md | 21 ++++++++++++++++++++ bin/compile | 44 +++++++++++++++++++++++++++++++++++++++++ bin/detect | 5 +++++ bin/release | 2 ++ profile/curl_libssh2.sh | 4 ++++ 5 files changed, 76 insertions(+) create mode 100644 README.md create mode 100755 bin/compile create mode 100755 bin/detect create mode 100755 bin/release create mode 100644 profile/curl_libssh2.sh diff --git a/README.md b/README.md new file mode 100644 index 0000000..ffa4617 --- /dev/null +++ b/README.md @@ -0,0 +1,21 @@ +Heroku buildpack: curl with sftp (libssh2) support +================================================== + +This is a [Heroku buildpack](http://devcenter.heroku.com/articles/buildpacks) that replaces the Ubuntu default `curl` and `libcurl` with a latest compiled version including ssl and libssh2 packages. +Purpose for this addition is to enable using sftp with curl from PHP application via autheticating Proxy like QuotaGuard or Fixie. + +Usage +----- + +See Heroku's documentation on [multiple buildpacks](https://devcenter.heroku.com/articles/using-multiple-buildpacks-for-an-app). + +Example usage for a PHP app: + + $ heroku buildpacks:set https://github.com/heroku/heroku-buildpack-php.git + $ heroku buildpacks:add https://github.com/frcade/heroku-buildpack-curl-libssh2.git --index 1 + $ git push heroku master + ... + +You can verify the installation using the following command: + + $ heroku run "curl --version" diff --git a/bin/compile b/bin/compile new file mode 100755 index 0000000..f8a230c --- /dev/null +++ b/bin/compile @@ -0,0 +1,44 @@ +#!/usr/bin/env bash +# bin/compile + +### Configure environment + +set -o errexit # always exit on error +set -o pipefail # don't ignore exit codes when piping output +unset GIT_DIR # Avoid GIT_DIR leak from previous build steps + +### Formatting utilities + +indent() { + sed -u 's/^/ /' +} + +### Constants + +CURL_VERSION=7.58.0 + +### Configure directories + +BUILD_DIR=${1:-} +CACHE_DIR=${2:-} +ENV_DIR=${3:-} +BP_DIR=$(cd $(dirname ${0:-}); cd ..; pwd) + +### Download, make and install + +echo "-----> Downloading curl $CURL_VERSION" +DOWNLOAD_URL="http://archive.ubuntu.com/ubuntu/pool/main/c/curl/curl_$CURL_VERSION.orig.tar.gz" +curl -sL "$DOWNLOAD_URL" > curl_$CURL_VERSION.orig.tar.gz 2>&1 | indent +tar -xf curl_$CURL_VERSION.orig.tar.gz +pushd curl-$CURL_VERSION +echo "-----> Configuring curl with ssl and libssh2" +./configure --prefix=$BUILD_DIR/vendor --with-ssl --with-libssh2 2>&1 | indent +echo "-----> Building curl" +make 2>&1 | indent +echo "-----> Installing curl" +make install 2>&1 | indent +popd + +echo "-----> Setting up environment" +mkdir -p $BUILD_DIR/.profile.d +cp $BP_DIR/profile/* $BUILD_DIR/.profile.d/ diff --git a/bin/detect b/bin/detect new file mode 100755 index 0000000..fb3bb0f --- /dev/null +++ b/bin/detect @@ -0,0 +1,5 @@ +#!/bin/sh + +# this pack is valid for all apps +echo "curl" +exit 0 diff --git a/bin/release b/bin/release new file mode 100755 index 0000000..df2858b --- /dev/null +++ b/bin/release @@ -0,0 +1,2 @@ +#!/bin/sh +echo "--- {}" diff --git a/profile/curl_libssh2.sh b/profile/curl_libssh2.sh new file mode 100644 index 0000000..59fc1ad --- /dev/null +++ b/profile/curl_libssh2.sh @@ -0,0 +1,4 @@ +#!/bin/bash + +export PATH=$HOME/vendor/bin:$PATH +export LD_LIBRARY_PATH=$HOME/vendor/lib:$LD_LIBRARY_PATH