Browse Source

Improved help and command line options for controlling build.

tmp/comercial-emacs
Juan Jose Garcia-Ripoll 4 years ago
parent
commit
60d6b6a241
  1. 87
      README.md
  2. 3
      emacs-build.cmd
  3. 61
      emacs-build.sh
  4. 58
      scripts/help.txt

87
README.md

@ -1,4 +1,4 @@
# emacs-build v0.3.2
# emacs-build v0.4
Scripts to build a distribution of Emacs from sources, using MSYS2 and Mingw64(32)
@ -31,51 +31,57 @@ The script supports two way of being invoked:
````
Usage:
emacs-build [--version]
emacs-build [--version] [--help] [--features]
[--branch b] [--clone] [--build] [--deps]
[--without-X] [--with-X] [--compress] [--not-slim]
[--slim] [--[no-]compress] [--[no-]strip]
[--with-all] [--without-X] [--with-X]
[--pdf-tools] [--aspell] [--hunspell] [--mu] [--isync]
[--pack-emacs] [--pack-all]
Actions:
--build Configure and build Emacs from sources
--clean Remove all directories except sources and zip files
--clone Download Savannah's git repository for Emacs
--deps Create a ZIP file with all the Mingw64/32 dependencies
--help Output this help message
--pack-emacs Package an Emacs previously built with the --build option
--build Configure and build Emacs from sources.
--clean Remove all directories except sources and zip files.
--clone Download Savannah's git repository for Emacs.
--deps Create a ZIP file with all the Mingw64/32 dependencies.
--help Output this help message, --features and exit.
--pack-emacs Package an Emacs previously built with the --build option.
--pack-all Package an Emacs previously built, with all the Mingw64/32
dependencies, as well as all extensions (see Extensions below)
--version Output emacs-build version number
dependencies, as well as all extensions (see Extensions below).
--features Shows all active and inactive features for the selected options.
--version Output emacs-build version number and exit.
Multiple actions can be selected. The default is to run them all in a logical
order: clone, build, deps and pack-all.
Build options:
--branch b Select Emacs branch (or tag) 'b' for the remaining operations
--branch b Select Emacs branch (or tag) 'b' for the remaining operations.
--compress Ship Emacs with gunzip and compress documentation and Emacs
script files.
--debug Output all statements run by the script
--debug Output all statements run by the script.
--debug-dependencies
Describe which MSYS/MINGW packages depend on which, and
which files are discarded from the ZIP files.
--slim Remove Cairo, SVG and TIFF support for a slimmer build
--no-strip Disable the --strip option.
--no-compress Disable the --compress option.
--slim Remove Cairo, SVG and TIFF support for a slimmer build.
Remove also documentation files and other support files
from the dependencies file. Implies --compress (Default)
--not-slim Deactivate the --slim option. Build with all features.
--with-X Add requested feature in the dependencies and build
--without-X Remove requested feature in the dependencies and build
X is any of the known features for emacs in Windows/Mingw:
xpm jpeg tiff gif png rsvg cairo harfbuzz json lcms2 xml2 gnutls zlib
from the dependencies file. Activate --compress and
--strip. (Default configuration)
--strip Strip executables and DLL's from debug information.
--with-all Add all Emacs features.
--with-* Add requested feature in the dependencies and build
* is any of the known features for emacs in Windows/Mingw
(see --features).
--without-* Remove requested feature in the dependencies and build.
Options are processed in order. Thus --slim followed by --with-cairo
would enable Cairo, even though --slim removes it.
Extensions:
--pdf-tools Build and package PDF-TOOLS
--hunspell Hunspell spell checker
--aspell Aspell spell checker
--mu Mail search system and supporting Emacs mu4e libraries
--isync Synchronize email from IMAP/POP to Maildir format (mbsync)
--pdf-tools Build and package PDF-TOOLS.
--hunspell Install Hunspell spell checker.
--aspell Install Aspell spell checker.
--mu Mail search system and supporting Emacs mu4e libraries.
--isync Synchronize email from IMAP/POP to Maildir format (mbsync).
````
### An example
@ -96,10 +102,9 @@ It will take care of the following tasks
7. Download and build pdf-tools, hunspell, mu and isync (plus xapian and gmime3). In the process, ensure that the required packages are also installed.
8. Create a ZIP file with Emacs, all the dependencies and all the extensions.
The script, just like its creator, is a bit opinionated. It performs takes some extra steps to reduce the size of the distribution
The script, just like its creator, is a bit opinionated. The default build (without arguments), assumes --slim and performs takes some extra steps to reduce the size of the distribution
- It eliminates the manual pages and large documentation files for the libraries
that are used by Emacs.
- It eliminates the manual pages and large documentation files for the libraries that are used by Emacs.
- It eliminates the library files (*.a).
- It strips the executable files and DLL's from debugging information.
@ -109,7 +114,7 @@ The script, just like its creator, is a bit opinionated. It performs takes some
There are implicit dependencies in the various actions:
- `--clone` is required to get the sources
- `--build` is assumed to be run before `--pack-all` or `--pack-emacs`
- `--build` is assumed to be run before `--pack-all` or `--pack-emacs`, and also before the extensions.
Note that `--clean` or `--clean-all` do not remove the `msys64` directory, because it is very time consuming to create and update it.
@ -160,3 +165,21 @@ Regarding the extensions to Emacs and third-party utilities:
## v0.3.1
- Emacs-build upgrades GNU TLS version to at least 3.7.0, to allow safe https to MELPA.
## v0.3.2
- Undo the fix to GNU TLS, because this library is no longer available for download.
- Simplify and correct the process to detect dependencies between packages.
- Only remove non-essential data from executables (fix how we call 'strip').
- Enforce Emacs' latest stable release as default.
- Add hunspell and aspell from MINGW, replacing the one downloaded from Sourceforge.
- Cleanup of the build rules.
- Add tests for the extensions.
- Fix the behavior of --slim and --not-slim with respect to features.
## v0.4
- Clarify the order of execution of command line options.
- Remove --not-slim.
- Add --strip, and --with-all.
- Construct --slim out of --with-all, --without-*, --compress and --strip, so that users can counteract their behavior.

