ãbrew install èªåã®ããã±ã¼ã¸ãããããã
brew install ã§èªåã®ããã±ã¼ã¸ãã¤ã³ã¹ãã¼ã«ãããã
ãããã
æé ã¨ãã¦ã¯ãããªã«é£ãããªãã
- brew create ã§Formulaä½æ
- github ã«ã¬ãã¸ããªãä½ã
- brew tap ã§æã£ã¦ãã
- brew install ã§ä½¿ãã
brew create ã§Formulaä½æ
ãµã³ãã«ã¨ã㦠rarlab ã®winrar ã® rar ã³ãã³ããèªåã§å ¥ããã¨ä»®å®ãã¦ãã£ã¦ã¿ã¾ãã
brew create 'http://www.win-rar.com/fileadmin/winrar-versions/rarosx-5.4.0.tar.gz'
ãã®ææå®ãããrarosx-5.4.0.tar.gz
ã¨ãããã¡ã¤ã«åãããã¼ã¸ã§ã³ã¨ååãèªåçã«æ±ºã¾ãã¾ãã
ãã³ãã¬ãä½ããããªã®ã§ããã¨ã§ååãå¤ãã¦ããªãã±
ããã¨ã/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/rarosx.rb
ã«Formulaã¬ã·ããã¡ã¤ã«ãä½ããã¾ãã
Formula ã®ç·¨é
brew create ã§ä½æãããFormulaã¯æ¬¡ã®ããã«ãªã£ã¦ãã¾ãã ãããç·¨éããã¨æ¥½ã¡ãã§ãã
# Documentation: https://github.com/Homebrew/brew/blob/master/docs/Formula-Cookbook.md # http://www.rubydoc.info/github/Homebrew/brew/master/Formula # PLEASE REMOVE ALL GENERATED COMMENTS BEFORE SUBMITTING YOUR PULL REQUEST! class Rarosx < Formula desc "" homepage "" url "http://www.win-rar.com/fileadmin/winrar-versions/rarosx-5.4.0.tar.gz" version "5.4.0" sha256 "09a14f40718c68fc1c24b30acb55d0f2f90f3e13b372c48b6ef1e789d748b754" # depends_on "cmake" => :build depends_on :x11 # if your formula requires any X11/XQuartz components def install # ENV.deparallelize # if your formula fails when building in parallel # Remove unrecognized options if warned by configure system "./configure", "--disable-debug", "--disable-dependency-tracking", "--disable-silent-rules", "--prefix=#{prefix}" system "cmake", ".", *std_cmake_args system "make", "install" # if this fails, try separate make/make install steps end test do # `test do` will create, run in and delete a temporary directory. # # This test will fail and we won't accept that! It's enough to just replace # "false" with the main program this formula installs, but it'd be nice if you # were more thorough. Run the test with `brew test rarosx`. Options passed # to `brew install` such as `--HEAD` also need to be provided to `brew test`. # # The installed folder is not in the path, so use the entire path to any # executables being tested: `system "#{bin}/program", "do", "something"`. system "false" end end
ä»åã¯ãã«ãæ¸ã¿ããã±ã¼ã¸ãåãè¾¼ãã ããªã®ã§ã以ä¸ã®ããã«ç·¨éãã¾ããã
class Rarosx < Formula desc "rar lab winrar for mac osx command line tools" homepage "" url "http://www.win-rar.com/fileadmin/winrar-versions/rarosx-5.4.0.tar.gz" version "5.4.0" sha256 "09a14f40718c68fc1c24b30acb55d0f2f90f3e13b372c48b6ef1e789d748b754" def install # ENV.deparallelize # if your formula fails when building in parallel bin.install 'rar' end test do #system "false" end end
bin.install ã«ã¤ãã¦
è¦ãããããã¨æãã¾ãããbin.install ãDSLã«ãªã£ã¦ãã¦ãããã使ã£ã¦ãbrew ãã¤ã³ã¹ãã¼ã«ãè¡ã£ã¦ããã¾ãã
rarosx-5.4.0.tgz ãå±éããã¨ä»¥ä¸ã®ããã«ãªã£ã¦ããã
takuya@rar$ tree . . âââ acknow.txt âââ default.sfx âââ license.txt âââ order.htm âââ rar âââ rar.txt âââ rarfiles.lst âââ readme.txt âââ unrar âââ whatsnew.txt
ãã®å±éæ¸ã¿ãã£ã¬ã¯ããªã« cd ( Change directory )ãã¦Working Directoryã«ãããç¶æ ã§ãbrewã¯ä½æ¥ãå§ããã®ã§
Formula å´ã§ã¤ã³ã¹ãã¼ã«ããã¨ãã« ./rar
ãã¡ã¤ã«ãæå®ãã¦ã
def install bin.install 'rar' end
ã¤ã³ã¹ãã¼ã«ããã¹ãããã
Forumla æ¸ãããã次㫠brew install
ã試ãã¦ã¿ãã
takuya@~$ which rar which: no rar in (snip takuya@rar$ brew install --verbose --debug rarosx takuya@~$ which rar /usr/local/bin/rar
ç¡äºã¤ã³ã¹ãã¼ã«ãã§ãããã¨ã確èªããã
次ã«ã¢ã³ã¤ã³ã¹ãã¼ã«ã試ãã¦ã¿ãã
takuya@~$ which rar /usr/local/bin/rar takuya@rar$ brew uninstall --verbose --debug rarosx takuya@~$ which rar which: no rar in (snip
ããã§Formulaä½æãåºæ¥ã
æ¤ã®ã¾ã¾ä½¿ã£ã¦ããããã ãã©ããã£ãããªã®ã§ brew tap ããããã«ãã¦ããã
brew tap ããããã®ã¬ãã¸ããªåã®ã«ã¼ã«
brew tap ããããã«ã¬ãã¸ããªãä½ãã¨ã㯠ã¬ãã¸ããªåã« prefix ã¨ã㦠homebrew-
ãã¤ãã
https://github.com/$USERNAME/homebrew-$FORMULA_NAME
ãã¨ãã°ãç§ã®å ´åã次ã®ãããªã¬ãã¸ããªãä½ã£ãã
https://github.com/takuya/homebrew-winrar-osx
ã¬ãã¸ããªãclone ãã¦Formulaãä½æã
git clone https://github.com/takuya/homebrew-winrar-osx cd homebrew-winrar-osx vim winrar-osx.rb
ä»åã¯ãå ã®ä¾ã¨éã£ã¦ãã¡ã¤ã«åãå¤ããã
Formulaã®ãã¡ã¤ã«åã¨ã¯ã©ã¹åã¯camel_caseã¨CamellCaseã¨ã®å¯¾å¿ã«ãªã£ã¦ããã
ä»å㯠ãã¡ã¤ã«åã次ã®ããã«ããã®ã§ãCamelCaseã«ããã
ãã¡ã¤ã«å winrar-osx.rb ã¯ã©ã¹å class WinrarOsx
Formula ä½ã£ãã git commit && git push
git commit git push
ã¬ãã¸ããªä½ã£ãã brew create ã§ä½ã£ãFormulaã¯ãããããªãã®ã§æ¶ãã¦ãã
rm /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/rarosx.rb
brew 㧠tap ãã
brew tap takuya/winrar-osx
brew install ãã
brew install winrar-osx
ããã§ãã©ããªããã±ã¼ã¸ã§ãæ軽㫠brew install ã§ãããã¯ã¼ä¾¿å©ã
configure / make ãå¿ è¦ãªã¨ã
system './configure' system 'make' bin.install 'name'
ãªã©ã¨ãsystem ã³ãã³ãã§å®è¡ãããã¨ã§å®ç¾ã§ãã
man ãå ¥ããããpatchãå½ã¦ãããããã¨ã¯æ¬å®¶ã®ããã¥ã¢ã«ã«æ¸ãã¦ãã