Skip to content
This repository has been archived by the owner on Jan 25, 2022. It is now read-only.

Commit

Permalink
Initial commit.
Browse files Browse the repository at this point in the history
  • Loading branch information
MickMake committed Jun 12, 2018
0 parents commit f0b8c2f
Show file tree
Hide file tree
Showing 350 changed files with 110,159 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.*.swp
*.OLD
37 changes: 37 additions & 0 deletions 5.2.4/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
FROM alpine:3.7

MAINTAINER WPLib Team <[email protected]>

ARG PACKAGE_VERSION="5.2.4"
ARG PACKAGE_URL="http://museum.php.net/php5/php-5.2.4.tar.gz"
ARG PACKAGE_ROOT="/"
ARG WPLIB_USER="vagrant"
ARG WPLIB_UID="1000"
ARG WPLIB_GROUP="vagrant"
ARG WPLIB_GID="1000"


################################################################################
ENV PACKAGE_VERSION $PACKAGE_VERSION
ENV PACKAGE_URL $PACKAGE_URL
ENV PACKAGE_ROOT $PACKAGE_ROOT
ENV WPLIB_USER $WPLIB_USER
ENV WPLIB_UID $WPLIB_UID
ENV WPLIB_GROUP $WPLIB_GROUP
ENV WPLIB_GID $WPLIB_GID

USER root

