Skip to content

Commit

Permalink
Remove undent
Browse files Browse the repository at this point in the history
  • Loading branch information
jmswindle committed Mar 26, 2019
1 parent 24793d0 commit 5f4572e
Showing 1 changed file with 29 additions and 42 deletions.
71 changes: 29 additions & 42 deletions httpd22.rb
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
class Httpd22 < Formula
desc "HTTP server"
homepage "https://httpd.apache.org/"
url "https://archive.apache.org/dist/httpd/httpd-2.2.32.tar.bz2"
sha256 "527bc9d8092d784daf08910dd6c9d2681d6a2325055b2cc69806a0a7df7ed650"
url "https://archive.apache.org/dist/httpd/httpd-2.2.31.tar.bz2"
sha256 "f32f9d19f535dac63b06cb55dfc023b40dcd28196b785f79f9346779e22f26ac"

bottle do
sha256 "296d67b38cc3cdf326530edc573291f5a7de6caa1538b361da55bd874e2c0c47" => :sierra
sha256 "eabf51413b9323a3633619fe84b51d15489fcdefb8689f3798c3041ca42dd18b" => :el_capitan
sha256 "6f6da629e7374d731794e26b703cbe4661a7d05a732836c43d735d10fc1536bb" => :yosemite
sha256 "b467425b4c729c842953d4974725cf043006c05cdcb2b973daeb9b4ea12f61bc" => :yosemite
sha256 "e5fa95c5b6e9e05a50f165ef6292d59681f1a9ab32b14433c192501d67999cd6" => :mavericks
sha256 "cce58a9a01559018d6aafeae50c88ef183774ffcde0f1b621353f3e0302c41b9" => :mountain_lion
end

conflicts_with "homebrew/apache/httpd24", :because => "different versions of the same software"

skip_clean :la

option "with-mpm-worker", "Use the Worker Multi-Processing Module instead of Prefork"
Expand All @@ -21,8 +23,6 @@ class Httpd22 < Formula
depends_on "pcre" => :optional
depends_on "zlib"

conflicts_with "homebrew/apache/httpd24", :because => "different versions of the same software"

if build.with?("mpm-worker") && build.with?("mpm-event")
raise "Cannot build with both worker and event MPMs, choose one"
end
Expand All @@ -31,11 +31,6 @@ def install
# point config files to opt_prefix instead of the version-specific prefix
inreplace "Makefile.in",
'#@@ServerRoot@@#$(prefix)#', '#@@ServerRoot@@'"##{opt_prefix}#"
# fix non-executable files in sbin dir (for brew audit)
inreplace "support/Makefile.in",
"cp -p envvars-std $(DESTDIR)$(sbindir);", "mkdir -p $(DESTDIR)$(sysconfdir); cp -p envvars-std $(DESTDIR)$(sysconfdir);"
inreplace "support/Makefile.in",
"$(DESTDIR)$(sbindir)/envvars", "$(DESTDIR)$(sysconfdir)/envvars"

# install custom layout
File.open("config.layout", "w") { |f| f.write(httpd_layout) }
Expand Down Expand Up @@ -90,33 +85,7 @@ def install
touch("#{var}/log/apache2/error_log") unless File.exist?("#{var}/log/apache2/error_log")
end

def caveats
if build.with? "privileged-ports"
<<-EOS.undent
To load #{name} when --with-privileged-ports is used:
sudo cp -v #{plist_path} /Library/LaunchDaemons
sudo chown -v root:wheel /Library/LaunchDaemons/#{plist_path.basename}
sudo chmod -v 644 /Library/LaunchDaemons/#{plist_path.basename}
sudo launchctl load /Library/LaunchDaemons/#{plist_path.basename}
To reload #{name} after an upgrade when --with-privileged-ports is used:
sudo launchctl unload /Library/LaunchDaemons/#{plist_path.basename}
sudo launchctl load /Library/LaunchDaemons/#{plist_path.basename}
If not using --with-privileged-ports, use the instructions below.
EOS
end
end

manual_startup = "apachectl start"

plist_options :manual => manual_startup

if build.with? "privileged-ports"
plist_options :startup => true, :manual => manual_startup
end

def plist; <<-EOS.undent
def plist; <<-EOS
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
Expand All @@ -137,7 +106,7 @@ def plist; <<-EOS.undent
end

def httpd_layout
<<-EOS.undent
<<-EOS
<Layout Homebrew>
prefix: #{prefix}
exec_prefix: ${prefix}
Expand All @@ -154,7 +123,7 @@ def httpd_layout
htdocsdir: ${datadir}/htdocs
manualdir: ${datadir}/manual
cgidir: #{var}/apache2/cgi-bin
includedir: ${prefix}/include/httpd
includedir: ${prefix}/include/apache2
localstatedir: #{var}/apache2
runtimedir: #{var}/run/apache2
logfiledir: #{var}/log/apache2
Expand All @@ -163,7 +132,25 @@ def httpd_layout
EOS
end

def caveats
if build.with? "privileged-ports"
<<-EOS
To load #{name} when --with-privileged-ports is used:
sudo cp -v #{plist_path} /Library/LaunchDaemons
sudo chown -v root:wheel /Library/LaunchDaemons/#{plist_path.basename}
sudo chmod -v 644 /Library/LaunchDaemons/#{plist_path.basename}
sudo launchctl load /Library/LaunchDaemons/#{plist_path.basename}
To reload #{name} after an upgrade when --with-privileged-ports is used:
sudo launchctl unload /Library/LaunchDaemons/#{plist_path.basename}
sudo launchctl load /Library/LaunchDaemons/#{plist_path.basename}
If not using --with-privileged-ports, use the instructions below.
EOS
end
end

test do
system bin/"httpd", "-v"
system sbin/"httpd", "-v"
end
end

0 comments on commit 5f4572e

Please sign in to comment.