3
emacs-build.cmd

@ -25,7 +25,8 @@ emacs-build.cmd --nativecomp --clone --deps --build --pack-emacs --pdf-tools --m
goto:eof
:help
type %~dp0\scripts\help.txt
powershell -c scripts\setup-msys2.ps1
.\scripts\msys2.cmd -c "./emacs-build.sh --help"
goto:eof
:run

61
emacs-build.sh

@ -37,7 +37,25 @@
. scripts/gnutls.sh
function write_help () {
echo "Emacs-build tool version $emacs_build_version, (c) 2020 Juan Jose Garcia-Ripoll"
cat "$emacs_build_root/scripts/help.txt"
echo
write_features
}
function write_features () {
local inactive=""
for f in $all_features; do
if [[ ! " $features " =~ .*$f ]]; then
inactive="$f $inactive"
fi
done
echo "Compressed installation: $emacs_compress_files"
echo "Strip executables: $emacs_strip_executables"
echo "Emacs features:"
for f in $features; do echo " --with-$f"; done
for f in $inactive; do echo " --without $f"; done
}
function write_version_number ()
@ -204,7 +222,7 @@ function action2_install ()
function emacs_build_strip_exes ()
{
local dir="$1"
if [ "$emacs_slim_build" = "yes" ]; then
if [ "$emacs_strip_executables" = "yes" ]; then
find "$dir" -name '*.exe' -exec strip -g --strip-unneeded '{}' '+'
fi
}
@ -297,6 +315,10 @@ function delete_feature () {
features=`echo $features | sed -e "s,$1,,"`
}
function add_all_features () {
features="$all_features"
}
function add_feature () {
features="$1 $features"
}
@ -369,20 +391,37 @@ actions=""
do_clean=""
debug_dependency_list="false"
emacs_compress_files=no
emacs_build_version=0.3.2
emacs_build_version=0.4
emacs_slim_build=yes
emacs_nativecomp=no
emacs_build_threads=1
# This is needed for pacman to return the right text
export LANG=C
emacs_repo=https://git.savannah.gnu.org/git/emacs.git
emacs_build_root=`pwd`
emacs_build_git_dir="$emacs_build_root/git"
emacs_build_build_dir="$emacs_build_root/build"
emacs_build_install_dir="$emacs_build_root/pkg"
emacs_build_zip_dir="$emacs_build_root/zips"
emacs_strip_executables="no"
while test -n "$*"; do
case $1 in
--threads) shift; emacs_build_threads="$1";;
--branch) shift; emacs_branch="$1";;
--with-all) add_all_features;;
--without-*) delete_feature `echo $1 | sed -e 's,--without-,,'`;;
--with-*) add_feature `echo $1 | sed -e 's,--without-,,'`;;
--nativecomp) emacs_nativecomp=yes;;
--not-slim) emacs_slim_build=no;;
--slim) emacs_slim_build=yes;;
--slim) add_all_features
delete_feature cairo # We delete features here, so that user can repopulate them
delete_feature rsvg
delete_feature tiff
emacs_compress_files=yes
emacs_strip_executables=yes;;
--strip) emacs_strip_executables=yes;;
--no-strip) emacs_strip_executables=no;;
--compress) emacs_compress_files=yes;;
--no-compress) emacs_compress_files=no;;
--debug) set -x;;
--debug-dependencies) debug_dependency_list="true";;
@ -408,6 +447,7 @@ while test -n "$*"; do
-?|-h|--help) write_help; exit 0;;
--features) write_features; exit 0;;
--version) write_version_number;;
*) echo Unknown option "$1". Aborting; exit -1;;
esac
@ -423,9 +463,6 @@ if test "$emacs_nativecomp" = "yes"; then
add_feature nativecomp
fi
if test "$emacs_slim_build" = "yes"; then
delete_feature cairo
delete_feature rsvg
delete_feature tiff
dependency_exclusions="$slim_exclusions"
emacs_compress_files=yes
fi
@ -440,17 +477,9 @@ if test -z "$actions"; then
actions="action0_clone action1_ensure_packages action2_build action3_package_deps action5_package_all"
fi
features=`unique_list $features`
# This is needed for pacman to return the right text
export LANG=C
emacs_repo=https://git.savannah.gnu.org/git/emacs.git
emacs_build_root=`pwd`
emacs_build_git_dir="$emacs_build_root/git"
emacs_build_build_dir="$emacs_build_root/build"
emacs_build_install_dir="$emacs_build_root/pkg"
emacs_build_zip_dir="$emacs_build_root/zips"
check_mingw_architecture
ensure_mingw_build_software
emacs_extensions=""
emacs_branch_name=`git_branch_name_to_file_name ${emacs_branch}`
emacs_nodepsfile="$emacs_build_root/zips/emacs-${emacs_branch_name}-${architecture}-nodeps.zip"

