Discussion:
[SM-Users] mcdp spell?
Javier Vasquez
2007-04-27 02:21:39 UTC
Permalink
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,
--
Javier
Thomas Orgis
2007-04-27 06:55:51 UTC
Permalink
Am Thu, 26 Apr 2007 20:21:39 -0600
Post by Javier Vasquez
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
There's no problem with that. You will just have to from the editing
into bash code (using sed and the like).
Basically this means that you will have to write the PRE_BUILD and BUILD
files (and perhaps INSTALL) instead of omitting them for the default
procedure with often just works for autotooled software.
Just look at some PRE_BUILD and BUILD files in the grimoire; you will
find a number that works without ./configure.
Post by Javier Vasquez
don't know. At any rate one can just directly compile the tool, :)
When you can do that, you can write a spell;-)


Alrighty then,

Thomas
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.ibiblio.org/pipermail/sm-users/attachments/20070427/9e47c966/attachment.bin
Juuso Alasuutari
2007-04-27 07:16:56 UTC
Permalink
Post by Javier Vasquez
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
Javier Vasquez
2007-04-27 15:07:01 UTC
Permalink
Post by Juuso Alasuutari
Post by Javier Vasquez
Hi,
...
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-------------------------------
config_query_option OPTION_VAR "Enable option?" y "ON" "OFF"
default_pre_build &&
cd "$SOURCE_DIRECTORY" &&
sed -i "s|^OPTION=.*$|OPTION=$OPTION_VAR|" Makefile
make
cp foobar "$INSTALL_ROOT/usr/bin/"
end---------------------------------
- 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
Thanks a lot, this clarify things a lot, actually I compiled,
installed and tried mcpd on smgl yesterday night, and everything went
OK, except for the fact that I required to generate a patch, since the
Makefile "uninstall" was broken, and it was overwriting i*86 with i386
all the time.

Looking at the previous description, I guess the patch instruction
needs to go under PRE_BUILD. Only thing is that this is a personal
patch, and I don't have any http/ftp server. I'll see if the patch is
accepted by the mcdp developer, and if not, well, I wouldn't know if
the spell I can come up with will be of any use for others (good thing
is that when browsing about "sourcemage mcdp", I found nothing, so
most probably there's no one interested on mcdp but me). At any rate
I'll try writing one and post it here if I get it to work. I'm just
new to this, :).

Thanks a lot,
--
Javier
Florian Franzmann
2007-04-27 15:28:11 UTC
Permalink
Post by Javier Vasquez
Thanks a lot, this clarify things a lot, actually I compiled,
installed and tried mcpd on smgl yesterday night, and everything went
OK, except for the fact that I required to generate a patch, since the
Makefile "uninstall" was broken, and it was overwriting i*86 with i386
all the time.
Looking at the previous description, I guess the patch instruction
needs to go under PRE_BUILD. Only thing is that this is a personal
patch, and I don't have any http/ftp server. I'll see if the patch is
If you think that your spell/patch is useful to a wider audience you can file
a bug report at
http://bugs.sourcemage.org
and append it :)

regards
Florian
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.ibiblio.org/pipermail/sm-users/attachments/20070427/b6b2525d/attachment.bin
Eric Sandall
2007-04-27 15:53:55 UTC
Permalink
Javier Vasquez wrote:
<snip>
Post by Javier Vasquez
Looking at the previous description, I guess the patch instruction
needs to go under PRE_BUILD. Only thing is that this is a personal
patch, and I don't have any http/ftp server. I'll see if the patch is
accepted by the mcdp developer, and if not, well, I wouldn't know if
the spell I can come up with will be of any use for others (good thing
is that when browsing about "sourcemage mcdp", I found nothing, so
most probably there's no one interested on mcdp but me). At any rate
I'll try writing one and post it here if I get it to work. I'm just
new to this, :).
You can include the patch in the spell directory. In PRE_BUILD, you
would reference it like this:

- ----
patch -p1 < $SCRIPT_DIRECTORY/uninstall-fix.patch
- ----