COPY build/* /build/
COPY container.json /etc/container.json
COPY files /

RUN /bin/sh /build/build.sh && \
wget -nv https://github.com/mailhog/mhsendmail/releases/download/v0.2.0/mhsendmail_linux_amd64 && \
mv mhsendmail_linux_amd64 /usr/local/bin/mhsendmail && \
chmod a+x /usr/local/bin/*

WORKDIR /var/www
USER vagrant
# ENTRYPOINT ["/usr/local/bin/php-entrypoint"]
CMD ["/usr/sbin/php-fpm", "-F"]
201 changes: 201 additions & 0 deletions 5.2.4/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,201 @@
#
# Standard version level Makefile used to build a Docker container for WPLib - https://github.com/wplib/wplib-box/
#
# ARG PACKAGE_VERSION=5.2.4
# ARG WPLIB_USER="vagrant"
# ARG WPLIB_UID="1000"
# ARG WPLIB_GROUP="vagrant"
# ARG WPLIB_GID="1000"


# Determine whether we use "nodeJS" or "JQ".
JSONCMD := $(shell jq -r '.project' ./container.json)
ifneq ($(JSONCMD),)
define GetFromPkg
$(shell jq -r ".$(1)" ./container.json)
endef

define rawJSON
$(shell jq -Mc -r '' ./container.json)
endef

else
JSONCMD := $(shell node -p "require('./container.json').project")
ifneq ($(JSONCMD),)
define GetFromPkg
$(shell node -p "require('./container.json').$(1)")
endef

define rawJSON
$(shell node -p "require('./container.json')")
endef

else
$(shell )

endif
endif

# Set global variables from container file.
PROJECT := $(call GetFromPkg,project)
NAME := $(call GetFromPkg,name)
VERSION := $(call GetFromPkg,version)
MAJORVERSION := $(call GetFromPkg,majorversion)
LATEST := $(call GetFromPkg,latest)
CLASS := $(call GetFromPkg,class)
NETWORK := $(call GetFromPkg,network)
PORTS := $(call GetFromPkg,ports)
VOLUMES := $(call GetFromPkg,volumes)
RESTART := $(call GetFromPkg,restart)
ARGS := $(call GetFromPkg,args)
ENV := $(call GetFromPkg,env)

IMAGE_NAME ?= $(PROJECT)/$(NAME)
CONTAINER_NAME ?= $(NAME)-$(VERSION)
CONTAINER_JSON ?= '$(call rawJSON)'

LOGFILE := $(shell date +'build-%Y%m%d-%H%M%S.log')


.PHONY: build push release clean list inspect test create shell run start stop rm

################################################################################
# Image related commands.
default: build


build: Dockerfile
ifeq ($(PROJECT),)
@echo "WPLib: ERROR - You need to install JQ or NodeJS."
else
script -r -t 10 logs/$(LOGFILE) docker build -t $(IMAGE_NAME):$(VERSION) --label container.json='$(call rawJSON)' --label container.project="$(PROJECT)" --label container.name="$(NAME)" --label container.version="$(VERSION)" --label container.majorversion="$(MAJORVERSION)" --label container.latest="$(LATEST)" --label container.class="$(CLASS)" --label container.network="$(NETWORK)" --label container.ports="$(PORTS)" --label container.volumes="$(VOLUMES)" --label container.restart="$(RESTART)" --label container.args="$(ARGS)" --label container.env="$(ENV)" --build-arg $(ENV)="$(VERSION)" .
ifneq ($(MAJORVERSION),)
-docker tag $(IMAGE_NAME):$(VERSION) $(IMAGE_NAME):$(MAJORVERSION)
endif
ifeq ($(LATEST),1)
-docker tag $(IMAGE_NAME):$(VERSION) $(IMAGE_NAME):latest
endif
@echo "WPLib: Log file saved to \"logs/$(LOGFILE)\""
endif

push:
ifeq ($(PROJECT),)
@echo "WPLib: ERROR - You need to install JQ or NodeJS."
else
docker push $(IMAGE_NAME):$(VERSION)
ifneq ($(MAJORVERSION),)
-docker push $(IMAGE_NAME):$(MAJORVERSION)
endif
ifeq ($(LATEST),1)
-docker push $(IMAGE_NAME):latest
endif
endif


release: build
ifeq ($(PROJECT),)
@echo "WPLib: ERROR - You need to install JQ or NodeJS."
else
make clean; make build
make push
endif


clean:
ifeq ($(PROJECT),)
@echo "WPLib: ERROR - You need to install JQ or NodeJS."
else
docker image rm $(IMAGE_NAME):$(VERSION)
ifneq ($(MAJORVERSION),)
-docker image rm $(IMAGE_NAME):$(MAJORVERSION)
endif
ifeq ($(LATEST),1)
-docker image rm $(IMAGE_NAME):latest
endif
endif


list:
ifeq ($(PROJECT),)
@echo "WPLib: ERROR - You need to install JQ or NodeJS."
else
docker image ls $(IMAGE_NAME):$(VERSION)
ifneq ($(MAJORVERSION),)
-docker image ls $(IMAGE_NAME):$(MAJORVERSION)
endif
ifeq ($(LATEST),1)
-docker image ls $(IMAGE_NAME):latest
endif
endif


inspect:
ifeq ($(PROJECT),)
@echo "WPLib: ERROR - You need to install JQ or NodeJS."
else
docker image inspect $(IMAGE_NAME):$(VERSION)
endif


test:
ifeq ($(PROJECT),)
@echo "WPLib: ERROR - You need to install JQ or NodeJS."
else
make -k stop; make -k rm
make -k clean; make -k build; make -k create; make -k start
endif


################################################################################
# Container related commands.

create:
ifeq ($(PROJECT),)
@echo "WPLib: ERROR - You need to install JQ or NodeJS."
else
docker create --name $(CONTAINER_NAME) $(RESTART) $(NETWORK) $(PORTS) $(ARGS) $(VOLUMES) $(IMAGE_NAME):$(VERSION)
endif


shell:
ifeq ($(PROJECT),)
@echo "WPLib: ERROR - You need to install JQ or NodeJS."
else
docker run --rm --name $(CONTAINER_NAME)-shell -i -t $(NETWORK) $(PORTS) $(ARGS) $(VOLUMES) $(IMAGE_NAME):$(VERSION) /bin/bash
endif


run:
ifeq ($(PROJECT),)
@echo "WPLib: ERROR - You need to install JQ or NodeJS."
else
docker run --rm --name $(CONTAINER_NAME) $(NETWORK) $(PORTS) $(ARGS) $(VOLUMES) $(IMAGE_NAME):$(VERSION)
endif


start:
ifeq ($(PROJECT),)
@echo "WPLib: ERROR - You need to install JQ or NodeJS."
else
docker start $(CONTAINER_NAME)
endif


stop:
ifeq ($(PROJECT),)
@echo "WPLib: ERROR - You need to install JQ or NodeJS."
else
docker stop $(CONTAINER_NAME)
endif


rm:
ifeq ($(PROJECT),)
@echo "WPLib: ERROR - You need to install JQ or NodeJS."
else
docker container rm $(CONTAINER_NAME)
endif


################################################################################

143 changes: 143 additions & 0 deletions 5.2.4/build/PKGBUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@
pkgname=php
pkgver=${PACKAGE_VERSION}
#pkgdir=${PACKAGE_ROOT}
pkgrel=1
arch=('i686' 'x86_64')
license=('PHP')
url='http://www.php.net'
source=("http://www.php.net/distributions/php-${pkgver}.tar.gz")
md5sums=("${PACKAGE_MD5}")

CFLAGS="-fstack-protector-strong -fpic -fpie -O2"
export CFLAGS
CPPFLAGS="$CFLAGS"
export CPPFLAGS
LDFLAGS="-Wl,-O1 -Wl,--hash-style=both -pie"
export LDFLAGS


check()
{
echo "# WPLib: PHP ${PACKAGE_VERSION} - test function."

cd ${pkgname}-${pkgver}

# make test
}

build()
{
echo "# WPLib: PHP ${PACKAGE_VERSION} - build function."

cd ${pkgname}-${pkgver}

EXTENSION_DIR=/usr/lib/php/modules ./configure --config-cache \
--prefix=/usr \
--sysconfdir=/etc/php \
--localstatedir=/var \
--with-layout=GNU \
--with-config-file-path=/etc/php \
--with-config-file-scan-dir=/etc/php/conf.d \
--mandir=/usr/share/man \
--enable-inline-optimization \
--enable-option-checking=fatal \
--enable-fpm --with-fpm-user=${WPLIB_USER} --with-fpm-group=${WPLIB_GROUP} \
--disable-debug \
--disable-rpath \
--disable-static \
--enable-shared \
--with-pic \
--enable-cgi \
--enable-cli \
--with-mhash \
--with-pear \
--with-readline \
--with-libedit \
--enable-phpdbg \
--enable-bcmath=shared \
--with-bz2=shared \
--enable-calendar=shared \
--with-cdb \
--enable-ctype=shared \
--with-curl=shared \
--with-enchant=shared \
--with-freetype-dir=shared,/usr \
--enable-ftp=shared \
--enable-exif=shared \
--with-gd=shared --enable-gd-native-ttf \
--with-png-dir=shared,/usr \
--with-gettext=shared \
--with-gmp=shared \
--with-iconv=shared \
--with-icu-dir=/usr \
--with-imap=shared \
--with-imap-ssl=shared \
--enable-intl=shared \
--with-jpeg-dir=shared,/usr \
--enable-json=shared \
--with-ldap=shared \
--enable-mbregex \
--enable-mbstring=all \
--with-mcrypt=shared \
--with-mysql=shared,mysqlnd --with-mysql-sock=/var/run/mysqld/mysqld.sock --with-mysqli=shared,mysqlnd \
--with-openssl=shared \
--with-pcre-regex=/usr \
--enable-pcntl=shared \
--enable-phar=shared \
--enable-posix=shared \
--with-pspell=shared \
--with-regex=php \
--enable-session \
--enable-shmop=shared \
--with-snmp=shared \
--enable-soap=shared \
--enable-sockets=shared \
--enable-sysvmsg=shared --enable-sysvsem=shared --enable-sysvshm=shared \
--with-unixODBC=shared,/usr \
--enable-dom=shared --enable-libxml=shared --enable-xml=shared --enable-xmlreader=shared --with-xmlrpc=shared --with-xsl=shared \
--enable-wddx=shared \
--enable-zip=shared --with-zlib=shared \
--enable-dba=shared \
--with-gdbm=shared \
--with-db4=shared \
--without-db1 --without-db2 --without-db3 --without-qdbm \
--with-sqlite3=shared,/usr \
--with-mssql=shared \
--enable-pdo=shared \
--with-pdo-mysql=shared,mysqlnd \
--with-pdo-odbc=shared,unixODBC,/usr \
--with-pdo-pgsql=shared \
--with-pdo-sqlite=shared,/usr \
--with-pdo-dblib=shared \
--with-pgsql=shared \
--enable-opcache


make
}

package()
{
echo "# WPLib: PHP ${PACKAGE_VERSION} - package function."

pkgdesc='An HTML-embedded scripting language'
# depends=('pcre' 'bzip2')
# backup=('etc/php/php.ini')

# pkgdir should be empty here.
# If it's set to "/" then the build will hang.
#pkgdir=""

cd ${pkgname}-${pkgver}
make -j1 INSTALL_ROOT=${pkgdir} install
# install -D -m644 php.ini-production ${pkgdir}/etc/php/php.ini
install -d -m755 ${pkgdir}/etc/php/conf.d/

# remove empty directory
rmdir ${pkgdir}/usr/include/php/include

# Fixup pecl errors.
# EG: "Warning: Invalid argument supplied for foreach() in /usr/share/pear/PEAR/Command.php on line 249"
# "Warning: Invalid argument supplied for foreach() in Command.php on line 249"
# sed -i 's/^exec $PHP -C -n -q/exec $PHP -C -q/' ${pkgdir}/usr/bin/pecl
}
Loading

0 comments on commit f0b8c2f

Please sign in to comment.