Merge mozilla-central to autoland. a=merge CLOSED TREE
[gecko.git] / other-licenses / 7zstub / README.mozilla
blob1a16b187d3ec98759824f61dff773fd5eef3f968
1 This directory contains the LZMA SDK code used in building the self-extracting
2 Windows installer.
4 The src/ directory contains an almost-unmodified copy of the 7-zip source code
5 version 18.05, as downloaded from https://www.7-zip.org/a/lzma1805.7z (linked
6 from https://www.7-zip.org/sdk.html) on August 30, 2018. As stated in
7 DOC/lzma-sdk.txt and on the web page, this code is in the public domain. A few
8 modifications have been made to this copy of the source code. Those
9 modifications are contained in mozilla_customizations.diff, which should be
10 found in the same directory as this file.
12 The firefox/ directory contains several things:
13 * SFXSetup.sln and SFXSetup.vcxproj
14   These are Visual Studio 2017 conversions of the Visual C++ 6 workspace and
15   project files from the src/CPP/7zip/Bundles/SFXSetup/ directory, with
16   some changes and additions to support AArch64 and to include our resources.
17 * 7zSD.arm64.manifest and 7zSD.win32.manifest
18   We need to add a manifest file to the binary for several reasons, and one
19   isn't supplied with the source package (Visual C++ 6 doesn't support them),
20   so we've written our own.
21 * setup.ico
22   The icon group used for the installer package.
23 * resource.rc
24   The resource script containing the above manifest and icon references, as
25   well as other resources we need. This is derived from the supplied SFXSetup
26   resource.rc, but heavily customized.
27 * 7zSD.ARM64.sfx
28   AArch64 binary built using all the above files. Checking this into the tree in
29   compiled binary form means that packaging the installer does not require
30   having a compiler toolchain configured (which is the case for artifact
31   builds). To compile your own version of this file, open SFXSetup.sln and build
32   the ReleaseD configuration.
33 * 7zSD.Win32.sfx
34   32-bit x86 binary built using some of the above files. Checking this into the
35   tree in compiled binary form means that packaging the installer does not
36   require having a compiler toolchain configured (which is the case for artifact
37   builds). To compile your own version of this file, open SFXSetup.sln and build
38   the ReleaseD configuration.
40 Making Future src Customizations
41 --------------------------------
43 When we make future customizations, they should be made both to the source
44 files, and to `mozilla_customizations.diff`. Ideally, this should be done in a
45 consistent way so that the changes to `mozilla_customizations.diff` are at
46 least somewhat readable in code review rather than just being a complete
47 rewrite of the file every time. Following these steps should accomplish this.
49   1) Start with a clean copy of mozilla-central.
50   2) Download a copy of the LZMA SDK. This is no longer available from the
51      original 7-zip.org download URL given above, but it is available on
52      [SourceForge](https://sourceforge.net/projects/sevenzip/files/LZMA%20SDK/lzma1805.7z/download).
53   3) The downloaded archive will contain 7 directories. 7 directories with
54      matching names are located in `other-licenses\7zstub\src`. Recursively copy
55      the extracted directories, overwriting all files.
56   4) Make a Mercurial commit: `hg commit`. For convenience referring to this
57      commit later, you can bookmark it: `hg bookmark -if orig7z`.
58   5) Update back to central: `hg up central`.
59   6) Generate a diff and check that it matches `mozilla_customizations.diff`:
60      `hg diff --from=orig7z --to=central --unified=3 | diff - other-licenses/7zstub/mozilla_customizations.diff`
61      If there are any changes (say `hg diff`'s output format changed), it may be
62      good to re-generate `mozilla_customizations.diff` and commit it separately.
63   7) Make the new customizations.
64   8) Build the new `7zSD.ARM64.sfx` and `7zSD.Win32.sfx`.
65      This may require that the Visual Studio Installer be re-run to add the
66      ARM64 toolchain, if you don't already have it. The current latest is called
67      "MSVC v143 - VS 2022 C++ ARM64/ARM64EC build tools (latest)".
68      Once the necessary tools are available, open SFXSetup.sln.
69      It may ask if you want to use the latest toolset versions rather than the
70      ones specified by the project, which should be fine.
71      Select the "ReleaseD" solution configuration and the "ARM64" platform and
72      build in order to build `7zSD.ARM64.sfx`. Then select the "x86" platform
73      and build again to get `7zSD.Win32.sfx`.
74   9) Move the new binaries into place and delete the other build files that we
75      do not need.
76      ```
77      mv other-licenses/7zstub/firefox/Win32/ReleaseD/7zSD.Win32.sfx other-licenses/7zstub/firefox/
78      mv other-licenses/7zstub/firefox/ARM64/ReleaseD/7zSD.ARM64.sfx other-licenses/7zstub/firefox/
79      rm -rf other-licenses/7zstub/firefox/ARM64/
80      rm -rf other-licenses/7zstub/firefox/Win32/
81      ```
82   8) Regenerate `mozilla_customizations.diff`:
83      `hg diff --from=orig7z --unified=3 -I other-licenses/7zstub/src/ > other-licenses/7zstub/mozilla_customizations.diff`