58
scripts/help.txt

@ -1,46 +1,52 @@
Usage:
emacs-build [--version]
emacs-build [--version] [--help] [--features]
[--branch b] [--clone] [--build] [--deps]
[--without-X] [--with-X] [--compress] [--not-slim]
[--slim] [--[no-]compress] [--[no-]strip]
[--with-all] [--without-X] [--with-X]
[--pdf-tools] [--aspell] [--hunspell] [--mu] [--isync]
[--pack-emacs] [--pack-all]
Actions:
--build Configure and build Emacs from sources
--clean Remove all directories except sources and zip files
--clone Download Savannah's git repository for Emacs
--deps Create a ZIP file with all the Mingw64/32 dependencies
--help Output this help message
--pack-emacs Package an Emacs previously built with the --build option
--build Configure and build Emacs from sources.
--clean Remove all directories except sources and zip files.
--clone Download Savannah's git repository for Emacs.
--deps Create a ZIP file with all the Mingw64/32 dependencies.
--help Output this help message, --features and exit.
--pack-emacs Package an Emacs previously built with the --build option.
--pack-all Package an Emacs previously built, with all the Mingw64/32
dependencies, as well as all extensions (see Extensions below)
--version Output emacs-build version number
dependencies, as well as all extensions (see Extensions below).
--features Shows all active and inactive features for the selected options.
--version Output emacs-build version number and exit.
Multiple actions can be selected. The default is to run them all in a logical
order: clone, build, deps and pack-all.
Build options:
--branch b Select Emacs branch (or tag) 'b' for the remaining operations
--branch b Select Emacs branch (or tag) 'b' for the remaining operations.
--compress Ship Emacs with gunzip and compress documentation and Emacs
script files.
--debug Output all statements run by the script
--debug Output all statements run by the script.
--debug-dependencies
Describe which MSYS/MINGW packages depend on which, and
which files are discarded from the ZIP files.
--slim Remove Cairo, SVG and TIFF support for a slimmer build
--no-strip Disable the --strip option.
--no-compress Disable the --compress option.
--slim Remove Cairo, SVG and TIFF support for a slimmer build.
Remove also documentation files and other support files
from the dependencies file. Implies --compress (Default)
--not-slim Deactivate the --slim option. Build with all features.
--with-X Add requested feature in the dependencies and build
--without-X Remove requested feature in the dependencies and build
from the dependencies file. Activate --compress and
--strip. (Default configuration)
--strip Strip executables and DLL's from debug information.
--with-all Add all Emacs features.
--with-* Add requested feature in the dependencies and build
* is any of the known features for emacs in Windows/Mingw
(see --features).
--without-* Remove requested feature in the dependencies and build.
X is any of the known features for emacs in Windows/Mingw:
xpm jpeg tiff gif png rsvg cairo harfbuzz json lcms2 xml2 gnutls zlib
Options are processed in order. Thus --slim followed by --with-cairo
would enable Cairo, even though --slim removes it.
Extensions:
--pdf-tools Build and package PDF-TOOLS
--hunspell Hunspell spell checker
--aspell Aspell spell checker
--mu Mail search system and supporting Emacs mu4e libraries
--isync Synchronize email from IMAP/POP to Maildir format (mbsync)
--pdf-tools Build and package PDF-TOOLS.
--hunspell Install Hunspell spell checker.
--aspell Install Aspell spell checker.
--mu Mail search system and supporting Emacs mu4e libraries.
--isync Synchronize email from IMAP/POP to Maildir format (mbsync).

Loading…
Cancel
Save