1Build the calibre installers, including all dependencies from scratch
2=======================================================================
3
4This folder contains code to automate the process of building calibre,
5including all its dependencies, from scratch, for all platforms that calibre
6supports.
7
8In general builds proceed in two steps, first build all the dependencies, then
9build the calibre installer itself.
10
11Requirements
12---------------
13
14Building *must* run on a Linux computer.
15
16First create some empty top level directory and run the following commands::
17
18    git clone https://github.com/kovidgoyal/bypy.git
19    git clone https://github.com/kovidgoyal/calibre.git
20    cd bypy && git switch qt5 && cd ../calibre
21
22Now we need to bootstrap calibre, for which all its Linux build dependencies
23must have already been installed (see the `Dependencies
24<https://calibre-ebook.com/download_linux>`_ section of the Linux installation
25page for details). Once the dependencies are installed, run::
26
27    ./setup.py bootstrap
28
29To make the Windows and macOS builds it uses QEMU VMs. Instructions on
30creating the VMs are in the bypy repo under :file:`virtual_machine/README.rst`.
31Required software for the VMs are listed in :file:`bypy/windows.conf` and
32:file:`bypy/macos.conf`.
33
34Linux
35-------
36
37To build the 64bit and 32bit dependencies for calibre, run::
38
39    ./setup.py build_dep linux
40    ./setup.py build_dep linux 32
41
42The output (after a very long time) will be in :literal:`bypy/b/linux/[32|64]`
43
44Now you can build the calibre Linux tarballs with::
45
46    ./setup.py linux
47
48The output will be in :literal:`dist`
49
50
51macOS
52--------------
53
54Name the QEMU VM using ``vm_name`` from :literal:`bypy/macos.conf`.
55Make sure all software mentioned in :file:`bypy/macos.conf` is installed.
56To build the dependencies for calibre, run::
57
58    ./setup.py build_dep macos
59
60The output (after a very long time) will be in :literal:`bypy/b/macos`.
61Now you can build the calibre ``.dmg`` with::
62
63    ./setup.py osx --dont-sign --dont-notarize
64
65The output will be in :literal:`dist`
66
67
68Windows
69-------------
70
71Name the QEMU VM using ``vm_name`` from :file:`bypy/windows.conf`.
72Make sure all software mentioned in :file:`bypy/windows.conf` is installed.
73
74To build the dependencies for calibre, run::
75
76    ./setup.py build_dep windows
77    ./setup.py build_dep windows 32
78
79The output (after a very long time) will be in :literal:`bypy/b/windows/[32|64]`.
80Now you can build the calibre windows installers with::
81
82    ./setup.py win --dont-sign
83
84The output will be in :literal:`dist`
85