mirror of
https://github.com/chromebrew/chromebrew.git
synced 2026-01-10 07:57:59 -05:00
@@ -3,7 +3,7 @@ require 'package'
|
||||
class Php < Package
|
||||
description 'PHP is a popular general-purpose scripting language that is especially suited to web development.'
|
||||
homepage 'http://www.php.net/'
|
||||
version '5.6.40-7.4.12'
|
||||
version '5.6.40-8.0.2'
|
||||
compatibility 'all'
|
||||
|
||||
is_fake
|
||||
@@ -12,13 +12,14 @@ class Php < Package
|
||||
phpver = `php -v 2> /dev/null | head -1 | cut -d' ' -f2`.chomp
|
||||
abort "PHP version #{phpver} already installed.".lightgreen unless "#{phpver}" == ""
|
||||
puts
|
||||
puts " Select the version to install:"
|
||||
puts " 5.6 = PHP 5.6.40"
|
||||
puts " 7.1 = PHP 7.1.33"
|
||||
puts " 7.2 = PHP 7.2.34"
|
||||
puts " 7.3 = PHP 7.3.24"
|
||||
puts " 7.4 = PHP 7.4.12"
|
||||
puts " 0 = Cancel"
|
||||
puts "Select version:"
|
||||
puts "5.6 = PHP 5.6.40"
|
||||
puts "7.1 = PHP 7.1.33"
|
||||
puts "7.2 = PHP 7.2.34"
|
||||
puts "7.3 = PHP 7.3.27"
|
||||
puts "7.4 = PHP 7.4.15"
|
||||
puts "8.0 = PHP 8.0.2"
|
||||
puts " 0 = Cancel"
|
||||
|
||||
while version = STDIN.gets.chomp
|
||||
case version
|
||||
@@ -37,11 +38,14 @@ class Php < Package
|
||||
when '7.4'
|
||||
depends_on 'php74'
|
||||
break
|
||||
when '8.0'
|
||||
depends_on 'php80'
|
||||
break
|
||||
when '0'
|
||||
abort
|
||||
break
|
||||
else
|
||||
puts " Please select from one of the options or enter 0 to cancel."
|
||||
puts "\nPlease select from one of the options or enter 0 to cancel."
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
166
packages/php80.rb
Normal file
166
packages/php80.rb
Normal file
@@ -0,0 +1,166 @@
|
||||
require 'package'
|
||||
|
||||
class Php80 < Package
|
||||
description 'PHP is a popular general-purpose scripting language that is especially suited to web development.'
|
||||
homepage 'http://www.php.net/'
|
||||
@_ver = '8.0.2'
|
||||
version @_ver
|
||||
compatibility 'all'
|
||||
source_url "https://www.php.net/distributions/php-#{@_ver}.tar.xz"
|
||||
source_sha256 `curl -Ls #{source_url} | sha256sum | cut -d' ' -f1`.chomp
|
||||
|
||||
binary_url({
|
||||
aarch64: 'https://dl.bintray.com/chromebrew/chromebrew/php80-8.0.2-chromeos-armv7l.tar.xz',
|
||||
armv7l: 'https://dl.bintray.com/chromebrew/chromebrew/php80-8.0.2-chromeos-armv7l.tar.xz',
|
||||
i686: 'https://dl.bintray.com/chromebrew/chromebrew/php80-8.0.2-chromeos-i686.tar.xz',
|
||||
x86_64: 'https://dl.bintray.com/chromebrew/chromebrew/php80-8.0.2-chromeos-x86_64.tar.xz',
|
||||
})
|
||||
binary_sha256({
|
||||
aarch64: '80f18af7f6ec59aa3b7062ebcbfe903d8a083b63579e4fbb20821ec86dc7e4d2',
|
||||
armv7l: '80f18af7f6ec59aa3b7062ebcbfe903d8a083b63579e4fbb20821ec86dc7e4d2',
|
||||
i686: '56d3288868864e2ce89a712dbbe33be35ea6b598587c9372af9b5290889ca7af',
|
||||
x86_64: '688318b7e49fed6b56cecc8692755e2d8325b9e0d5b814824adfdb017c28d06b',
|
||||
})
|
||||
|
||||
depends_on 'aspell_en'
|
||||
depends_on 'libgcrypt'
|
||||
depends_on 'libjpeg_turbo'
|
||||
depends_on 'libsodium'
|
||||
depends_on 'libxslt'
|
||||
depends_on 'libzip'
|
||||
depends_on 'exif'
|
||||
depends_on 'freetds'
|
||||
depends_on 'freetype'
|
||||
depends_on 'graphite'
|
||||
depends_on 're2c'
|
||||
depends_on 'tidy'
|
||||
depends_on 'unixodbc'
|
||||
depends_on 'oniguruma'
|
||||
depends_on 'pygments'
|
||||
|
||||
def self.preinstall
|
||||
phpver = `php -v 2> /dev/null | head -1 | cut -d' ' -f2`.chomp
|
||||
abort "PHP version #{phpver} already installed.".lightred unless phpver.to_s == ''
|
||||
end
|
||||
|
||||
def self.patch
|
||||
# Configuration
|
||||
system "sed -i 's,;pid = run/php-fpm.pid,pid = #{CREW_PREFIX}/tmp/run/php-fpm.pid,' sapi/fpm/php-fpm.conf.in"
|
||||
system "sed -i 's,;error_log = log/php-fpm.log,error_log = #{CREW_PREFIX}/log/php-fpm.log,' sapi/fpm/php-fpm.conf.in"
|
||||
system "sed -i 's,include=@php_fpm_sysconfdir@/php-fpm.d,include=#{CREW_PREFIX}/etc/php-fpm.d,' sapi/fpm/php-fpm.conf.in"
|
||||
system "sed -i 's,^user,;user,' sapi/fpm/www.conf.in"
|
||||
system "sed -i 's,^group,;group,' sapi/fpm/www.conf.in"
|
||||
system "sed -i 's,@sbindir@,#{CREW_PREFIX}/bin,' sapi/fpm/init.d.php-fpm.in"
|
||||
system "sed -i 's,@sysconfdir@,#{CREW_PREFIX}/etc,' sapi/fpm/init.d.php-fpm.in"
|
||||
system "sed -i 's,@localstatedir@,#{CREW_PREFIX}/tmp,' sapi/fpm/init.d.php-fpm.in"
|
||||
# Set some sane defaults
|
||||
system "sed -i 's,post_max_size = 8M,post_max_size = 128M,' php.ini-development"
|
||||
system "sed -i 's,upload_max_filesize = 2M,upload_max_filesize = 128M,' php.ini-development"
|
||||
system "sed -i 's,;opcache.enable=0,opcache.enable=1,' php.ini-development"
|
||||
# Fix cc: error: ext/standard/.libs/type.o: No such file or directory
|
||||
# system "sed -i '98303d' configure"
|
||||
# system "sed -i '98295,98296d' configure"
|
||||
# Fix /usr/bin/file: No such file or directory
|
||||
system 'filefix'
|
||||
end
|
||||
|
||||
def self.build
|
||||
system "env LD_LIBRARY_PATH=#{CREW_LIB_PREFIX} TMPDIR='#{CREW_PREFIX}/tmp' CFLAGS='-pipe' \
|
||||
./configure \
|
||||
--prefix=#{CREW_PREFIX} \
|
||||
--docdir=#{CREW_PREFIX}/doc \
|
||||
--infodir=#{CREW_PREFIX}/info \
|
||||
--libdir=#{CREW_LIB_PREFIX} \
|
||||
--localstatedir=#{CREW_PREFIX}/tmp \
|
||||
--mandir=#{CREW_MAN_PREFIX} \
|
||||
--sbindir=#{CREW_PREFIX}/bin \
|
||||
--with-config-file-path=#{CREW_PREFIX}/etc \
|
||||
--with-libdir=#{ARCH_LIB} \
|
||||
--with-kerberos=#{CREW_LIB_PREFIX} \
|
||||
--enable-exif \
|
||||
--enable-fpm \
|
||||
--enable-ftp \
|
||||
--enable-mbstring \
|
||||
--enable-opcache \
|
||||
--enable-pcntl \
|
||||
--enable-shared \
|
||||
--enable-shmop \
|
||||
--enable-sockets \
|
||||
--enable-bcmath \
|
||||
--enable-calendar \
|
||||
--enable-dba=shared \
|
||||
--enable-intl \
|
||||
--enable-mysqlnd \
|
||||
--enable-opcache \
|
||||
--enable-soap \
|
||||
--enable-sysvmsg \
|
||||
--with-zip \
|
||||
--with-bz2 \
|
||||
--with-curl \
|
||||
--with-gettext \
|
||||
--with-gmp \
|
||||
--with-mysqli \
|
||||
--with-openssl \
|
||||
--with-pdo-mysql \
|
||||
--with-pear \
|
||||
--with-readline \
|
||||
--with-tidy \
|
||||
--with-unixODBC \
|
||||
--with-xsl \
|
||||
--with-zlib \
|
||||
--with-freetype \
|
||||
--with-gdbm \
|
||||
--with-jpeg \
|
||||
--with-ldap \
|
||||
--with-ldap-sasl \
|
||||
--with-pspell \
|
||||
--with-sodium \
|
||||
--with-zip \
|
||||
--with-ffi \
|
||||
--with-libedit"
|
||||
system 'make'
|
||||
end
|
||||
|
||||
def self.check
|
||||
# system 'make', 'test'
|
||||
end
|
||||
|
||||
def self.install
|
||||
FileUtils.mkdir_p "#{CREW_DEST_PREFIX}/log"
|
||||
FileUtils.mkdir_p "#{CREW_DEST_PREFIX}/tmp/run"
|
||||
FileUtils.mkdir_p "#{CREW_DEST_PREFIX}/etc/init.d"
|
||||
FileUtils.mkdir_p "#{CREW_DEST_PREFIX}/etc/php-fpm.d"
|
||||
system 'make', "INSTALL_ROOT=#{CREW_DEST_DIR}", 'install'
|
||||
FileUtils.install 'php.ini-development', "#{CREW_DEST_PREFIX}/etc/php.ini", mode: 0644
|
||||
FileUtils.install 'sapi/fpm/init.d.php-fpm.in', "#{CREW_DEST_PREFIX}/etc/init.d/php-fpm", mode: 0755
|
||||
FileUtils.install 'sapi/fpm/php-fpm.conf.in', "#{CREW_DEST_PREFIX}/etc/php-fpm.conf", mode: 0755
|
||||
FileUtils.install 'sapi/fpm/www.conf.in', "#{CREW_DEST_PREFIX}/etc/php-fpm.d/www.conf", mode:0644
|
||||
FileUtils.ln_s "#{CREW_PREFIX}/etc/init.d/php-fpm", "#{CREW_DEST_PREFIX}/bin/php8-fpm"
|
||||
|
||||
# clean up some files created under #{CREW_DEST_DIR}. check http://pear.php.net/bugs/bug.php?id=20383 for more details
|
||||
FileUtils.mv "#{CREW_DEST_DIR}/.depdb", "#{CREW_DEST_LIB_PREFIX}/php"
|
||||
FileUtils.mv "#{CREW_DEST_DIR}/.depdblock", "#{CREW_DEST_LIB_PREFIX}/php"
|
||||
FileUtils.rm_rf "#{CREW_DEST_DIR}/.channels"
|
||||
FileUtils.rm_rf "#{CREW_DEST_DIR}/.filemap"
|
||||
FileUtils.rm_rf "#{CREW_DEST_DIR}/.lock"
|
||||
FileUtils.rm_rf "#{CREW_DEST_DIR}/.registry"
|
||||
end
|
||||
|
||||
def self.postinstall
|
||||
puts
|
||||
puts 'To start the php-fpm service, execute:'.lightblue
|
||||
puts 'php8-fpm start'.lightblue
|
||||
puts
|
||||
puts 'To stop the php-fpm service, execute:'.lightblue
|
||||
puts 'php8-fpm stop'.lightblue
|
||||
puts
|
||||
puts 'To restart the php-fpm service, execute:'.lightblue
|
||||
puts 'php8-fpm restart'.lightblue
|
||||
puts
|
||||
puts 'To start php-fpm on login, execute the following:'.lightblue
|
||||
puts "echo 'if [ -f #{CREW_PREFIX}/bin/php8-fpm ]; then' >> ~/.bashrc".lightblue
|
||||
puts "echo ' #{CREW_PREFIX}/bin/php8-fpm start' >> ~/.bashrc".lightblue
|
||||
puts "echo 'fi' >> ~/.bashrc".lightblue
|
||||
puts 'source ~/.bashrc'.lightblue
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user