dev-util/clair: 2.1.3 bump
[gentoo.git] / www-apache / passenger / passenger-6.0.2.ebuild
1 # Copyright 1999-2019 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=6
5 USE_RUBY="ruby23 ruby24 ruby25 ruby26"
6
7 inherit apache-module flag-o-matic multilib ruby-ng toolchain-funcs
8
9 DESCRIPTION="Passenger makes deployment of Ruby on Rails applications a breeze"
10 HOMEPAGE="https://www.phusionpassenger.com/"
11 SRC_URI="https://s3.amazonaws.com/phusion-passenger/releases/${P}.tar.gz"
12
13 LICENSE="GPL-2"
14 SLOT="0"
15 KEYWORDS="amd64 x86"
16 IUSE="apache2 debug"
17
18 ruby_add_bdepend "dev-ruby/rake"
19
20 ruby_add_rdepend "
21         >=dev-ruby/rack-1.0.0:*
22         >=dev-ruby/rake-0.8.1"
23
24 # libev is bundled but with adapations that do not seem to be accepted
25 # upstream, so we must use the bundled version :-(
26 CDEPEND="
27         >=dev-libs/libuv-1.8.0
28         net-misc/curl[ssl]
29         apache2? ( www-servers/apache[apache2_modules_unixd(+)] )"
30
31 RDEPEND="${RDEPEND} ${CDEPEND}"
32 DEPEND="${DEPEND} ${CDEPEND}"
33
34 APACHE2_MOD_CONF="30_mod_${PN}-5.0.0 30_mod_${PN}"
35 APACHE2_MOD_DEFINE="PASSENGER"
36
37 want_apache2
38
39 pkg_setup() {
40         use debug && append-flags -DPASSENGER_DEBUG
41         depend.apache_pkg_setup
42 }
43
44 all_ruby_prepare() {
45         eapply "${FILESDIR}"/${PN}-5.1.11-gentoo.patch
46         eapply "${FILESDIR}"/${PN}-5.1.1-isnan.patch
47
48         # Change these with sed instead of a patch so that we can easily use
49         # the toolchain-funcs methods.
50         sed -i -e "/^CC/ s/=.*$/= '$(tc-getCC)'/" \
51                 -e "/^CXX\s/ s/=.*$/= '$(tc-getCXX)'/" \
52                 -e 's/PlatformInfo.debugging_cflags//' build/basics.rb || die
53
54         # Avoid fixed debugging CFLAGs.
55         sed -e '/debugging_cflags/areturn ""' -i src/ruby_supportlib/phusion_passenger/platform_info/compiler.rb || die
56
57         # Use sed here so that we can dynamically set the documentation directory.
58         sed -i -e "s:/usr/share/doc/passenger:/usr/share/doc/${P}:" \
59                 -e "s:/usr/lib/phusion-passenger/agents:/usr/libexec/phusion-passenger/agents:" \
60                 src/ruby_supportlib/phusion_passenger.rb || die
61         sed -i -e "s:/usr/lib/phusion-passenger/agents:/usr/libexec/phusion-passenger/agents:" src/cxx_supportlib/ResourceLocator.h || die
62
63         # Don't install a tool that won't work in our setup.
64         sed -i -e '/passenger-install-apache2-module/d' src/ruby_supportlib/phusion_passenger/packaging.rb || die
65         rm -f bin/passenger-install-apache2-module || die "Unable to remove unneeded install script."
66
67         # Make sure we use the system-provided version where possible
68         rm -rf src/cxx_supportlib/vendor-copy/libuv || die "Unable to remove vendored code."
69
70         # Avoid building documentation to avoid a dependency on mizuho.
71         #sed -i -e 's/, :doc//' build/packaging.rb || die
72         touch doc/*.html || die
73
74         # Fix hard-coded use of AR
75         sed -i -e "s/ar cru/"$(tc-getAR)" cru/" build/support/cplusplus.rb || die
76
77         # Make sure apache support is not attempted with -apache2
78         if ! use apache2 ; then
79                 sed -i -e '/fakeroot/ s/:apache2, //' build/packaging.rb || die
80         fi
81 }
82
83 all_ruby_compile() {
84         if use apache2 ; then
85                 V=1 EXTRA_LDFLAGS="${LDFLAGS}" \
86                  APXS2="${APXS}" \
87                  HTTPD="${APACHE_BIN}" \
88                  FS_LIBDIR='/usr/'$(get_libdir) \
89                  USE_VENDORED_LIBUV="no" LIBUV_LIBS="-luv" \
90                  ruby -S rake apache2 || die "rake failed"
91         fi
92 }
93
94 each_ruby_compile() {
95         append-flags -fno-strict-aliasing
96
97         V=1 EXTRA_LDFLAGS="${LDFLAGS}" \
98         APXS2="${APXS}" \
99         HTTPD="${APACHE_BIN}" \
100         FS_LIBDIR='/usr/'$(get_libdir) \
101         USE_VENDORED_LIBUV="no" LIBUV_LIBS="-luv" \
102         ${RUBY} -S rake native_support || die "rake failed"
103 }
104
105 all_ruby_install() {
106         if use apache2 ; then
107                 APACHE2_MOD_FILE="${S}/buildout/apache2/mod_${PN}.so"
108                 apache-module_src_install
109
110                 # Patch in the correct libdir
111                 sed -i -e 's:/usr/lib/:/usr/'$(get_libdir)'/:' "${D}${APACHE_MODULES_CONFDIR}/30_mod_${PN}.conf" || die
112         fi
113
114         dodoc CHANGELOG README.md
115 }
116
117 each_ruby_install() {
118         DISTDIR="${D}" \
119         RUBYLIBDIR="$(ruby_rbconfig_value vendordir)" \
120         RUBYARCHDIR="$(ruby_rbconfig_value archdir)" \
121         APXS2="${APXS}" \
122         HTTPD="${APACHE_BIN}" \
123         FS_LIBDIR='/usr/'$(get_libdir) \
124         EXTRA_LDFLAGS="${LDFLAGS}" \
125         USE_VENDORED_LIBUV="no" LIBUV_LIBS="-luv" \
126         ${RUBY} -S rake fakeroot || die "rake failed"
127 }