LoginSignup
1
0

More than 1 year has passed since last update.

xrdpのHomebrew Formulaを作った

Last updated at Posted at 2021-09-07

既にいくつかの記事でビルドや設定方法は語られているが、車輪の再発明をする必要もないので、HomebrewのFormulaにして、今後xrdpをmacOSで利用したいユーザがいちいちビルド環境を整えてビルドしなくてもするようにしておく。

TL;DR

brew tap eru/tap
brew install eru/tap/xrdp

解説

class Xrdp < Formula
  desc "Open source RDP server"
  homepage "http://www.xrdp.org/"
  url "https://github.com/neutrinolabs/xrdp/releases/download/v0.9.17/xrdp-0.9.17.tar.gz"
  sha256 "56b913dd6d0f15b60f7a53963b30ad905f00669c91701db35bb4410be262a77e"
  license "Apache-2.0"
  head "https://github.com/neutrinolabs/xrdp.git"

  depends_on "autoconf" => :build
  depends_on "automake" => :build
  depends_on "libtool" => :build
  depends_on "nasm" => :build
  depends_on "pkg-config" => :build
  depends_on "libxfixes"
  depends_on "libxrandr"
  depends_on "openssl@1.1"

  def install
    ENV.prepend_path "PKG_CONFIG_PATH", Formula["openssl@1.1"].opt_lib/"pkgconfig"

    system "./bootstrap"
    args = %W[
      --prefix=#{prefix}
      --sysconfdir=#{etc}
      --localstatedir=#{var}
      --disable-dependency-tracking
      --disable-silent-rules
      --enable-strict-locations
    ]
    system "./configure", *args
    system "make"
    system "make", "install"
  end

  test do
    system "#{bin}/xrdp", "--version"
  end
end

よくある雑なFormulaだが、特筆する点としては、macOSではLibreSSLが標準になっているため、OpenSSLのFormulaにも記載がある通り、OpenSSLをHomebrewでインストールしてもパスが通らないので、明示的にPKG_CONFIG_PATHに追加を行っている。

また、--sysconfdir=#{etc}, --localstatedir=#{var}で、それぞれのパスをHomebrewのprefix(brew --prefixで確認できる)以下に指定している。
これらのオプションは、--enable-strict-locationsのオプションも合わせて指定しない限り、autoconfの標準ディレクトリで上書きされてしまう。1

謝辞

参考にさせていただいた記事。ありがとうございます。(順不同、執筆時点でのタイトル)


  1. これを行わないと/etc, /varが利用されるため、make install時にroot権限が必要になる。 

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0