* Rename CREW_OPTIONS to CREW_CONFIGURE_OPTIONS * Rename build_extras and install_extras to configure_build_extras and configure_install_extras
8.3 KiB
Purpose
The purpose of this manual is to properly document the crew command with a rundown of function and/or variable usage. Note that this manual does not include documentation of ruby functions and variables. A basic understanding of ruby, shell and Linux is a prerequisite for package development.
#'s are used as placeholders/wild-cards within this Manual.
Crew
Chromebrew is a third-party package manager that interacts with ChromeOS using the shell and ruby programming languages. The crew command provided by Chromebrew implements a simple means to install and maintain packages native to the operating system using scripts found in /usr/local/lib/crew/packages. Each script contains the instructions to build and install a package. The crew command can also be used to update and remove packages.
Build lifecycle
The crew build life-cycle consists of the stages as follows:
fetch- During the fetch phasecrewusescurl --sslto fetch the packageextract- Once the the package has been fetched,crewextracts the packageself.prebuild- Onlysedcommands should be run during this stage - if provided- During this stage
crewcd's into the extracted directory, and stays there until thepreinstallstage
- During this stage
self.patch- Onlypatchcommands should be used during this stage - if providedself.build- Package is compiled and/or configuredself.check- Package is then checked - If providedself.preinstall- Pre-install checks/edits are done - If providedself.install- Commands to install to#{CREW_DEST_DIR}are run- ONLY required function
self.postinstall- Post-install checks/edits are done - If provided- Package
- Only binary packages call this stage
- Contents are checked and packaged, then installed to
#{CREW_PREFIX}
- Contents are checked and packaged, then installed to
- Only binary packages call this stage
Binary
Binary packages follow a different set of rules then source packages.
crew buildis used to build binaries Only the functionsself.preinstallandself.postinstallare run during a binary package install.crewrequires a few things to exist in the archive in order to install a binary package.
dlista list of directories used/installed to by the packagefilelista list of all files included in the package
Variables
The required package variables are as follows: - Rundown
class # < Package- The#must be name of the name of your package. It must start with a capital and be the same as the filename. (#.rb)description- Is the description of the package.homepage- Is the homepage of the package.version- Is the package version.compatibility- Which architectures the package can operate on.source_urlIs the URL where the source package can be found.Moresource_sha256- The checksum for the package which will be downloaded from thesource_url.
Preset Constants
Preset constants are shown below:
Most of these constants can displayed using the
crew constcommand
#{CREW_PREFIX}- The prefix used bycrew- Equal to/usr/local#{CREW_LIB_PREFIX}- TheLIBprefix used bycrew- Equal to#{CREW_PREFIX}/lib-#{CREW_PREFIX}/lib64onamd64#{CREW_DEST_DIR}- TheDESTDIRvariable used bycrew- Equal to#{CREW_PREFIX}/tmp/crew/dest#{CREW_DEST_PREFIX}- TheDESTDIRvariable prefix used bycrew- Equal to#{CREW_DEST_DIR}/usr/local#{CREW_CONFIGURE_OPTIONS}- The preset options for./congifure- Equals#{CREW_MAN_PREFIX}- Useful for building man pages - Equal to#{CREW_PREFIX}/share/man#{CREW_DEST_LIB_PREFIX}- TheDESTDIRLIBprefix - Equal to#{CREW_DEST_PREFIX}/lib-#{CREW_DEST_PREFIX}/lib64onamd64#{CREW_DEST_HOME}- TheDESTDIRhome variable - Equal to#{CREW_DEST}/#{HOME}#{HOME}- Variable used bycrewfor$HOME#{ARCH}- Variable used bycrewfor$(arch)#{CREW_NPROC}- Variable used bycrewfor$(nproc)
Functions
Required functions are as follows: - Rundown
def self.build- Contains commands used to build/compile the software.def self.install- Should be used for# installbut is not required to be defined. - [Rundown]
Additional Functions
Optional functions are as follows:
self.prebuild- Can be used to define functions(Or commands) that should be used to edit various files.def self.patch- Can be used to define functions(Or commands) that should be used topatchvarious files.def self.preinstall- Can be used to define functions(Or commands) that should happenpre-install.def self.check- Can be used to define functions(Or commands) that should be used to check the compile binary.def self.postinstall- Can be used to define functions(Or commands) that should happenpost-install.is_fake- Can be used to label package as meta.
Rundown
The rundown of what each function and variable are/(can be) used for follows.
A simple example ruby script can be found on the Wiki.
require 'package' # must occur within each `.rb`
# Notice the newline
class Template < Package # Notice the capitals, EG: 'I3' - would be used for an 'i3' package
description 'The template script' # Notice the indent, should contain no more than one line of text
homepage '#' # Notice the same indent, EG: 'https://i3wm.org/' - Would be used for an 'i3' Package
version 'version#-revision#' # EG: 4.18.2-1 - Where '4.18.2' is the version and '1' is the revision - Omit revision on new packages
compatibility '#' # Can contain 'all', or a list of supported architectures each separated by a space
source_url '#' # The URL from which the source of the package can be downloaded
source_sha256 '#' # The `sha256` checksum of the downloaded source package
# Notice the newline
depends_on '#' # Soft where this package depends on
depends_on '#' => :build # Only required when the package is built from source
# Notice the newline
def self.preflight # For preflight checks, not required
system '#' # Replace '#' with a disk space check, for example
end
def self.prebuild # For sed operations, not required
system '#' # Replace '#' with a sed operation
end
def self.patch # For patch operations, not required
system '#' # Replace '#' with a patch operation
end
def self.build # Contains the commands which compile the package, required if package con be compiled
system '#' # Replace '#' with commands to compile the package
system '#' # Should contain something like, "./configure --prefix=/usr/local"
system '#' # Use in case additions commands are required
system '#' # Should contain something like, "'make -j$(nproc)'"
end
def self.check # For commands to check the build quality, called by 'crew build'
system '#'
end
def self.preinstall # For pre-install conditions, not required
system '#'
end
def self.install # For make install, required if package can be installed
system '#' # Should contain something like, "'make', "DESTDIR=#{CREW_DEST_DIR}", 'install'"
end
def self.postinstall # For post-install messages or operations, not required
system '#'
end
end
Footnotes
Arch: Chromebrew packages for x86_64, i686, armv7l, and aarch64.
More: Must come from an official source, not a distro's source archive. Should contain the version number(Which must be equal to the version variable) https is preferred over http or ftp - When possible.
NOTE: All rules can have exceptions, if REQUIRED, exceptions to the rules should be avoided at all costs.
CREW_CONFIGURE_OPTIONS: Equal to --prefix=/usr/local --libdir=/usr/local/lib --mandir=/usr/local/share/man --disable-dependency-tracking --program-prefix='' --program-suffix=''
Any additionally required resources for ChromeOS or ChromeBooks can be found here
Still can't find something? Have a look in IssuesOr post a issue
This Manual is heavily based off void-packages/Manual.md