|
|
LocalizedBuildHowto
สรุปวิธีทำ localized build ของ Firefox
Build บน Mac OS X
อันนี้ทดสอบบน Mac OS X Tiger (10.4) intel ต้องลง Xcode, libidl2, autoconf ด้วย
- checkout source code จาก mozilla CVS ตามปกติเสียก่อน สมมุติว่าเอาใส่ไว้ใน /projects ก็จะได้ไดเรกทอรี mozilla อยู่ข้างใน /projects
- checkout เอา l10n.mk ออกมาจาก mozilla CVS ใช้คำสั่ง (ตอนนี้อยู่ใน /projects)
- สร้างไฟล์ $HOME/.mozconfig ตามนี้ (อันนี้สำหรับ Mac OS X Tiger ถ้า architecture อื่นไม่แน่ใจว่าต้องแก้อะไรบ้าง)
- อันนี้เป็น .mozconfig สำหรับ Universal Binary (ใช้ได้ทั้ง Tiger และ Leopard)
- สร้างไฟล์ locale ต้นแบบจาก en-US ตามนี้ จะได้ /projects/l10n/en-US ออกมา
- checkout เอา po จากใน googlecode svn ที่แปลไว้ออกมา จะได้ /projects/po/th-TH
- ใช้ po2moz สร้างไดเรกทอรีที่จำเป็นสำหรับการทำ th-TH build
- กันเหนียว ให้ก๊อปปี้แฟ้ม l10n/en-US/extensions/reporter/chrome/reporterOverlay.properties ไปใส่ที่ l10n/th/extensions/reporter/chrome/ เพื่อกัน error ว่าหาไฟล์ reporterOverlay.properties ไม่เจอ (คาดว่าเป็นเพราะไฟล์นี้ข้างในมันไม่มี string ทำให้ moz2po ไม่ยอมแปลงออกมาให้ ตอนใช้ po2moz แปลงกลับก็เลยไม่มีตามไปด้วย)
- สั่ง build แล้วไปกินข้าวรอได้เลย (หลาย ชม.)
- เสร็จแล้วจะได้ไดเรกทอรี /projects/objdir/th ออกมา ก็จัดการสร้าง package โดยเข้าไปใน objdir/th แล้วสั่ง make package
- บน Mac OS X ถ้าทำถูกจะได้แฟ้ม firefox-3.0pre.th.mac.dmg ออกมาอยู่ที่ objdir/th/dist (Intel binary) หรือ objdir/th/ppc/dist (Universal binary)
$ cvs -d:pserver:anonymous@cvs-mirror.mozilla.org:/cvsroot co mozilla/client.mk $ cvs -d:pserver:anonymous@cvs-mirror.mozilla.org:/cvsroot co mozilla/browser/config/mozconfig $ cd mozilla $ make -f client.mk checkout
$ cvs -d:pserver:anonymous@cvs-mirror.mozilla.org:/cvsroot co mozilla/tools/l10n/l10n.mk
. $topsrcdir/browser/config/mozconfig ac_add_options --with-macos-sdk=/Developer/SDKs/MacOSX10.4u.sdk ac_add_options --disable-tests ac_add_options --enable-ui-locale=th mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/../objdir/th mk_add_options MOZ_CO_LOCALES=th mk_add_options MOZ_LOCALE_DIRS=@TOPSRCDIR@/../l10n/th
. $topsrcdir/browser/config/mozconfig . $topsrcdir/build/macosx/universal/mozconfig ac_add_options --with-macos-sdk=/Developer/SDKs/MacOSX10.4u.sdk ac_add_options --disable-tests ac_add_options --enable-ui-locale=th-TH ac_add_app_options ppc --enable-prebinding mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/../objdir/th mk_add_options MOZ_CO_LOCALES=th mk_add_options MOZ_LOCALE_DIRS=@TOPSRCDIR@/../l10n/th
$ cd mozilla $ make -f tools/l10n/l10n.mk create-en-US
$ cd /projects $ svn checkout https://thai-l10n.googlecode.com/svn/trunk/po po
หรือสำหรับคนที่มีสิทธิ์เขียน svn ก็สามารถระบุ username ของตัวได้$ svn checkout https://thai-l10n.googlecode.com/svn/trunk/po po --username pittaya
# สร้าง l10n/th โดยใช้ input จาก po/th-TH รวมกับ template จาก l10n/en-US $ po2moz -t l10n/en-US -i po/th-TH -o l10n/th # คนที่มี python2.5 ลงไว้อาจจะต้องบังคับให้ใช้เวอร์ชันอื่น (2.4 หรือต่ำกว่า) $ python2.3 `which po2moz` -t l10n/en-US -i po/th-TH -o l10n/th
$ cd mozilla $ make -f client.mk build
$ cd objdir/th $ make package
ถ้าสั่ง build แบบ Universal binary ต้องเข้าไปอีกที่นึง$ cd objdir/th/ppc $ make package
Build บน (Ubuntu) Linux
ต้องการเนื้อที่ฮาร์ดดิสก์เยอะ ๆ (แนะนำ 2 GB)
ติดตั้งโปรแกรมที่จำเป็น
- CVS และ Subversion ไว้ดึงซอร์สโค้ด, Python ไว้แปลงแฟ้มคำแปล (รุ่น 2.4 หรือต่ำกว่า -- ใช้ 2.5 ไม่ได้) และอื่น ๆ ตามที่แนะนำใน http://developer.mozilla.org/en/docs/Linux_Build_Prerequisites สำหรับคนที่ใช้ Ubuntu 8.04 ให้สั่งตามนี้ได้เลย (ดาวน์โหลดหลายร้อยเมกอยู่)
- ติดตั้งโปรแกรมสร้างแฟ้มคำแปล Translate Toolkit (ดาวน์โหลด -- เลือกไฟล์ .bz2 จะเล็กที่สุด) ใน Ubuntu มีแพคเกจ translate-toolkit ให้ใช้ได้ แต่เราไม่ชัวร์ว่ามันจะไปติดตั้งใน Python รุ่นไหน -- ดังนั้นติดตั้งเองต่างหาก ชัวร์กว่า (วิธีตั้ง default Python)
$ sudo apt-get build-dep firefox-3.0 $ sudo apt-get install cvs subversion python2.4 gcc perl make libgtk2.0-0 \ libgtk2.0-dev libxt-dev libidl-dev zip freetype2-demos fontconfig pkg-config \ libdbus-glib-1-dev curl libcurl3-dev
$ tar xjf translate-toolkit-x.x.x.tar.bz2 $ cd translate-toolkit-x.x.x $ sudo python2.4 setup.py install
เตรียมแฟ้มที่จะ build (ซอร์สโค้ด Firefox และตัวคำแปลไทย)
- ทำตามข้อ 1, 2, 5, 6, 7 ของวิธี build Mac OS X
เริ่ม build
- สร้างไฟล์ $HOME/.mozconfig ตามนี้
- เข้าไปที่ไดเรกทอรีที่เราเอา source code Firefox มาใส่ (เช่น /projects)
- สร้างไดเรกทอรี objdir/th (สคริปต์ build มันไม่ยอมสร้างให้ ไม่รู้ทำไม)
- กันเหนียว ให้ก๊อปปี้แฟ้ม l10n/en-US/extensions/reporter/chrome/reporterOverlay.properties ไปใส่ที่ l10n/th/extensions/reporter/chrome/ เพื่อกัน error ว่าหาไฟล์ reporterOverlay.properties ไม่เจอ (คาดว่าเป็นเพราะไฟล์นี้ข้างในมันไม่มี string ทำให้ moz2po ไม่ยอมแปลงออกมาให้ ตอนใช้ po2moz แปลงกลับก็เลยไม่มีตามไปด้วย)
- สั่ง build แล้วไปกินข้าวรอได้เลย (หลาย ชม. -- build ครั้งหลัง ๆ จะเร็วขึ้น)
- เสร็จแล้วจะได้ไดเรกทอรี /projects/objdir/th ออกมา ก็จัดการสร้าง package โดยเข้าไปใน objdir/th แล้วสั่ง make package
- บน Linux ถ้าทำถูกจะได้แฟ้ม firefox-3.0pre.th.linux-i686.tar.bz2 ออกมาอยู่ที่ objdir/th/dist แฟ้มนี้เวลาจะเอาไปใช้ก็ extract ออกมาใช้ได้เลย ไม่ต้องติดตั้งอะไร
. $topsrcdir/browser/config/mozconfig ac_add_options --disable-tests ac_add_options --enable-ui-locale=th mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/../objdir/th mk_add_options MOZ_CO_LOCALES=th mk_add_options MOZ_LOCALE_DIRS=@TOPSRCDIR@/../l10n/th
$ mkdir -p objdir/th
$ cd mozilla $ make -f client.mk build
$ cd objdir/th $ make package
Build บน Windows
เตรียมการ build
- ติดตั้งโปรแกรมที่จำเป็น ตามที่แนะนำใน http://developer.mozilla.org/en/docs/Windows_Build_Prerequisites ที่จำเป็นคือ
- Visual C++ 2005 Express Edition (หรือรุ่นอื่นๆ ที่สูงกว่า ถ้ามี)
- MS Windows Vista SDK
- MS Windows Server 2003 R2 Platform SDK
- MozillaBuild
- ถ้าใช้ Express Edition ให้โหลดแพตช์ของ guess-msvc.bat และ start-msvc8.bat มาใช้แทนไฟล์ที่มากับ MozillaBuild
- ติดตั้ง Translate Toolkit (ดาวน์โหลด)
- เข้า build shell โดย สั่ง
- จะมี shell โผล่ขึ้นมาให้ใช้งาน สามารถตั้งค่าและ checkout code ออกมาจาก CVS ได้ตามขั้นตอน 1, 2, 5, 6, 7 ของ Mac OS X
- เริ่ม build โดยสร้าง ~/.mozconfig ตามนี้
- เข้าไปที่ไดเรกทอรีที่เราเอา source code Firefox มาใส่ (เช่น /projects)
- สร้างไดเรกทอรี objdir/th (สคริปต์ build มันไม่ยอมสร้างให้ ไม่รู้ทำไม)
- กันเหนียว ให้ก๊อปปี้แฟ้ม l10n/en-US/extensions/reporter/chrome/reporterOverlay.properties ไปใส่ที่ l10n/th/extensions/reporter/chrome/ เพื่อกัน error ว่าหาไฟล์ reporterOverlay.properties ไม่เจอ (คาดว่าเป็นเพราะไฟล์นี้ข้างในมันไม่มี string ทำให้ moz2po ไม่ยอมแปลงออกมาให้ ตอนใช้ po2moz แปลงกลับก็เลยไม่มีตามไปด้วย)
- สั่ง build แล้วไปกินข้าวรอได้เลย (หลาย ชม. -- build ครั้งหลัง ๆ จะเร็วขึ้น)
- เสร็จแล้วจะได้ไดเรกทอรี /projects/objdir/th ออกมา ก็จัดการสร้าง package โดยเข้าไปใน objdir/th แล้วสั่ง make installer
- ถ้าทำถูกจะได้แฟ้ม firefox-3.0pre.th.win32.installer.exe ออกมาอยู่ที่ objdir/th/dist/installer/sea เอาไปติดตั้งได้เหมือนโปรแกรมบน Windows ปกติ
แนะนำว่าให้ติดตั้งโดยใช้ค่า default ให้หมด, การติดตั้งโปรแกรมจาก Microsoft จะเป็น Online Installer
C:\mozilla-build> start-msvc8.bat
. $topsrcdir/browser/config/mozconfig ac_add_options --disable-tests ac_add_options --enable-ui-locale=th mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/../objdir/th mk_add_options MOZ_CO_LOCALES=th mk_add_options MOZ_LOCALE_DIRS=@TOPSRCDIR@/../l10n/th ac_add_options --disable-parental-controls # ใส่บรรทัดนี้ถ้าจะ build สำหรับ windows XP เท่านั้น
$ mkdir -p objdir/th
$ cd mozilla $ make -f client.mk build
$ cd objdir/th $ make installer
ลิงก์ที่เกี่ยวข้อง
Sign in to add a comment
