Unverified Commit 2176744c authored by Diego Hernandes's avatar Diego Hernandes
Browse files

php 7.3 rc

parent 03db623e
ALPINE_VERSION=3.7
ALPINE_VERSION=3.8
PHP_VERSION=7.2
APK_PACKAGER="Diego Hernandes <diego@hernandev.com>"
APK_MAINTAINER="Diego Hernandes <diego@hernandev.com>"
APK_PACKAGER="Diego Hernandes <iamhernandev@gmail.com>"
APK_MAINTAINER="Diego Hernandes <iamhernandev@gmail.com>"
docs/building-and-or-contributing.md
\ No newline at end of file
#!/usr/bin/env bash
# source environment variables for the time being.
source ./.env
# determine task to build.
TASK=${1}
# fallback to help if no task was provided.
if [[ -z "${TASK}" ]]; then
TASK="help"
fi
# build sandbox
if [[ ${TASK} == "sandbox" ]]; then
docker-compose build sandbox
fi
# build sandbox
if [[ ${TASK} == "shell" ]]; then
docker-compose run sandbox bash
fi
# build dependencies and extensions.
if [[ ${TASK} == "build" ]]; then
docker-compose run sandbox ./build.sh --full
fi
# build dependencies and extensions.
if [[ ${TASK} == "extensions" ]]; then
docker-compose run sandbox ./build.sh
fi
......@@ -40,7 +40,7 @@ services:
- "php-alpine-cache-edge:/var/cache/apk"
# sandbox for building on alpine edge.
base-images:
starter-images:
# target image.
image: "codecasts/alpine-${ALPINE_VERSION}:php-${PHP_VERSION}"
build:
......
......@@ -3,7 +3,20 @@
This document includes simple instructions for building the packages at your own and/or locally testing for
contributions on the project.
### Required Tools.
You must have present on the host system:
- docker-compose
- make (GNU make)
- Docker (latest preferable)
### TL;DR
You can browse Makefile scripts to have a general idea of the build process, if you don't want to read this full guide.
Although is very recommended.
### Security.
For obvious reasons, the Alpine packaging private key, used to sign packages on this repository
......@@ -56,7 +69,7 @@ To actually build the PHP packages, first we need to enter the sandbox environme
Run the sandbox with the following command:
```
env (cat .env) docker-compose run sandbox bash
env $(cat .env) docker-compose run sandbox bash
```
After entering the sandbox, you will notice two folders on `/home/sandbox`:
......
{
"name": "@codecasts/php-alpine",
"version": "0.0.1",
"description": "PHP Packages for Alpine Linux.",
"main": "invalid.js",
"directories": {
"doc": "docs"
},
"scripts": {
"clean": "find ./scripts -type d | grep -e 'php7-[a-z]' | xargs -I {a} rm -rf {a}/src",
"sandbox:build": "source ./.env && docker-compose build sandbox",
"sandbox": "source ./.env && docker-compose run sandbox bash",
"build": "source ./.env && docker-compose run sandbox ./build.sh",
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "git+https://github.com/codecasts/php-alpine.git"
},
"keywords": [
"php",
"alpine",
"linux"
],
"author": "Diego Hernandes <iamhernandev@gmail.com>",
"license": "MIT",
"bugs": {
"url": "https://github.com/codecasts/php-alpine/issues"
},
"homepage": "https://github.com/codecasts/php-alpine#readme"
}
......@@ -15,7 +15,6 @@ ARG ALPINE_VERSION
ARG PHP_VERSION
ARG APK_PACKAGER
ARG APK_MAINTAINER
#ARG APK_PUB_KEY
# ADD SDK AND BASIC TOOLS.
RUN apk add --update alpine-sdk sudo git bash nano
......@@ -27,6 +26,7 @@ RUN echo "http://dl-cdn.alpinelinux.org/alpine/v${ALPINE_VERSION}/main" > /etc/a
# ADD THE START SCRIPT.
ADD start.sh /bin/start.sh
ADD bashrc /home/sandbox/.bashrc
# ADD THE PUBLIC KEY FOR REPOS.
# COPY ${APK_PUB_KEY} /etc/apk/keys/php-alpine.rsa.pub
......@@ -42,6 +42,12 @@ RUN adduser -D -u 1000 sandbox && \
sed -i "/#MAINTAINER=.*/c\MAINTAINER=\"${APK_MAINTAINER}\"" /etc/abuild.conf && \
chown -R sandbox:sandbox /home/sandbox
# generate build env vars.
RUN echo "ALPINE_VERSION=${ALPINE_VERSION}" >> /home/sandbox/.build_env && \
echo "PHP_VERSION=${PHP_VERSION}" >> /home/sandbox/.build_env && \
echo "APK_PACKAGER=${APK_PACKAGER}" >> /home/sandbox/.build_env && \
echo "APK_MAINTAINER=${APK_MAINTAINER}" >> /home/sandbox/.build_env
# REMOVE TEMP FILES.
RUN mkdir -p /var/cache/apk && \
ln -s /var/cache/apk /etc/apk/cache
......@@ -56,7 +62,7 @@ USER sandbox
ENTRYPOINT ["/bin/start.sh"]
# START ON SANDBOX USER HOME.
WORKDIR "/home/sandbox"
WORKDIR "/home/sandbox/php-${PHP_VERSION}"
# START WITH BASH.
CMD ["/bin/bash"]
\ No newline at end of file
# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples
# If not running interactively, don't do anything
case $- in
*i*) ;;
*) return;;
esac
# don't put duplicate lines or lines starting with space in the history.
# See bash(1) for more options
HISTCONTROL=ignoreboth
# append to the history file, don't overwrite it
shopt -s histappend
# for setting history length see HISTSIZE and HISTFILESIZE in bash(1)
HISTSIZE=1000
HISTFILESIZE=2000
# check the window size after each command and, if necessary,
# update the values of LINES and COLUMNS.
shopt -s checkwinsize
# If set, the pattern "**" used in a pathname expansion context will
# match all files and zero or more directories and subdirectories.
#shopt -s globstar
# make less more friendly for non-text input files, see lesspipe(1)
[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"
# set variable identifying the chroot you work in (used in the prompt below)
if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then
debian_chroot=$(cat /etc/debian_chroot)
fi
# set a fancy prompt (non-color, unless we know we "want" color)
case "$TERM" in
xterm-color|*-256color) color_prompt=yes;;
esac
# uncomment for a colored prompt, if the terminal has the capability; turned
# off by default to not distract the user: the focus in a terminal window
# should be on the output of commands, not on the prompt
#force_color_prompt=yes
if [ -n "$force_color_prompt" ]; then
if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
# We have color support; assume it's compliant with Ecma-48
# (ISO/IEC-6429). (Lack of such support is extremely rare, and such
# a case would tend to support setf rather than setaf.)
color_prompt=yes
else
color_prompt=
fi
fi
if [ "$color_prompt" = yes ]; then
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
else
PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
fi
unset color_prompt force_color_prompt
# If this is an xterm set the title to user@host:dir
case "$TERM" in
xterm*|rxvt*)
PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1"
;;
*)
;;
esac
# enable color support of ls and also add handy aliases
if [ -x /usr/bin/dircolors ]; then
test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
alias ls='ls --color=auto'
#alias dir='dir --color=auto'
#alias vdir='vdir --color=auto'
alias grep='grep --color=auto'
alias fgrep='fgrep --color=auto'
alias egrep='egrep --color=auto'
fi
# colored GCC warnings and errors
#export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01'
# some more ls aliases
alias ll='ls -alF'
alias la='ls -A'
alias l='ls -CF'
# Add an "alert" alias for long running commands. Use like so:
# sleep 10; alert
alias alert='notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e '\''s/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//'\'')"'
# Alias definitions.
# You may want to put all your additions into a separate file like
# ~/.bash_aliases, instead of adding them here directly.
# See /usr/share/doc/bash-doc/examples in the bash-doc package.
if [ -f ~/.bash_aliases ]; then
. ~/.bash_aliases
fi
# enable programmable completion features (you don't need to enable
# this, if it's already enabled in /etc/bash.bashrc and /etc/profile
# sources /etc/bash.bashrc).
if ! shopt -oq posix; then
if [ -f /usr/share/bash-completion/bash_completion ]; then
. /usr/share/bash-completion/bash_completion
elif [ -f /etc/bash_completion ]; then
. /etc/bash_completion
fi
fi
\ No newline at end of file
......@@ -9,28 +9,10 @@ sudo chmod u=rw,go=r /etc/apk/keys/php-alpine.rsa.pub
# fix owner permissions.
sudo chown -R sandbox:sandbox /home/sandbox
# update packages index before attempting any builds.
sudo apk update
# source env files generated during docker build.
if [ -f ~/.build_env ]; then
. ~/.build_env
fi
# run the original command
exec "$@"
## DECLARE ALPINE VERSION TO START.
#ALPINE_VERSION=$1
#
## DECLARE PHP VERSION TO START.
#PHP_VERSION=$2
#
## ENSURE DIRECTORY EXISTS.
#mkdir -p $(pwd)/.abuild
#mkdir -p $(pwd)/repo/$ALPINE_VERSION/$PHP_VERSION
#
## START SANDBOX CONTAINER.
#docker run -it --rm \
# --init \
# -e PHP_VERSION=$PHP_VERSION \
# -v $(pwd)/scripts/$ALPINE_VERSION/$PHP_VERSION:/home/sandbox/$PHP_VERSION \
# -v $(pwd)/.abuild:/home/sandbox/.abuild \
# -v $(pwd)/repo/$ALPINE_VERSION/$PHP_VERSION:/home/sandbox/packages/$PHP_VERSION \
# -v $(pwd)/cache/$ALPINE_VERSION:/var/cache/apk \
# codecasts/php-alpine:$ALPINE_VERSION
\ No newline at end of file
#!/bin/bash
# SUB-PACKAGES TO BUILD
PACKAGES="argon2 secp256k1 php7-apcu php7-imagick php7-libsodium php7-memcached php7-mongodb php7-redis php7-secp256k1 php7-ssh2 php7-xdebug"
# ROOT PATH
ROOT_PATH=$(pwd)
# cd $ROOT_PATH/php7
# abuild -r
for PACKAGE in $PACKAGES; do
echo "----> Building $PACKAGE"
sudo apk update
cd $ROOT_PATH/$PACKAGE
abuild checksum
abuild -r
done
# RETURN TO ROOT PATH.
cd $ROOT_PATH
#!/usr/bin/env bash
# dependencies to build.
PACKAGES="argon2 secp256k1"
# extensions to build.
EXTENSIONS="apcu imagick libsodium memcached mongodb redis secp256k1 ssh2 xdebug"
# define root packages source path.
SOURCES_PATH=$(pwd)
# ensure starts on sources path.
cd ${SOURCES_PATH}
# function for building packages.
function build_package()
{
# alias package name from function input.
PACKAGE_NAME=${1}
# ensure previously built packages are available.
sudo apk update
# enter package source directory.
cd "$SOURCES_PATH/$PACKAGE_NAME"
# give a little feedback about the current package being built.
echo "----> Building Package: $PACKAGE_NAME"
# checksum source files before build.
abuild checksum
# build the package from source.
abuild -r
# return shell to previous location for safe scripting!
cd ${SOURCES_PATH}
}
# build base packages.
for PACKAGE in ${PACKAGES}; do
# call the build function.
build_package ${PACKAGE}
done
# when full flag is provided, build PHP itself first.
if [ "$1" == "--full" ]; then
# call the build function.
build_package "php7"
fi
# build extensions.
for EXTENSION in ${EXTENSIONS}; do
# call the build function, prefixing with "php7-".
build_package "php7-"${EXTENSION}
done
# ensure the final destination is the sources path.
cd ${SOURCES_PATH}
\ No newline at end of file
......@@ -5,7 +5,7 @@
pkgname=php7
_pkgreal=php
pkgver=7.2.9
pkgver=7.2.11
pkgrel=100
pkgdesc="The PHP language runtime engine - 7th branch"
url="http://www.php.net/"
......@@ -351,7 +351,7 @@ _package_ext() {
> "$subpkgdir"/etc/$pkgname/conf.d/${elo}_${extname}.ini
}
sha512sums="45ff1b090646d3d8516250c88951d797831dc449aad15c809995462c7df72c347a4012578d0c923a036aaebd761844bfc6804639f21e386e53fe68b0445b091a php-7.2.9.tar.bz2
sha512sums="a6bdd639648ae7845467e01303d0b4f4b85fd541409be97a5a605e91a9c994609e4e221a9c87c576134e66a2439920486d1f444e6fe8c34b0e5d025cee6d0cc8 php-7.2.11.tar.bz2
5b45e3f76579c064e7393a080584515d4c70071cd028cd9292885c741ddc78731633082cf1808b34bbe2e54575caa4c6fcfb3da05f54a26f0848a5e1709492ac php7-fpm.initd
100434b8cecaa01a86cc8be56434db1c2dd3c49b7ae397a58b8ecad06a4eb5453e05412e20df1fa26468d6df6c4260f7c3c2b4b4c6f099ffec006bcc0c29cc3c php7-fpm.logrotate
7893c2c4507191ce39fa0813c0119ccb8394dbc5ec0092faea34d6494459c697f70536f19a4c7b767aa1a8c587fe49768b552e3b55a1fc11a1e66f267e0b605e php7-module.conf
......
......@@ -48,4 +48,4 @@ package() {
find "$pkgdir" -type f -name .gitignore -exec rm -r '{}' +
}
sha512sums="18866d966aaebeec5fa11635ffbbb39ba7d2298350349c5edddf81e3e7675a902b804d0540bf9866186cfc7b0d94000e9358e95f4d6b22044ed51cb940d474e1 secp256k1-20180409.zip"
sha512sums="fa71c1bcc4490e74405c8abfcb858f65fbb1e5d5de0bf00b1c873666c65119585082e35c7291afed1ee42ee28967b26e6a3344d72eb7c5cf69eaf749ee04b3f8 secp256k1-20180409.zip"
# This package is being back-ported to support PHp 7.2 Argon2 password_hash() algo.
# Original file: https://github.com/alpinelinux/aports/blob/master/testing/argon2/APKBUILD
# Any license indication here contained takes lesser precedence than the original
# licenses on the official sources. It's just a backport.
# Contributor: Corey Oliver <coreyjonoliver@gmail.com>
# Maintainer: Corey Oliver <coreyjonoliver@gmail.com>
pkgname=argon2
_pkgname=phc-winner-argon2
pkgver=20171227
provides="php-argon2=7.3"
_soname=0.0.0
pkgrel=0
pkgdesc="The password hash Argon2, winner of PHC"
url="https://github.com/P-H-C/phc-winner-argon2"
arch="all !armhf"
license="Apache-2.0 CC0-1.0"
subpackages="$pkgname-dev libargon2"
source="$pkgname-$pkgver.tar.gz::https://github.com/P-H-C/$_pkgname/archive/$pkgver.tar.gz"
builddir="$srcdir/$_pkgname-$pkgver"
build() {
cd "$builddir"
make && make test
}
package() {
cd "$builddir"
make DESTDIR="$pkgdir" install || return 1
# A version number is not appended to the shared library file by default, so we do it ourselves
mv "$pkgdir"/usr/lib/libargon2.so "$pkgdir"/usr/lib/libargon2.so.$_soname || return 1
ln -s libargon2.so.$_soname "$pkgdir"/usr/lib/libargon2.so || return 1
ln -s libargon2.so.$_soname "$pkgdir"/usr/lib/libargon2.so.${_soname%%.*} || return 1
}
libargon2() {
pkgdesc="The password hash Argon2 library, winner of PHC"
mkdir -p "$subpkgdir"/usr
mv "$pkgdir"/usr/lib "$subpkgdir"/usr
}
sha512sums="9c9e1a3905e61ac6913d1e073c104477e419ddd0506adc4487e88e98d19165ed8901fe8bb11246ed0cc71b3523c190da9692d5926642f86be09c3e67510afe4d argon2-20171227.tar.gz"
#!/usr/bin/env bash
# dependencies to build.
PACKAGES="argon2 secp256k1"
# extensions to build.
EXTENSIONS="apcu imagick libsodium memcached mongodb redis secp256k1 ssh2 xdebug"
# define root packages source path.
SOURCES_PATH=$(pwd)
# ensure starts on sources path.
cd ${SOURCES_PATH}
# function for building packages.
function build_package()
{
# alias package name from function input.
PACKAGE_NAME=${1}
# ensure previously built packages are available.
sudo apk update
# enter package source directory.
cd "$SOURCES_PATH/$PACKAGE_NAME"
# give a little feedback about the current package being built.
echo "----> Building Package: $PACKAGE_NAME"
# checksum source files before build.
abuild checksum
# build the package from source.
abuild -r
# return shell to previous location for safe scripting!
cd ${SOURCES_PATH}
}
# build base packages.
for PACKAGE in ${PACKAGES}; do
# call the build function.
build_package ${PACKAGE}
done
# when full flag is provided, build PHP itself first.
if [ "$1" == "--full" ]; then
# call the build function.
build_package "php7"
fi
# build extensions.
for EXTENSION in ${EXTENSIONS}; do
# call the build function, prefixing with "php7-".
build_package "php7-"${EXTENSION}
done
# ensure the final destination is the sources path.
cd ${SOURCES_PATH}
\ No newline at end of file
/src
\ No newline at end of file
# Maintainer: "Diego Hernandes <diego@hernandev.com>"
pkgname=php7-apcu
_pkgreal=apcu
pkgver=5.1.12
pkgrel=0
_phpver=7
provides="php-apcu=7.3"
pkgdesc="APCu - APC User Cache extension for PHP"
url="http://pecl.php.net/package/$_pkgreal"
arch="all"
license="PHP-3"
depends="php7-common>=7.2.0 php7-common<7.3.0"
makedepends="php7-dev>=7.2.0 php7-dev<7.3.0 autoconf pcre-dev"
source="http://pecl.php.net/get/$_pkgreal-$pkgver.tgz"
builddir="$srcdir/$_pkgreal-$pkgver"
prepare() {
default_prepare || return 1
}
build() {
cd "$builddir"
phpize$_phpver || return 1
./configure --prefix=/usr \
--with-php-config=/usr/bin/php-config$_phpver || return 1
make || return 1
}
package() {
mkdir -p "$pkgdir" || return 1
install -d $pkgdir/ || return 1
make -C "$builddir" INSTALL_ROOT="$pkgdir" install || return 1
install -d "$pkgdir"/etc/php$_phpver/conf.d || return 1
echo "extension=$_pkgreal" > "$pkgdir"/etc/php$_phpver/conf.d/00_$_pkgreal.ini || return 1
}
sha512sums="f53b7840d5aecfc899e3e878f0bb9a5dc4a83628543963c20c25ce2b2a2adf14dd40d39a6a2014c139962453e0e9e5038fca7b1d0be205c0b9b2aa6e3fefb054 apcu-5.1.12.tgz"
/src
\ No newline at end of file
# Maintainer: "Diego Hernandes <diego@hernandev.com>"
pkgname=php7-imagick
_pkgreal=imagick
pkgver=3.4.3
pkgrel=0
_phpver=7
provides="php-imagick=7.3"
pkgdesc="ImageMagick extension for PHP"
url="http://pecl.php.net/package/$_pkgreal"
arch="all"
license="PHP-3"
depends="php7-common>=7.2.0 php7-common<7.3.0 imagemagick"
makedepends="php7-dev>=7.2.0 php7-dev<7.3.0 autoconf imagemagick-dev libtool pcre-dev"
source="http://pecl.php.net/get/$_pkgreal-$pkgver.tgz"
builddir="$srcdir/$_pkgreal-$pkgver"
prepare() {
default_prepare || return 1
}
build() {
cd "$builddir"
phpize$_phpver || return 1
./configure --prefix=/usr \
--with-php-config=/usr/bin/php-config$_phpver || return 1
make || return 1
}
package() {
mkdir -p "$pkgdir" || return 1
install -d $pkgdir/ || return 1
make -C "$builddir" INSTALL_ROOT="$pkgdir" install || return 1
install -d "$pkgdir"/etc/php$_phpver/conf.d || return 1
echo "extension=$_pkgreal" > "$pkgdir"/etc/php$_phpver/conf.d/00_$_pkgreal.ini || return 1
}
sha512sums="2cb2b856cf83a78d3542cdf7c69554dcc063a0541e9092b24e5e1fbd8928066a4a3de154049d0202c35addbc5055ccfbb5910ae92f2f13da80ddfc025340ddcd imagick-3.4.3.tgz"
/src
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment