WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: SCM buildin how-to  (Read 12626 times)

Offline vinnie

  • Hero Member
  • *****
  • Posts: 1187
  • HandMace informatic works
SCM buildin how-to
« on: April 07, 2012, 08:13:36 AM »
Today I started trying to understand how work these scm, I'm downloading ffmpeg package (very big for my line) as mentioned in this topic
I think it's important that other people try to create this type of package or it would risk a low diffusion.
I translated to my language (italian) first post of SCM basis to figure out what to do.
I found an application that works securely and has few dependencies for testing: http://nut.sourceforge.net/

However I did not understand the part of code in the first post of SCM Basics, I ask if you can create a mini howto step by step for create a .scm package
« Last Edit: April 07, 2012, 08:59:07 AM by vinnie »

Offline vinnie

  • Hero Member
  • *****
  • Posts: 1187
  • HandMace informatic works
Re: SCM buildin how-to
« Reply #1 on: April 07, 2012, 11:34:44 AM »
Ok, I'm investigating the discourse of environment variables; I just finished building ffmpeg (it took several hours), but where is the scm?

Code: [Select]
...
INSTALL libavutil/pixfmt.h
INSTALL libavutil/random_seed.h
INSTALL libavutil/rational.h
INSTALL libavutil/samplefmt.h
INSTALL libavutil/sha.h
INSTALL libavutil/sha1.h
INSTALL libavutil/avconfig.h
INSTALL libavutil/libavutil.pc
tc@box:~/ffmpegscm/ffmpeg-shared/ffmpeg-shared$

Offline vinnie

  • Hero Member
  • *****
  • Posts: 1187
  • HandMace informatic works
Re: SCM buildin how-to
« Reply #2 on: April 07, 2012, 03:11:09 PM »
Ok, i change target of my test (nut does not have .configure file, this is a problem for --prefix)

I try with circuslinux and write this script:

Code: [Select]
build_circuslinux() {
HERE=`pwd`
NAME=circuslinu
VER=1.0.3
BUILDDEPS="compiletc.tcz SDL-dev.tcz"
#DEPS="libmikmod.tcz SDL.tcz"


PKGPATH=$1
export LDFLAGS="-L$PKGPATH/lib"
export CPPFLAGS="-I$PKGPATH/include"
export PATH="$PKGPATH/bin:$PATH"
export PKG_CONFIG_PATH="$PKGPATH/lib/pkgconfig:$PKG_CONFIG_PATH"


tar xvzf circuslinux-1.0.3.tar.gz || exit 1
cd circuslinux-1.0.3 || exit 1
./configure  --prefix="$PKGPATH" || exit 1
make || exit 1
make install || exit 1

cd "$HERE"

}

Code: [Select]
tc@box:~/circus$ ./buildscm circus.inc /apps/circux
./buildscm: line 46: build_circus.inc: command not found

for now this is naturally wrong, but I hope you'll give me a hand to correct and understand some things.

Here are some of the first questions that come to mind:
1)This SCM pack is the software, plus all its dependencies installed in /apps/packagename ?
1.2)so I must try to have only "BUILDEPS" and not "DEPS" ?

2)in the series of "export" I need to enter the directory where the libraries will be installed and searched?
2.1)how should I choose them whereas circuslinux need the sdl and libmikmod?


Offline Jason W

  • Administrator
  • Hero Member
  • *****
  • Posts: 9730
Re: SCM buildin how-to
« Reply #3 on: April 07, 2012, 04:28:33 PM »
Scm's don't need tcz deps, just build deps, as the rule now is for scm's not to depend on tcz's.  So libmikmod and sdl will need to be built into the circuslinux scm package.  All needed libraries not found in base need to be in the scm if at all possible, except for gtk2 or other library collections.

Also, when ffmpeg finishes building, you make the scm this way, thougn it can also be scripted.

cd /apps
mksquashfs ffmpeg-shared/ ffmpeg-shared.scm

You would first want to perhaps clean out unwanted files though, depending on the purpose of the package.

Also if you are using the command "buildscm circus-sc.inc /apps/circus" , then the function in the circus-sc.inc file needs to be build_circus.  Also, the file needs to be named with the -sc.inc suffix to work with the buildscm script.



