Friday, April 25, 2014

Build XulRunner with Visual C++ 2013

1. Prerequisites

1.1 MozillaBuild

1.2 Visual Studio Express 2013 for Windows Desktop

1.3 [June 2010 DirectX SDK] http://www.microsoft.com/download/en/details.aspx?displaylang=en&id=6812

  • If you met with S1023 error whiling installing the DirectX SDK, please uninstall all Microsoft Visual C++ 2010 x86/x64 Redistributable packages (See this for details).

2. Source code

  • Download XulRunner source code from here
  • Extract to c:\build\mozilla
  • Apply the patch for vc12
  • Add #include <algorith> to C:\build\mozilla\toolkit\components\protobuf\google\protobuf\wire_format_lite_inl.h

3. Configure (x86)

Create a .mozconfig file in c:\build\mozilla folder. Enter the following content:

mk_add_options MOZ_CO_PROJECT=xulrunner
mk_add_options MOZ_OBJDIR=c:/build/mozilla/obj-x86
ac_add_options --enable-application=xulrunner

ac_add_options --disable-debug
ac_add_options --disable-debug-symbols
ac_add_options --disable-javaxpcom
ac_add_options --disable-tests
ac_add_options --disable-ipdl-tests
ac_add_options --disable-activex
ac_add_options --disable-activex-scripting
ac_add_options --disable-installer
ac_add_options --disable-crashreporter
ac_add_options --disable-updater
ac_add_options --disable-update-channel
ac_add_options --disable-update-packaging
ac_add_options --disable-maintenance-service
ac_add_options --disable-accessibility
ac_add_options --disable-logging
ac_add_options --disable-services-healthreport
ac_add_options --disable-telemetry-reporting 
ac_add_options --disable-parental-controls 
ac_add_options --disable-windows-mobile-components 
ac_add_options --disable-necko-wifi
ac_add_options --disable-pdfjs
ac_add_options --disable-accessibility
ac_add_options --disable-gamepad

ac_add_options --with-windows-version=601

4.Build (x86)

Start /start-shell-msvc2013.bat, and run the commands below.

cd /c/build/mozilla
python build/pymake/make.py  -f client.mk build
python build/pymake/make.py  -f client.mk sdk

Once the build completed, the sdk archive can be found in C:\build\mozilla\obj-x86\dist\sdk.

For more detailed documentation. See Mozilla’s Official Build Instructions

Thursday, April 24, 2014

Download a Folder from Github

Here is way to download a single folder from a Github repository without fully clone the repo.

For example, if you want to download https://github.com/jack/foo/tree/master/bar folder, you could use the command below.

svn checkout https://github.com/jack/foo/trunk/bar

Note that the tree/master is replaced with trunk.

Monday, April 14, 2014

Delete System Files On Windows 7

On Windows 7, system file are protected from being deleted. The following commands can be used to delete system files.

set THE_FILE_TO_DELETE=C:\Windows\IME\IMESC5\DICTS\PINTLGT.IMD
takeown /f %THE_FILE_TO_DELETE%
cacls %THE_FILE_TO_DELETE% /G YourUserName:F
del %THE_FILE_TO_DELETE%

Create Windows PE 5.1 Image

Listed below are the instructsions to create a Windows PE 5.1 x86 disk. To build an amd64 version, replace all ‘x86’ to ‘amd64’ in the commands below.

Prerequisites

Steps

  • Start “Deployment and Imaging Tools Environment” as administrator

  • Copy a basic PE image.

copype x86 C:\WinPE_x86
  • Mount the PE image to local directory
Dism /Mount-Image /ImageFile:"C:\WinPE_x86\media\sources\boot.wim" /index:1 /MountDir:"C:\WinPE_x86\mount"
  • (Optional) Add packages. For example, the following command adds .Net Framework to the PE
Dism /Add-Package /Image:"C:\WinPE_x86\mount" /PackagePath:"C:\Program Files (x86)\Windows Kits\8.1\Assessment and Deployment Kit\Windows Preinstallation Environment\x86\WinPE_OCs\WinPE-NetFx.cab"
  • (Optional) Verify packages using the following command (optional)
Dism /Get-Packages /Image:"C:\WinPE_x86\mount"
  • (Optional) Add thridparty programs. For example, the following command adds 7Zip to the PE
copy "C:\Program Files (x86)\7-Zip\7z*.*" C:\WinPE_x86\mount\Windows\System32
  • (Optional) Change PE boot drive letter. For example the following command change the PE’s boot drive to V:
Dism /image:C\WinPE_x86\mount /Set-TargetPath:V:\
  • Unmount the image and commit changes
Dism /Unmount-Image /MountDir:"C:\WinPE_x86\mount" /commit
  • Deploy the PE image to an ISO
MakeWinPEMedia /ISO C:\WinPE_x86 C:\WinPE_x86\WinPE_x86.iso
  • Deploy the PE image to an USB drive (e.g. U:)
MakeWinPEMedia /UFD C:\WinPE_x86 U: