Lucio Andrés Illanes Albornoz 11a356
> N.B. If you're interested in building Midipix using this script, please join the project's
Lucio Andrés Illanes Albornoz 93594d
IRC channel #midipix on Freenode and ask for the address of the internal repositories.
Lucio Andrés Illanes Albornoz 93594d
Lucio Andrés Illanes Albornoz d2a06e
> N.B. If in doubt, consult the fault-tolerant & highly optimised 3D laser show-equipped
Lucio Andrés Illanes Albornoz 2b85d0
usage screen w/ ./build.sh -h or a hungry lion might eat you alive.
Lucio Andrés Illanes Albornoz d2a06e
Lucio Andrés Illanes Albornoz 17bbee
## Building a midipix distribution
Lucio Andrés Illanes Albornoz (arab, vxp) d3b354
A Midipix distribution consists of the following:
Lucio Andrés Illanes Albornoz cf57b4
* the native Midipix toolchain, consisting of perk, gcc, its dependencies,
Lucio Andrés Illanes Albornoz cf57b4
  and binutils,
Lucio Andrés Illanes Albornoz cf57b4
* musl, a lightweight, fast, simple, and free libc[1] used by Midipix,
Lucio Andrés Illanes Albornoz cf57b4
* the Midipix runtime components that bridge the gap between the libc and the
Lucio Andrés Illanes Albornoz cf57b4
  executive subsystems of all Windows NT-derived Windows OS starting with and
Lucio Andrés Illanes Albornoz cf57b4
  including Windows XP, and
Lucio Andrés Illanes Albornoz cf57b4
* a steadily increasing number of 3rd party open source packages, as expected in
Lucio Andrés Illanes Albornoz 584601
  any modern POSIX-compliant \*nix environment, including GNU coreutils, shells,
Lucio Andrés Illanes Albornoz cf57b4
  libraries such as ncurses, libressl, as well as Perl and Python.
Lucio Andrés Illanes Albornoz (arab, vxp) d3b354
Lucio Andrés Illanes Albornoz 17bbee
Install the build-time dependencies listed below, clone this repository, and run the
Lucio Andrés Illanes Albornoz 17bbee
following command line within the latter:  
Lucio Andrés Illanes Albornoz 17bbee
Lucio Andrés Illanes Albornoz 17bbee
```shell
Lucio Andrés Illanes Albornoz 17bbee
./build.sh -a nt64 -b release -D minipix,zipdist -P -v
Lucio Andrés Illanes Albornoz 17bbee
```
Lucio Andrés Illanes Albornoz 17bbee
Lucio Andrés Illanes Albornoz 17bbee
### Build-time dependencies
Lucio Andrés Illanes Albornoz 0bd166
* **Alpine Linux**: binutils bzip2 cmake coreutils curl findutils g++ gawk gcc git grep gzip libc-dev linux-headers lzip make musl-dev net-tools patch perl perl-xml-parser procps sed tar util-linux wget xz zip
Lucio Andrés Illanes Albornoz 154acf
* **Debian/-derived Linux**: binutils bzip2 clzip cmake coreutils curl findutils g++ gawk gcc git grep gzip hostname libc6-dev libxml-parser-perl lzma make patch perl procps sed tar util-linux wget xz-utils zip
Lucio Andrés Illanes Albornoz 0bd166
* **OpenSUSE Linux**: binutils bzip2 cmake coreutils curl findutils gawk gcc gcc-c++ git grep gzip hostname linux-glibc-devel lzip make patch perl perl-XML-Parser procps sed tar util-linux wget xz zip
Lucio Andrés Illanes Albornoz (arab, vxp) d3b354
Lucio Andrés Illanes Albornoz 317b61
> N.B. Busybox is not supported.
Lucio Andrés Illanes Albornoz 317b61
Lucio Andrés Illanes Albornoz 11a356
> N.B. Some packages (*coreutils*, *grep*, and *tar*, among others) override
Lucio Andrés Illanes Albornoz 11a356
Alpine's BusyBox utilities of the same name, as the latter are either non-
Lucio Andrés Illanes Albornoz 11a356
conformant or defective.
Lucio Andrés Illanes Albornoz (arab, vxp) d3b354
Lucio Andrés Illanes Albornoz 587bf9
## Common tasks
Lucio Andrés Illanes Albornoz 587bf9
Rebuild set of packages in isolation, along w/ their dependencies, if any, as needed,
Lucio Andrés Illanes Albornoz 587bf9
or forcibly, respectively:
Lucio Andrés Illanes Albornoz 587bf9
```shell
Lucio Andrés Illanes Albornoz 587bf9
./build.sh [ ... ] -r mc,zsh
Lucio Andrés Illanes Albornoz 587bf9
./build.sh [ ... ] -r \*mc,zsh
Lucio Andrés Illanes Albornoz 587bf9
./build.sh [ ... ] -r \*\*mc,zsh
Lucio Andrés Illanes Albornoz 587bf9
```
Lucio Andrés Illanes Albornoz 587bf9
Lucio Andrés Illanes Albornoz 587bf9
Rebuild entire build group:
Lucio Andrés Illanes Albornoz 587bf9
```shell
Lucio Andrés Illanes Albornoz 587bf9
./build.sh [ ... ] -r ALL native_runtime
Lucio Andrés Illanes Albornoz 587bf9
```
Lucio Andrés Illanes Albornoz 587bf9
Lucio Andrés Illanes Albornoz 317b61
## Non-exhaustive list of build variables
Lucio Andrés Illanes Albornoz 317b61
The following variables are primarily defined in ``midipix.env`` and may be overriden
Lucio Andrés Illanes Albornoz 317b61
on a per-build basis on the command-line after the last argument, if any, e.g.:
Lucio Andrés Illanes Albornoz 317b61
Lucio Andrés Illanes Albornoz 317b61
```shell
Lucio Andrés Illanes Albornoz 317b61
./build.sh -a nt64 -b release -D minipix,zipdist -P -v PREFIX_ROOT="${HOME}/midipix_tmp"
Lucio Andrés Illanes Albornoz 317b61
```
Lucio Andrés Illanes Albornoz 317b61
Lucio Andrés Illanes Albornoz 317b61
Furthermore, ``${HOME}/midipix_build.vars``, ``${HOME}/.midipix_build.vars``, and/or
Lucio Andrés Illanes Albornoz 317b61
``../midipix_build.vars`` are sourced during build initialisation and may contain
Lucio Andrés Illanes Albornoz 317b61
additional overrides, particularly ``${DEFAULT_GITROOT_HEAD}``.
Lucio Andrés Illanes Albornoz 317b61
Lucio Andrés Illanes Albornoz 317b61
| Variable name    | Default value                   | Description                                                                   |
Lucio Andrés Illanes Albornoz 317b61
| ---------------- | ------------------------------- | ----------------------------------------------------------------------------- |
Lucio Andrés Illanes Albornoz 317b61
| ARCH             | nt64                            | Target 32-bit (nt32) or 64-bit (nt64) architecture                            |
Lucio Andrés Illanes Albornoz 317b61
| BUILD            | debug                           | Build w/ debugging (debug) or release compiler flags                          |
Lucio Andrés Illanes Albornoz 317b61
| BUILD_DLCACHEDIR | ${PREFIX_ROOT}/dlcache          | Absolute pathname to package downloads cache root directory                   |
Lucio Andrés Illanes Albornoz 317b61
| BUILD_WORKDIR    | ${PREFIX}/tmp                   | Absolute pathname to temporary package build root directory                   |
Lucio Andrés Illanes Albornoz 317b61
| PREFIX           | ${PREFIX_ROOT}/${ARCH}/${BUILD} | Absolute pathname to architecture- & build type-specific build root directory |
Lucio Andrés Illanes Albornoz 317b61
| PREFIX_CROSS     | ${PREFIX}/${DEFAULT_TARGET}     | Absolute pathname to toolchain root directory                                 |
Lucio Andrés Illanes Albornoz 317b61
| PREFIX_MINGW32   | ${PREFIX}/x86_64-w64-mingw32    | Absolute pathname to MinGW toolchain root directory                           |
Lucio Andrés Illanes Albornoz 317b61
| PREFIX_MINIPIX   | ${PREFIX}/minipix               | Absolute pathname to minipix distribution root directory                      |
Lucio Andrés Illanes Albornoz 317b61
| PREFIX_NATIVE    | ${PREFIX}/native                | Absolute pathname to cross-compiled packages root directory                   |
Lucio Andrés Illanes Albornoz 317b61
| PREFIX_ROOT      | ${HOME}/midipix                 | Absolute pathname to top-level directory                                      |
Lucio Andrés Illanes Albornoz 317b61
| PREFIX_RPM       | ${PREFIX}/rpm                   | Absolute pathname to package RPM archive root directory                       |
Lucio Andrés Illanes Albornoz 317b61
Lucio Andrés Illanes Albornoz 342580
The following variables are package-specific and receive their value from either
Lucio Andrés Illanes Albornoz 342580
top-level defaults defined in ``midipix.env``, build group-specific defaults from
Lucio Andrés Illanes Albornoz 342580
the build group the package pertains to and defined in its corresponding file beneath
Lucio Andrés Illanes Albornoz 342580
``groups/``, or package-specific overrides defined either in the latter and/or in
Lucio Andrés Illanes Albornoz aa78ae
its corresponding file beneath ``vars/``. Additionally, overrides may be specified
Lucio Andrés Illanes Albornoz aa78ae
on a per-build basis on the command-line after the last argument, with each variable
Lucio Andrés Illanes Albornoz aa78ae
prefixed w/ ``PKG_``, e.g.: ``./build.sh [ ... ] PKG_ZSH_CC="/bin/false"``.
Lucio Andrés Illanes Albornoz aa78ae
The minimum set of package variables that must be provided is ``SHA256SUM, URL, VERSION``
Lucio Andrés Illanes Albornoz aa78ae
and ``URLS_GIT``, respectively.
Lucio Andrés Illanes Albornoz 342580
Lucio Andrés Illanes Albornoz 342580
| Package variable name       | Description                                                                                                                             |
Lucio Andrés Illanes Albornoz 342580
| --------------------------- | --------------------------------------------------------------------------------------------------------------------------------------- |
Lucio Andrés Illanes Albornoz 342580
| AR                          | Command- or pathname of toolchain library archive editor (ar(1))                                                                        |
Lucio Andrés Illanes Albornoz 342580
| BASE_DIR                    | Absolute pathname to package build root directory beneath ${BUILD_WORKDIR}                                                              |
Lucio Andrés Illanes Albornoz 342580
| BUILD_DIR                   | Directory name of package build directory beneath ${PKG_BASE_DIR}                                                                       |
Lucio Andrés Illanes Albornoz 342580
| BUILD_STEPS_DISABLE         | List of build steps to disable during package build                                                                                     |
Lucio Andrés Illanes Albornoz 342580
| BUILD_TYPE                  | Cross-compiled toolchain (cross,) host (host,) or cross-compiled package build type                                                     |
Lucio Andrés Illanes Albornoz 342580
| CC                          | Command- or pathname of toolchain C compiler (cc(1))                                                                                    |
Lucio Andrés Illanes Albornoz 342580
| CFLAGS_BUILD_EXTRA          | Additional C compiler flags during package (make(1)) build                                                                              |
Lucio Andrés Illanes Albornoz 342580
| CFLAGS_CONFIGURE            | C compiler flags during package (autotools or similar) configuration                                                                    |
Lucio Andrés Illanes Albornoz 342580
| CFLAGS_CONFIGURE_EXTRA      | Additional C compiler flags during package (GNU autotools or similar) configuration                                                     |
Lucio Andrés Illanes Albornoz 342580
| CONFIG_CACHE                | List of GNU autotools configuration cache variables                                                                                     |
Lucio Andrés Illanes Albornoz 342580
| CONFIG_CACHE_EXTRA          | Additional list of GNU autotools configuration cache variables                                                                          |
Lucio Andrés Illanes Albornoz 342580
| CONFIG_CACHE_LOCAL          | Additional list of GNU autotools configuration cache variables                                                                          |
Lucio Andrés Illanes Albornoz 342580
| CONFIGURE                   | Command- or pathname to package (GNU autotools or similar) configuration script                                                         |
Lucio Andrés Illanes Albornoz 342580
| CONFIGURE_ARGS              | List of arguments to package (GNU autotools or similar) configuration script                                                            |
Lucio Andrés Illanes Albornoz 342580
| CONFIGURE_ARGS_EXTRA        | Additional list of arguments to package (GNU autotools or similar) configuration script                                                 |
Lucio Andrés Illanes Albornoz 342580
| CXX                         | Command- or pathname of toolchain C++ compiler (c++(1))                                                                                 |
Lucio Andrés Illanes Albornoz 342580
| CXXFLAGS_CONFIGURE          | List of C++ compiler flags during package (autotools or similar) configuration                                                          |
Lucio Andrés Illanes Albornoz 342580
| CXXFLAGS_CONFIGURE_EXTRA    | Additional list of C++ compiler flags during package (autotools or similar) configuration                                               |
Lucio Andrés Illanes Albornoz 342580
| DEPENDS                     | List of package-package dependencies                                                                                                    |
Lucio Andrés Illanes Albornoz 342580
| DESTDIR                     | Directory name of package installation destination directory beneath ${PKG_BASE_DIR}                                                    |
Lucio Andrés Illanes Albornoz 342580
| DISABLED                    | Disable package                                                                                                                         |
Lucio Andrés Illanes Albornoz 342580
| ENV_VARS_EXTRA              | List of double colon-separated environment variable equality sign-separated name-value pairs to set during package build                |
Lucio Andrés Illanes Albornoz 342580
| FNAME                       | Filename of package archive file                                                                                                        |
Lucio Andrés Illanes Albornoz 342580
| GITROOT                     | midipix packages Git URL prefix                                                                                                         |
Lucio Andrés Illanes Albornoz 342580
| INHERIT_FROM                | Inherit variables from named package                                                                                                    |
Lucio Andrés Illanes Albornoz 342580
| INSTALL_FILES               | Whitespace-separated list of files to manually install into the package installation destination directory beneath ${PKG_BASE_DIR}      |
Lucio Andrés Illanes Albornoz 342580
| INSTALL_FILES_DESTDIR       | Whitespace-separated list of files to initialise the package installation destination directory beneath ${PKG_BASE_DIR} with            |
Lucio Andrés Illanes Albornoz 342580
| INSTALL_FILES_DESTDIR_EXTRA | Additional whitespace-separated list of files to initialise the package installation destination directory beneath ${PKG_BASE_DIR} with |
Lucio Andrés Illanes Albornoz 342580
| INSTALL_TARGET              | Name of package build make(1) installation target                                                                                       |
Lucio Andrés Illanes Albornoz 342580
| INSTALL_TARGET_EXTRA        | Additional name of package build make(1) installation target                                                                            |
Lucio Andrés Illanes Albornoz 342580
| IN_TREE                     | Build package in-tree within ${PKG_SUBDIR}                                                                                              |
Lucio Andrés Illanes Albornoz 342580
| LDFLAGS_BUILD_EXTRA         | Additional linker flags during package (make(1)) build                                                                                  |
Lucio Andrés Illanes Albornoz 342580
| LDFLAGS_CONFIGURE           | Linker flags during package (autotools or similar) configuration                                                                        |
Lucio Andrés Illanes Albornoz 342580
| LDFLAGS_CONFIGURE_EXTRA     | Additional linker flags during package (autotools or similar) configuration                                                             |
Lucio Andrés Illanes Albornoz 342580
| LIBTOOL                     | Command- or pathname of libtool                                                                                                         |
Lucio Andrés Illanes Albornoz 342580
| MAKE                        | Command line of make(1)                                                                                                                 |
Lucio Andrés Illanes Albornoz 342580
| MAKEFLAGS_BUILD             | List of make(1) flags during package (make(1)) build                                                                                    |
Lucio Andrés Illanes Albornoz 342580
| MAKEFLAGS_BUILD_EXTRA       | Additional list of make(1) flags during package (make(1)) build                                                                         |
Lucio Andrés Illanes Albornoz 342580
| MAKEFLAGS_INSTALL           | List of make(1) flags during package (make(1)) installation                                                                             |
Lucio Andrés Illanes Albornoz 342580
| MAKEFLAGS_INSTALL_EXTRA     | Additional list of make(1) flags during package (make(1)) installation                                                                  |
Lucio Andrés Illanes Albornoz 342580
| MAKE_INSTALL_VNAME          | Variable name of make(1) installation destination directory variable during package (make(1)) installation                              |
Lucio Andrés Illanes Albornoz 342580
| NO_CLEAN                    | Inhibit cleaning of package build directory beneath ${PKG_BASE_DIR} pre-finish                                                          |
Lucio Andrés Illanes Albornoz 342580
| NO_CLEAN_BASE_DIR           | Inhibit cleaning of package build root directory beneath ${BUILD_WORKDIR}                                                               |
Lucio Andrés Illanes Albornoz 342580
| NO_LOG_VARS                 | Inhibit logging of build & package variables pre-package build                                                                          |
Lucio Andrés Illanes Albornoz 342580
| PATCHES_EXTRA               | Additional list of patches to apply                                                                                                     |
Lucio Andrés Illanes Albornoz 342580
| PKG_CONFIG                  | Command- or pathname of pkg-config(1)                                                                                                   |
Lucio Andrés Illanes Albornoz 342580
| PKG_CONFIG_PATH             | pkg-config(1) search path                                                                                                               |
Lucio Andrés Illanes Albornoz 342580
| PKGLIST_DISABLE             | Inhibit inclusion into ${PREFIX}/pkglist.${PKG_BUILD_TYPE}                                                                              |
Lucio Andrés Illanes Albornoz 342580
| PREFIX                      | Absolute pathname of top-level installation directory and package search path                                                           |
Lucio Andrés Illanes Albornoz 342580
| PYTHON                      | Command- or pathname of Python                                                                                                          |
Lucio Andrés Illanes Albornoz 342580
| RANLIB                      | Command- or pathname of toolchain library archive index generator (ranlib(1))                                                           |
Lucio Andrés Illanes Albornoz 342580
| RPM_DISABLE                 | Inhibit creation of RPM archive                                                                                                         |
Lucio Andrés Illanes Albornoz 342580
| SHA256SUM                   | SHA-256 message digest of package archive                                                                                               |
Lucio Andrés Illanes Albornoz 342580
| SUBDIR                      | Name of extracted archive or git-{clone,pull}(1)'d directory                                                                            |
Lucio Andrés Illanes Albornoz 342580
| TARGET                      | Dash-separated {build,host,target} triplet                                                                                              |
Lucio Andrés Illanes Albornoz 342580
| URL                         | URL to package archive                                                                                                                  |
Lucio Andrés Illanes Albornoz 342580
| URLS_GIT                    | List of package Git URL(s) (*name*=*URL*@*branch*)                                                                                      |
Lucio Andrés Illanes Albornoz 342580
| VERSION                     | Package version                                                                                                                         |
Lucio Andrés Illanes Albornoz 342580
Lucio Andrés Illanes Albornoz 11a356
## References
Lucio Andrés Illanes Albornoz 11a356
* ``Sun, 25 Apr 2016 09:04:08 +0000 [1]`` musl FAQ  
Lucio Andrés Illanes Albornoz 11a356
  
Lucio Andrés Illanes Albornoz 11a356
vim:tw=0