Skip to content

Instantly share code, notes, and snippets.

@paulm17
Created September 20, 2014 03:23

Revisions

  1. paulm17 created this gist Sep 20, 2014.
    160 changes: 160 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,160 @@
    %define hhvm_dir %{_var}/hhvm
    %define hhvm_user hhvm
    %global _enable_debug_package 0
    %global debug_package %{nil}
    %global __os_install_post /usr/lib/rpm/brp-compress %{nil}

    Name: hhvm
    Version: 3.3
    Release: 0.1%{?dist}
    Summary: HipHop VM (HHVM) is a virtual machine for executing programs written in PHP

    Group: Development/Compiler
    License: PHP/Zend
    URL: http://hhvm.com
    Source0: https://github.com/facebook/hhvm/archive/HHVM-%{version}.tar.gz
    Source1: hhvm.initscript
    Source2: hhvm.hdf
    Source3: hhvm.sysconfig
    BuildRequires: gcc >= 4.7.2, cmake >= 2.8.7, libevent-devel >= 2.0
    BuildRequires: libcurl-devel >= 7.29
    BuildRequires: glog-devel >= 0.3.3, jemalloc-devel >= 3.6, tbb-devel >= 4.1
    BuildRequires: libmcrypt-devel >= 2.5.8, libdwarf-devel >= 20130207
    BuildRequires: libxml2-devel libicu-devel
    BuildRequires: oniguruma-devel readline-devel libc-client-devel pam-devel
    BuildRequires: libcap-devel libedit-devel pcre-devel gd-devel sqlite-devel
    BuildRequires: inotify-tools-devel
    BuildRequires: boost-devel >= 1.48, libmemcached-devel >= 0.39
    BuildRequires: ImageMagick-devel, freetype-devel, libjpeg-devel, libpng-devel, libtiff-devel, sqlite-devel, libnotify-devel, jemalloc-devel
    BuildRequires: llvm-devel, libvpx-devel, libyaml-devel, libevent, cyrus-sasl-devel, bzip2-devel, giflib-devel, zlib-devel, perl-devel, ghostscript-devel
    BuildRequires: djvulibre-devel, libwmf-devel, jasper-devel, libtool-ltdl-devel, libX11-devel, libXext-devel, libXt-devel, libxml2-devel, librsvg2-devel
    BuildRequires: OpenEXR-devel, flex, bison, binutils-devel, libcap-devel, boost-devel, curl-devel, gd-devel, libevent-devel, libmcrypt-devel
    BuildRequires: openssl-devel, pcre-devel, tbb-devel, libdwarf-devel, ocaml, libxslt, gcc-c++, libc-client, elfutils-libelf-devel, libedit-devel, libxslt-devel
    BuildRequires: openldap-devel, psmisc, readline-devel, unixODBC-devel
    Requires: glog >= 0.3.3, jemalloc >= 3.0, tbb >= 4.0
    Requires: libmcrypt >= 2.5.8, libdwarf >= 20130207
    Requires: boost >= 1.50, libmemcached >= 0.39

    %description
    HipHop VM (HHVM) is a new open-source virtual machine designed for executing
    programs written in PHP.
    HHVM uses a just-in-time compilation approach to achieve superior performance
    while maintaining the flexibility that PHP developers are accustomed to.
    HipHop VM (and before it HPHPc) has realized > 5x increase in throughput for
    Facebook compared with Zend PHP 5.2.

    HipHop is most commonly run as a standalone server, replacing both Apache and
    modphp.

    %package devel
    Summary: Library links and header files for HHVM development
    Group: Development/Libraries
    Requires: %{name}%{?_isa} = %{version}-%{release}
    BuildRequires: glog-devel >= 0.3.3, jemalloc-devel >= 3.6, tbb-devel >= 4.1
    BuildRequires: libmcrypt-devel >= 2.5.8, libdwarf-devel >= 20130207
    BuildRequires: mysql-devel libxml2-devel libicu-devel
    BuildRequires: oniguruma-devel readline-devel libc-client-devel pam-devel
    BuildRequires: libcap-devel libedit-devel pcre-devel gd-devel sqlite-devel
    BuildRequires: inotify-tools-devel
    BuildRequires: boost-devel >= 1.50, libmemcached-devel >= 0.39
    Provides: HHVM-devel = %{version}-%{release}

    %description devel
    HHVM-devel contains the library links and header files you'll
    need to develop HHVM applications.

    %files devel
    %defattr(-,root,root,-)
    /usr/local/lib64/hhvm/CMake/*.cmake
    /usr/local/lib/libpcre.a
    /usr/local/lib/libpcreposix.a
    /usr/local/lib/libpcrecpp.a
    /usr/local/bin/pcregrep
    /usr/local/bin/pcretest
    /usr/local/bin/pcrecpp_unittest
    /usr/local/bin/pcre_scanner_unittest
    /usr/local/bin/pcre_stringpiece_unittest
    /usr/local/include/pcre.h
    /usr/local/include/pcreposix.h
    /usr/local/include/pcrecpp.h
    /usr/local/include/pcre_scanner.h
    /usr/local/include/pcrecpparg.h
    /usr/local/include/pcre_stringpiece.h
    /usr/local/man/man*/pcre*
    /usr/local/share/doc/pcre/*

    %prep
    %setup -q -n %{name}-%{version}

    %build
    export HPHP_HOME=`pwd`
    export CPLUS_INCLUDE_PATH=/usr/include/libdwarf
    git submodule update --init --recursive
    cmake -DCMAKE_INSTALL_PREFIX:PATH=/usr \
    -DLIBEVENT_LIB=/usr/lib64/libevent.so \
    -DLIBEVENT_INCLUDE_DIR=/usr/include \
    -DLIBINOTIFY_LIBRARY=/usr/lib64/libinotifytools.so.0 .
    make %{?_smp_mflags}

    %install
    export DONT_STRIP=1
    rm -rf $RPM_BUILD_ROOT
    %{__install} -p -D -m 0755 hphp/hhvm/hhvm %{buildroot}%{_bindir}/hhvm
    %{__install} -p -D -m 0755 hphp/tools/hphpize/hphpize %{buildroot}%{_bindir}/hphpize
    %{__install} -p -D -m 0755 hphp/hack/bin/hh_client %{buildroot}%{_bindir}/hh_client
    %{__install} -p -D -m 0755 hphp/hack/bin/hh_client %{buildroot}%{_bindir}/hh_server

    # Install initscript, sysconfig and hhvm configuration
    %{__install} -p -D -m 0755 %{SOURCE1} %{buildroot}%{_initddir}/%{name}
    %{__install} -p -D -m 0644 %{SOURCE2} %{buildroot}%{_sysconfdir}/hhvm/hhvm.hdf
    %{__install} -p -D -m 0644 %{SOURCE3} %{buildroot}%{_sysconfdir}/sysconfig/%{name}

    # Create default directory
    %{__mkdir} -p %{buildroot}%{_var}/run/%{name}
    %{__mkdir} -p %{buildroot}%{_var}/log/%{name}
    %{__mkdir} -p %{buildroot}%{_var}/hhvm

    # Cleanup
    %{__rm} -f %{buildroot}%{_includedir}/zip.h
    %{__rm} -f %{buildroot}%{_includedir}/zipconf.h
    %{__rm} -f %{buildroot}/usr/lib/libzip.a
    %{__rm} -f %{buildroot}/usr/lib/libzip.so

    %clean
    rm -rf $RPM_BUILD_ROOT

    %pre
    %{_sbindir}/useradd -d %{hhvm_dir} -m -c "HHVM" -r %{hhvm_user} 2>/dev/null
    exit 0

    %post
    if [ $1 == 1 ]; then
    /sbin/chkconfig --add %{name}
    fi

    %preun
    if [ $1 = 0 ]; then
    /sbin/service %{name} stop >/dev/null 2>&1
    /sbin/chkconfig --del %{name}
    fi

    %files
    %defattr(-,hhvm,hhvm,-)
    %dir %{_var}/hhvm
    %dir %{_var}/run/%{name}
    %dir %{_var}/log/%{name}

    %defattr(-,root,root,-)
    %dir %{_sysconfdir}/hhvm
    %config(noreplace) %{_sysconfdir}/hhvm/hhvm.hdf
    %config(noreplace) %{_sysconfdir}/sysconfig/%{name}
    %{_initddir}/%{name}
    %{_bindir}/hhvm
    %{_bindir}/hphpize

    %doc CONTRIBUTING.md LICENSE.PHP LICENSE.ZEND README.md hphp/NEWS

    %changelog

    * Fri Sep 19 2014 Paul Moss <pau>> - 3.3
    - Initial built for el7