Offline Jason W

  • Administrator
  • Hero Member
  • *****
  • Posts: 9730
Re: SCM buildin how-to
« Reply #4 on: April 07, 2012, 06:43:52 PM »
Ok, I made some source files for circuslinux, located below, be sure to download all the files.  I will let you make the package, this can just be a guide.

http://distro.ibiblio.org/tinycorelinux/4.x/x86/scm/src/circuslinux/

Use the command:

buildscm circuslinux-sc.inc /apps/circuslinux

and it should just work.  Study each source file to see what is going on.  Also, a wrapper is usually needed to make the resulting binaries work.  For this one do ths:

mv /apps/circuslinux/bin /apps/circuslinux/localbin
mkdir /apps/circuslinux/bin

Then create this file to be your /apps/circuslinux/bin/circuslinux file:

Code: [Select]
#!/bin/sh

export LD_LIBRARY_PATH=/apps/circuslinux/lib
export PATH=/apps/circuslinux/localbin:$PATH

/apps/circuslinux/localbin/circuslinux "$@"

Then make that file executable.  The icon and menu stuff can be easily done using existing examples. 

Oh, and FWIW, circuslinux is able to be converted directly from tcz's with the same result.
« Last Edit: April 07, 2012, 07:15:02 PM by Jason W »

Offline Jason W

  • Administrator
  • Hero Member
  • *****
  • Posts: 9730
Re: SCM buildin how-to
« Reply #5 on: April 08, 2012, 07:33:22 AM »
I uploaded a fix in the libmad-sc.inc that was causing a build failure, should be good now.


Offline vinnie

  • Hero Member
  • *****
  • Posts: 1187
  • HandMace informatic works
Re: SCM buildin how-to
« Reply #6 on: April 08, 2012, 09:07:25 AM »
Much material to elaborate, I lower my head and I start work :)

Offline Jason W

  • Administrator
  • Hero Member
  • *****
  • Posts: 9730
Re: SCM buildin how-to
« Reply #7 on: April 08, 2012, 04:13:19 PM »
Here is a script to run for fun, creates a portable self contained circuslinux out of existing tcz's.  This approach seems to work well with some extensions, vlc is one, but not with others.  Run in a directory that does not already contain tcz files.


Code: [Select]
#!/bin/sh

tce-fetch.sh circuslinux.tcz.tree

for I in `cat circuslinux.tcz.tree`; do
[ -f "$I" ] || tce-fetch.sh "$I"
done