Where $SCRIPT_DIRECTORY refers to the location of the spell files. It's
also preferable to submit patches upstream (as you said you'd do ;)) so
that we don't have to keep patching the program.

- -sandalle

- --
Eric Sandall | Source Mage GNU/Linux Developer
eric at sandall.us PGP: 0xA8EFDD61 | http://www.sourcemage.org/
http://eric.sandall.us/ | http://counter.li.org/ #196285
Juuso Alasuutari
2007-04-27 21:42:19 UTC
Permalink
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
<snip>
Post by Javier Vasquez
Looking at the previous description, I guess the patch instruction
needs to go under PRE_BUILD. Only thing is that this is a personal
patch, and I don't have any http/ftp server. I'll see if the patch is
accepted by the mcdp developer, and if not, well, I wouldn't know if
the spell I can come up with will be of any use for others (good thing
is that when browsing about "sourcemage mcdp", I found nothing, so
most probably there's no one interested on mcdp but me). At any rate
I'll try writing one and post it here if I get it to work. I'm just
new to this, :).
You can include the patch in the spell directory. In PRE_BUILD, you
- ----
patch -p1 < $SCRIPT_DIRECTORY/uninstall-fix.patch
- ----
Where $SCRIPT_DIRECTORY refers to the location of the spell files. It's
also preferable to submit patches upstream (as you said you'd do ;)) so
that we don't have to keep patching the program.
Paranoid as I am, I'd quote the path like so:

patch -p1 < "$SCRIPT_DIRECTORY/uninstall-fix.patch"

...just to make sure that it'll still work if $SCRIPT_DIRECTORY contains
whitespaces (although that is a very rare occasion). :)

J
&quot;Andraž 'ruskie' Levstik&quot;
2007-04-27 21:48:15 UTC
Permalink
Post by Juuso Alasuutari
patch -p1 < "$SCRIPT_DIRECTORY/uninstall-fix.patch"
And I'd use $SPELL_DIRECTORY instead of $SCRIPT_DIRECTORY

--
Andra? "ruskie" Levstik
Source Mage GNU/Linux Games grimoire guru
Geek/Hacker/Tinker

Hacker FAQ: http://www.plethora.net/%7eseebs/faqs/hacker.html
Be sure brain is in gear before engaging mouth.

Key id = F4C1F89C
Key fingerprint = 6FF2 8F20 4C9D DB36 B5B6 F134 884D 72CC F4C1 F89C
Juuso Alasuutari
2007-04-28 18:25:09 UTC
Permalink
Post by &quot;Andraž 'ruskie' Levstik&quot;
Post by Juuso Alasuutari
patch -p1 < "$SCRIPT_DIRECTORY/uninstall-fix.patch"
And I'd use $SPELL_DIRECTORY instead of $SCRIPT_DIRECTORY
Are you sure? I've had the impression that $SPELL_DIRECTORY is
deprecated in favor of $SCRIPT_DIRECTORY. Can anyone confirm which way
it is?

J
Eric Sandall
2007-04-28 19:16:07 UTC
Permalink
Juuso Alasuutari wrote:
<snip>
Post by Juuso Alasuutari
Are you sure? I've had the impression that $SPELL_DIRECTORY is
deprecated in favor of $SCRIPT_DIRECTORY. Can anyone confirm which way
it is?
IIRC SCRIPT_DIRECTORY is what we are supposed to use. Looking at
http://lists.ibiblio.org/pipermail/sm-commit/2006-August/005613.html
shows Sorcery using SCRIPT_DIRECTORY instead of SPELL_DIRECTORY.

- -sandalle

- --
Eric Sandall | Source Mage GNU/Linux Developer
eric at sandall.us PGP: 0xA8EFDD61 | http://www.sourcemage.org/
http://eric.sandall.us/ | http://counter.li.org/ #196285
Javier Vasquez
2007-04-28 22:17:49 UTC
Permalink
Post by Eric Sandall
<snip>
Post by Juuso Alasuutari
Are you sure? I've had the impression that $SPELL_DIRECTORY is
deprecated in favor of $SCRIPT_DIRECTORY. Can anyone confirm which way
it is?
IIRC SCRIPT_DIRECTORY is what we are supposed to use. Looking at
http://lists.ibiblio.org/pipermail/sm-commit/2006-August/005613.html
shows Sorcery using SCRIPT_DIRECTORY instead of SPELL_DIRECTORY.
- -sandalle
Thanks a lot to all. I could make the spell work with one caveat
though. I couldn't make INSTALL work, not by using "make install",
neither by using "cp ..." instructions directly.

So on BUILD I used "make install" as the last instruction, and I left
INSTALL empty for no further action, and the thing worked.

I'm attaching the spell tar.bz2, in case some one can take the time to
try it out and see what I did wrong, so that "make install" is called
from INSTALL instead of BUILD. If this gets to work then I can submit
the spell, since as of now it seems not pretty healthy.

Thanks again,
--
Javier
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mcdp.tar.bz2
Type: application/x-bzip2
Size: 1818 bytes
Desc: not available
Url : http://lists.ibiblio.org/pipermail/sm-users/attachments/20070428/0aa5cceb/attachment.bz2
Florian Franzmann
2007-04-28 23:00:50 UTC
Permalink
Post by Javier Vasquez
Thanks a lot to all. I could make the spell work with one caveat
though. I couldn't make INSTALL work, not by using "make install",
neither by using "cp ..." instructions directly.
So on BUILD I used "make install" as the last instruction, and I left
INSTALL empty for no further action, and the thing worked.
I'm attaching the spell tar.bz2, in case some one can take the time to
try it out and see what I did wrong, so that "make install" is called
from INSTALL instead of BUILD. If this gets to work then I can submit
the spell, since as of now it seems not pretty healthy.
Nice work. I did a bit of cleanup on your spell and committed it to test:
* DEPENDS, INSTALL and CONFIGURE were empty files, so no need for them. If
they aren't there sorcery assumes it's default behaviour.
* fixed a typo in DETAILS
* removed 'make install' from BUILD
* HISTORY: you should put your email address behind your name. There
should be a tab and an asterisk before an entry. Also you forgot to
mention your patch.

Thanks for the spell :)

