packagemakerã³ãã³ãã§ã¤ã³ã¹ãã¼ã©ãã¤ãã
ãã®è¨äºã¯ Mac Dev JP Advent Calendar ã®åå è¨äºï¼17æ¥ç®ï¼ã§ãã
ä»æ¥ã¯ç§ãéçºã«åå ãã¦ããRubyCocoaãã¢ãã«ã«ãpackagemakerã³ãã³ãã§ã¤ã³ã¹ãã¼ã©ããã±ã¼ã¸ãä½æããæé ãç´¹ä»ãã¾ãã
PackageMakerã¨ã¯
PackageMakerã¯ãã¤ã³ã¹ãã¼ã©ãã¢ããªã±ã¼ã·ã§ã³ã§ã¤ã³ã¹ãã¼ã«ããã¨ãã«ä½¿ãã.pkgã.mpkgã¨ãã£ãããã±ã¼ã¸ãä½æããã½ããã¦ã§ã¢ã§ãã
é常ã®ã¢ããªã±ã¼ã·ã§ã³ã¯ã¤ã³ã¹ãã¼ã©ã§ãªãããã£ã¹ã¯ã¤ã¡ã¼ã¸ãªã©ã®ä¸ã«.appãã¡ã¤ã«ãå ¥ãã¦ãããã¦ã¼ã¶ãèªç±ã«é ç½®ã§ããããã«ãã¦ããã®ãä¸è¬çã§ããã¤ã³ã¹ãã¼ã©ã使ç¨ããã¤ã³ã¹ãã¼ã«ãé©ãã¦ããã®ã¯ãã決ããããä½ç½®ã«ãã¡ã¤ã«ãã¤ã³ã¹ãã¼ã«ããããã¨ãæ±ããããå ´åã§ãããã¨ãã°ã
- ç°å¢è¨å®ããã«ï¼.prefPaneï¼ - Library/PreferencePanes/
- ããªæ¼¢åå¤æãªã©ã®ã¤ã³ãããã¡ã½ããï¼.appï¼ - Library/Input Methods/
- ãµã¼ãã¹ï¼.app, .serviceï¼ - Library/Services/
- æ±ç¨ã®ãã¬ã¼ã ã¯ã¼ã¯ï¼.frameworkï¼ - Library/Frameworks/
- å¤æ°ã®ãã¡ã¤ã«ãããããé ç½®ããï¼Xcode, MacPortsãªã©ï¼
ãªã©ã§ããããããé
å¸ããã¨ãã¯ãã¦ã¼ã¶ã«é©åãªå ´æã«ã³ãã¼ããããä¾é ¼ããããããã¤ã³ã¹ãã¼ã©ã§èªåçã«æ±ºããããå ´æã«é
ç½®ãããããã«ãªã£ã¦ããã»ãã親åã£ã¦ããã§ãã
GUIã§ãªãã³ãã³ãã使ãçç±
PackageMakerã«ã¯ããã§ç´¹ä»ããã³ãã³ãã®ä»ã«ãGUIã®ã¢ããªã±ã¼ã·ã§ã³ãããã¾ããã¨ããããã¡ããæ¬å®¶ã§ãã
ä¸è¬è«ã§ã¯ããã¾ãããã³ãã³ãã®ã»ããèªååãç¹°ãè¿ãã®ãªãã¬ã¼ã·ã§ã³ã«é©ãã¦ãã¾ããããã¯PackageMakerã«ããã¦ã¯ã¾ããRubyCocoaã§ã¯2006å¹´ãããããªãªã¼ã¹ç¨ã®ã¤ã³ã¹ãã¼ã©ã®ä½æã¯ä»¥ä¸ã®ã³ãã³ãä¸çºã«ãªã£ã¦ãã¾ãã
% ruby install.rb package # ã¾ã㯠rake package
packagemakerã³ãã³ãã®ä½¿ãæ¹
ãªã«ã¯ã¨ãããmanã§ããpackagemaker(1)ãæå¾ã«ããEXAMPLESãè¦ãã¨æããã¤ãããã®ã§ã¯ãªããã¨æãã¾ãã
- packagemaker -root: æ°ããæ¸ãæ¹(10.5-)
- packagemaker -build: å¤ãæ¸ãæ¹(-10.4) manã®ä¸ã®ã»ã
ã©ã¡ãã§ãã¤ã³ã¹ãã¼ã©ãåæ§ã«ä½æã§ãã¾ããã10.5以éã®1ãã¡ã¤ã«(ãã³ãã«ã§ãªããã©ãã)ã®ã¤ã³ã¹ãã¼ã©ã¯æ°ããæ¸ãæ¹ã§ããä½æã§ãã¾ãããæ°ã¹ã¿ã¤ã«ã®ã»ãã¯.pkgãåä¸ã®ãã¡ã¤ã«ã¨ãªããããé å¸ã«.dmgã.zipã§åºããªãã¦ããããç½²åã§ããã¨ããã¡ãªãããããã¾ãã
ãã©ãããª.pkg
% ls -l InstallXcodeLion.pkg -rw-r--r-- 1 kimuraw staff 3189834552 Jul 19 12:08 /Volumes/Install Xcode/InstallXcodeLion.pkg % xar -t -f InstallXcodeLion.pkg Distribution InstallXcodeLion.pkg InstallXcodeLion.pkg/Bom InstallXcodeLion.pkg/PackageInfo InstallXcodeLion.pkg/Payload Resources Resources/English.lproj Resources/English.lproj/License.rtf Resources/English.lproj/Localizable.strings
ãã³ãã«å½¢å¼ã®.pkg
% ls -la RubyCocoa-1.0.2-OSX10.7.pkg total 0 drwxr-xr-x 3 kimuraw staff 102 Dec 17 14:29 ./ drwxr-xr-x 6 kimuraw staff 204 Dec 17 14:29 ../ drwxr-xr-x 7 kimuraw staff 238 Dec 17 14:29 Contents/
RubyCocoaã§ã¯å¤ãæ¸ãæ¹ã®ããã«ããã±ã¼ã¸ã¹ã¯ãªãããä½æãã¦ããã®ã¾ã¾åé¡ãèµ·ãã¦ãªãã¨ãããã¨ã§ããã®ã¾ã¾ã«ãªã£ã¦ãã¾ãã
å®éã®ä½¿ç¨
- ã¤ã³ã¹ãã¼ã«ãããã¡ã¤ã«
- ReadMe, Licenseãªã©ã®ã¤ã³ã¹ãã¼ã©ã«è¡¨ç¤ºããå 容
- Info.plist
- Description.plist
ããããç¨æãã¦ãpackagemakerã³ãã³ãã§.pkgãã¡ã¤ã«ãä½æãã¾ãã
Info.plist
Info.plistã§ã¯ãã¼ã¸ã§ã³ãèå¥åã®ã»ãã«ãã¤ã³ã¹ãã¼ã«ã«å¿ è¦ãªè¦ä»¶ãæå®ãããã¨ãã§ãã¾ãããã¨ãã°ãRubyCocoaã§ã¯ã¤ã³ã¹ãã¼ã«ã§ããã·ã¹ãã ã®ãã¼ã¸ã§ã³ãå¶éãã¦ãã¾ãã
<key>IFRequirementDicts</key> <array> <dict> <key>SpecArgument</key> <string>/System/Library/CoreServices/SystemVersion.plist</string> <key>SpecProperty</key> <string>ProductVersion</string> <key>SpecType</key> <string>plist</string> <key>TestObject</key> <string>10.7</string> <key>TestOperator</key> <string>>=</string> </dict> <dict> <key>SpecArgument</key> <string>/System/Library/CoreServices/SystemVersion.plist</string> <key>SpecProperty</key> <string>ProductVersion</string> <key>SpecType</key> <string>plist</string> <key>TestObject</key> <string>10.8</string> <key>TestOperator</key> <string><</string> </dict> </array>
æ®å¿µãªããç¾å¨ã®Appleã®ããã¥ã¡ã³ãã«ã¯ãããã®è©³ç´°ã¯è¨è¼ããã¦ãã¾ãããTigerãLeopardããã®ããã¥ã¡ã³ãã«ã¯ãã£ãã¨æãã¾ãã
ã³ãã³ãå®è¡
ããããç¨æããããã¨ã¯ã³ãã³ãã®å®è¡ã§ãã
% packagemaker -build \ -p work/RubyCocoa-1.0.2-OSX10.7/RubyCocoa-1.0.2-OSX10.7.pkg \ -f work/files \ -r work/resources \ -i work/Info.plist \ -d work/Description.plist
çµããã«
ãããããã®è¨äºãæ¸ãã«ããã£ã¦ãæ°ãã-rootãªãã·ã§ã³ã使ç¨ããã³ãã³ãã試ãã¦ã¿ãã®ã§ãããReadMeãLicenseã表示ãããæé ããããã¾ããã§ããï¼-resourcesã«æå®ããå ´æã«ç½®ãã¦ããã¡ï¼ããåç¥ã®æ¹ã¯æãã¦ãã ããï¼
æ°ããpkgbuildコマンドã«ã¤ãã¦ãç¥ãããã§ãï¼