Skip to content

Commit

Permalink
First release
Browse files Browse the repository at this point in the history
  • Loading branch information
Ahti Nurminen committed Apr 24, 2018
1 parent 2c513f8 commit 77d66b2
Show file tree
Hide file tree
Showing 5 changed files with 76 additions and 0 deletions.
21 changes: 21 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -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"
44 changes: 44 additions & 0 deletions bin/compile
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#!/usr/bin/env bash
# bin/compile <build-dir> <cache-dir> <env-dir>

### 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/
5 changes: 5 additions & 0 deletions bin/detect
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/sh

# this pack is valid for all apps
echo "curl"
exit 0
2 changes: 2 additions & 0 deletions bin/release
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/sh
echo "--- {}"
4 changes: 4 additions & 0 deletions profile/curl_libssh2.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash

export PATH=$HOME/vendor/bin:$PATH
export LD_LIBRARY_PATH=$HOME/vendor/lib:$LD_LIBRARY_PATH

0 comments on commit 77d66b2

Please sign in to comment.