regards
Florian
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.ibiblio.org/pipermail/sm-users/attachments/20070429/e423d179/attachment.bin
Jeremy Blosser
2007-04-29 01:34:53 UTC
Permalink
Post by Javier Vasquez
Post by Eric Sandall
<snip>
Post by Juuso Alasuutari
Are you sure? I've had the impression that $SPELL_DIRECTORY is
deprecated in favor of $SCRIPT_DIRECTORY. Can anyone confirm which way
it is?
IIRC SCRIPT_DIRECTORY is what we are supposed to use. Looking at
http://lists.ibiblio.org/pipermail/sm-commit/2006-August/005613.html
shows Sorcery using SCRIPT_DIRECTORY instead of SPELL_DIRECTORY.
- -sandalle
Thanks a lot to all. I could make the spell work with one caveat
though. I couldn't make INSTALL work, not by using "make install",
neither by using "cp ..." instructions directly.
Probably your local grimoire doesn't have API 2 as the default; API 1
didn't use an INSTALL file, so unless the spell/section/grimoire is set to
API 2, sorcery won't run a given INSTALL file.

Also make sure any spell files are executable; if they aren't, it's like
they aren't there from sorcery's perspective.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.ibiblio.org/pipermail/sm-users/attachments/20070428/e111c115/attachment.bin
Javier Vasquez
2007-04-29 15:10:48 UTC
Permalink
Post by Jeremy Blosser
Post by Javier Vasquez
Post by Eric Sandall
<snip>
Post by Juuso Alasuutari
Are you sure? I've had the impression that $SPELL_DIRECTORY is
deprecated in favor of $SCRIPT_DIRECTORY. Can anyone confirm which way
it is?
IIRC SCRIPT_DIRECTORY is what we are supposed to use. Looking at
http://lists.ibiblio.org/pipermail/sm-commit/2006-August/005613.html
shows Sorcery using SCRIPT_DIRECTORY instead of SPELL_DIRECTORY.
- -sandalle
Thanks a lot to all. I could make the spell work with one caveat
though. I couldn't make INSTALL work, not by using "make install",
neither by using "cp ..." instructions directly.
Probably your local grimoire doesn't have API 2 as the default; API 1
didn't use an INSTALL file, so unless the spell/section/grimoire is set to
API 2, sorcery won't run a given INSTALL file.
Also make sure any spell files are executable; if they aren't, it's like
they aren't there from sorcery's perspective.
_______________________________________________
SM-Users mailing list
SM-Users at lists.ibiblio.org
http://lists.ibiblio.org/mailman/listinfo/sm-users
Following Florian's comments, it worked pretty nice. I also chanded
the section to a real one, since I had before a faked one. After
changing that and following Florian's comments, the spell worked.

I did a "sorcery -s" yesterday night and I saw the spell already in
the test grimoire, awsome....

Thanks a lot,
--
Javier
Loading...