mkdir pkgbase
for I in `ls *.tcz`; do
unsquashfs -d pkg "$I"
cp -a pkg/* pkgbase/
sudo rm -r "$I"
sudo rm -r pkg
done

cd pkgbase
mv usr/local .
rmdir usr

find . -type f -exec sed -i -e "s|/usr|././|g" {} \;

export LD_LIBRARY_PATH=local/lib
./local/bin/circuslinux


« Last Edit: April 08, 2012, 04:54:08 PM by Jason W »

Offline jls

  • Hero Member
  • *****
  • Posts: 2135
Re: SCM buildin how-to
« Reply #8 on: April 08, 2012, 05:25:51 PM »
I don't understand the line starting with "find"
dCore user

Offline Jason W

  • Administrator
  • Hero Member
  • *****
  • Posts: 9730
Re: SCM buildin how-to
« Reply #9 on: April 08, 2012, 05:38:44 PM »
That is what makes the contents of the extension portable, that is to be ported from /usr/local to /apps.  It removes hard coded paths and replaces them with relative paths, a tip from portablelinuxapps.org.

Offline vinnie

  • Hero Member
  • *****
  • Posts: 1187
  • HandMace informatic works
Re: SCM buildin how-to
« Reply #10 on: April 09, 2012, 09:37:22 PM »
ok, I tried to run buildscm for your script (sh buildscm ./circuslinux-sc.inc /apps/circuslin
ux), I did the wrapping operation, but circusilinux does not work:

Code: [Select]
tc@box:/apps/circuslinux/bin$ ./circuslinux

Warning: I could not open the options file for read:
/home/tc/.circuslinux
The error that occured was:
No such file or directory


Error: I could not load the music file:
/apps/circuslinux/share/circuslinux/data/music/finally.mod
The Simple DirectMedia error that occured was:
Unrecognized music format

tc@box:/apps/circuslinux/bin$

However, as a matter of mere teaching I tried a package even easier (with no dependencies) to create a working script, and this time I succeeded:
http://sprunge.us/KfCR?bash (sorry for italian comment)
Practically I'll have to do the same work for each dependency and then include it with ". . /dep-sc.inc" in master file,

what would the next steps?
1)wrapping (in this case  is usefull)
2)create icons and desktop file in /apps/packname/share/pixmaps and applications (automatically linked from scm-load when pack mounted)
3)purge /apps/packname from undesired file
4)put eventually start script (install) and variables/flag file (spec) in /apps/packname/config
5)make pack with mksquashfs ./packname packname.scm
it is all?


Two more question
1) it possible to create a database containing a list of all "-sc.inc" so that we can reuse them when needed to build new scm?
2) i see your tcz converting script, this makes me think that the settings given during the compilation does not make incompatible the two types of packets with each other.
it is possible in some way merge the two builds in one?

This remind me the old .tce (but I can not figure out if there are real similaritudes)

P.s. thanks Jason

Offline Jason W

  • Administrator
  • Hero Member
  • *****
  • Posts: 9730
Re: SCM buildin how-to
« Reply #11 on: April 10, 2012, 02:38:29 AM »
It appears that a dependency of circuslinux was not successfully built, which should have resulted in the build stopping.  I will try downloading the files and building again.

Converting tcz's works for some apps, not for all, and some other things have to be done on a case by case basis.

Basically those steps you describe is how it works.

A database of -sc.inc files is possible, but some apps need a particular version of something and also perhaps built a certain way, so those cases would need to run their own particular build files.

Offline vinnie

  • Hero Member
  • *****
  • Posts: 1187
  • HandMace informatic works
Re: SCM buildin how-to
« Reply #12 on: April 10, 2012, 06:57:17 AM »
Quote
Converting tcz's works for some apps, not for all, and some other things have to be done on a case by case basis.
only asked to streamline in some way the creation of the two types of packets, basically i am lazy  :)

Quote
A database of -sc.inc files is possible, but some apps need a particular version of something and also perhaps built a certain way, so those cases would need to run their own particular build files.
We could distinguish the different versions by name.
But effectively, now you make me think, your script is just a method for making the scm, but someone might like to use other.

If I can, I will try to make a package scm seriously this day.

Offline vinnie

  • Hero Member
  • *****
  • Posts: 1187
  • HandMace informatic works
Re: SCM buildin how-to
« Reply #13 on: April 12, 2012, 07:26:52 PM »
It took me a while because I did not know which program to choose, I ended up with a program called gargoyles, interactive fiction interpreter.
After various adventures I managed to compile it, but now I'm a bit undecided how to proceed.

in addition to ftjam that I will have to create it myself (but just the TCZ, this is tool for compilation), I need this tcz to compile normally gargoyle:

tce-load -i compiletc SDL-dev SDL sdl-sound-dev sdl-sound libvorbis-dev libvorbis smpeg gtk2-dev

However things that should be included in /apps/packname are only the start dependencies, so how do I proceed?
Install all tcz build dep for gargoyle start dep and compile this in scm style?
And for gtk2 use export before compiling start dep.
These exports are used to tell the program where to find libraries after being compiled?


P.s. stealing the PKGBUILD from aur, startup dependencies "should" be these:
gtk2 sdl_mixer sdl_sound libvorbis freetype2
« Last Edit: April 12, 2012, 07:31:21 PM by vinnie »

Offline Jason W

  • Administrator
  • Hero Member
  • *****
  • Posts: 9730
Re: SCM buildin how-to
« Reply #14 on: April 12, 2012, 07:33:28 PM »
Gtk2 apps will need to be built against this tarball package:

http://distro.ibiblio.org/tinycorelinux/4.x/x86/scm/gtk2-dev.tar.xz

Just uninstall gtk2.scm and untar that xz in /apps.

Compiletc.tcz and perhaps it's related development tcz's should be your only tcz's you depend on.  SDL, gtk2, smpeg, they should be installed in the scm, or be depended on in the case of gtk2.scm.

There are -sc.inc files for sdl and libvorbis in the source area.