Artistic Style
Artistic Style (command: astyle
) is a source formatter for C-like programming languages.
Installation
Because new and desirable features are added way before your distro picks them up in the standard package, this is a program you'll want to compile and install manually.
The program unfortunately has a static Makefile and doesn't use a configure
script, so using stow is a bit more difficult than normal.
We use almost the normal mkfake process here, with these subtleties:
- The Makefile will have to be patched so that
DESTDIR
is supported. - The prefix /usr/local will be passed directly to make as a variable.
Start by unpacking and going to the build dir for gcc.
# In /tmp (substitute another dir as appropriate) $ tar xvf ~/src/astyle_3.0.1_linux.tar.gz $ cd astyle/build/gcc
In the Makefile, any destination directories under only the install
and uninstall
targets need to be prefixed with $(DESTDIR)
and quoted as necessary. Currently, this is done with the following changes:
- Replace any
$(ipath)
with"$(DESTDIR)$(ipath)"
. - Replace any
$(SYSCONF_PATH)
with"$(DESTDIR)$(SYSCONF_PATH)"
.
Use mkfake to set up a fake destination directory. mkfake arranges for the install prefix under the fake dir to link to a directory with the name of the package (in this case astyle-3.0.1
); this directory will be stowed later.
$ eval "`PACKAGE=astyle-3.0.1 mkfake`" # Agree to prompts - refer to mkfake for more information
Use make to build and install the program. Note that make install
won't work on its own; one of the astyle build targets (such as release
) must be built first.
This invocation of make is also where prefix
and DESTDIR
must be set. mkfake has added the correct values in the environment as REAL
and FAKE
, respectively.
# Build the release version and install it to the fake dir $ make prefix="$REAL" DESTDIR="$FAKE" release install
Once that's done, stow the result as with any mkfake'd build.
# Install the build to the stow dir and stow it cd /usr/local/stow sudo mv "$FAKE/$PACKAGE" ./ sudo stow "$PACKAGE"