[SM-Users] mcdp spell?
Juuso Alasuutari
iuso at sourcemage.org
Fri Apr 27 03:16:56 EDT 2007
Javier Vasquez wrote:
> Hi,
>
> Under the test grimoire I tried unsuccessfully "gaze search mcdp". I
> was thinking on writing my own, although I'm just new to sm, however I
> wanted to ask 1st if there's anyone out there with such spell, or even
> if it's possible. mcdp doesn't use configure, automake, autoconf
> stuff. One needs to edit Makefile and params.h for compile tunning
> and definitions. This might inhibit to generate a spell for it. I
> don't know. At any rate one can just directly compile the tool, :)
>
> http://www.mcmilk.de/projects/mcdp
>
> Thanks,
>
Here's a small, hypothetical example of what you can do in a spell.
We'll assume that the program source includes a Makefile which has an
option called 'OPTION' in it which you're supposed to edit by hand. The
option accepts two possible values, 'ON' and 'OFF'. We'll also assume
that the Makefile has no 'make install' target, and that a succesful
make produces an executable called foobar.
begin-------------------------------
CONFIGURE:
config_query_option OPTION_VAR "Enable option?" y "ON" "OFF"
PRE_BUILD:
default_pre_build &&
cd "$SOURCE_DIRECTORY" &&
sed -i "s|^OPTION=.*$|OPTION=$OPTION_VAR|" Makefile
BUILD:
make
INSTALL:
cp foobar "$INSTALL_ROOT/usr/bin/"
end---------------------------------
There are some important things worth noticing:
- If you add your own PRE_BUILD, BUILD, INSTALL or similar file, it will
completely override the default equivalent behavior. Keep this in mind
at all times.
- In PRE_BUILD those first two lines are the equivalent of the default
PRE_BUILD behavior and are necessary when you want to have a custom
PRE_BUILD; after them you can place your custom commands.
- This example needs a BUILD file containing only 'make', because the
default BUILD behavior is to execute ./configure before make.
- In INSTALL the $INSTALL_ROOT variable needs to be prefixed in front of
all install targets. It is necessary to enable spells to be cast into
chroots and other custom locations.
Hope you enjoy writing a spell, please do ask more if you need to. :)
J
More information about the SM-Users
mailing list