[HOWTO] improper way to compile/create module

Post tutorials, HOWTO's and other useful resources here.
Post Reply
lachman
White ninja
White ninja
Posts: 9
Joined: 11 Nov 2011, 00:50
Location: Boston

[HOWTO] improper way to compile/create module

Post#1 by lachman » 12 Nov 2011, 18:23

WARNING: This violates all sorts of conventions that people have made great efforts to maintain. Modules created this way should not be shared ever. Idea of this post is personal convenience and quick OS production/consumption. Any suggestions to make this more 'proper' are welcome. If I saw this post I would delete it. end disclaimer.

Say you download source tar for X:

Decompress source:

Code: Select all

tar xzvf X.gz
Move into the source directory

Code: Select all

cd X
Configure before compiling. May need to customize.

Code: Select all

./configure --prefix=/usr/
Compile

Code: Select all

make
Take a snapshot of the file system

Code: Select all

find /mnt/live/memory/changes -type f > /tmp/oldchanges
Install the package

Code: Select all

make install
Take a post install snapshot of the filesystem

Code: Select all

find /mnt/live/memory/changes -type f > /tmp/newchanges
Move out the source directory

Code: Select all

cd ../
Identify differences made after installation

Code: Select all

diff /tmp/oldchanges /tmp/newchanges > files
Remove the prefix so path is relative to '/'

Code: Select all

cat files | grep -v "tmp/newchanges" | grep ">" | sed 's_> /mnt/live/memory/changes__' > newfiles
Create the module

Code: Select all

cat newfiles| xargs tar cf temp.tar
mkdir temp
tar xf temp.tar -C temp
dir2xzm temp X.xzm
The idea is to make a script to set up all modules needed for a customized OS. Imagine one script with 10 concatenated instances of the script below:

tar xzvf X.gz
cd X
./configure --prefix=/usr/
make
find /mnt/live/memory/changes -type f > /tmp/oldchanges
make install
find /mnt/live/memory/changes -type f > /tmp/newchanges
cd ../
diff /tmp/oldchanges /tmp/newchanges > files
cat files | grep -v "tmp/newchanges" | grep ">" | sed 's_> /mnt/live/memory/changes__' > newfiles
rm temp.tar
cat newfiles| xargs tar cf temp.tar
rm -rf temp
mkdir temp
tar xf temp.tar -C temp
dir2xzm temp X.xzm
Last edited by lachman on 12 Nov 2011, 19:15, edited 4 times in total.

User avatar
Hamza
Warlord
Warlord
Posts: 1847
Joined: 28 Dec 2010, 07:41
Distribution: Porteus
Location: France

Re: [HOWTO] improper way to compile/create module

Post#2 by Hamza » 12 Nov 2011, 18:35

Welcome on board!

That is very appreciated to write an HOWTO for users.

Please take a moment and rewrite an correct HOWTO.

An example of "correct" howto :
  1. Decompress the archive using this command - where X is the real name of the archive

    Code: Select all

    tar xzvf X.gz
  2. Go to the directory where the archive was uncompressed - where X is the real path of the directory

    Code: Select all

    cd X
  3. Prepare the system and checks the dependencies

    Code: Select all

    ./configure --prefix=/usr/
  4. Launch the compilation using make command

    Code: Select all

    make
  5. Execute this command to make a list of changes between the old version and new version.

    Code: Select all

    find /mnt/live/memory/changes -type f > /tmp/oldchanges
  6. Execute this command to install the result of the compilation to the current system.

    Code: Select all

    make install
You could use this example to write an HOWTO if you do not like to write a long text. :)

Regards
NjVFQzY2Rg==

lachman
White ninja
White ninja
Posts: 9
Joined: 11 Nov 2011, 00:50
Location: Boston

Re: [HOWTO] improper way to compile/create module

Post#3 by lachman » 12 Nov 2011, 18:51

Making me work Hamza! improper==poor==lazy :-)

maybe upload script: X == $1. K. I'll edit see how it goes....

User avatar
Hamza
Warlord
Warlord
Posts: 1847
Joined: 28 Dec 2010, 07:41
Distribution: Porteus
Location: France

Re: [HOWTO] improper way to compile/create module

Post#4 by Hamza » 12 Nov 2011, 19:12

If you want to post an how to like this one.
Please move your topic in Development section

Regards
NjVFQzY2Rg==

lachman
White ninja
White ninja
Posts: 9
Joined: 11 Nov 2011, 00:50
Location: Boston

Re: [HOWTO] improper way to compile/create module

Post#5 by lachman » 12 Nov 2011, 19:19

done. is there a way to delete this post? Dont' see it. Anywho, I just found the above script helpful. Nice to make one big script that creates all xzms. cheers

User avatar
Hamza
Warlord
Warlord
Posts: 1847
Joined: 28 Dec 2010, 07:41
Distribution: Porteus
Location: France

Re: [HOWTO] improper way to compile/create module

Post#6 by Hamza » 12 Nov 2011, 19:24

Thank you.
You should have an X at top of your first message.
Push on it and confirm that you want to remove the topic.
NjVFQzY2Rg==

lachman
White ninja
White ninja
Posts: 9
Joined: 11 Nov 2011, 00:50
Location: Boston

Re: [HOWTO] improper way to compile/create module

Post#7 by lachman » 12 Nov 2011, 19:31

i got no 'X'... Am i missing something.. trying to post a screenshot

User avatar
Hamza
Warlord
Warlord
Posts: 1847
Joined: 28 Dec 2010, 07:41
Distribution: Porteus
Location: France

Re: [HOWTO] improper way to compile/create module

Post#8 by Hamza » 12 Nov 2011, 19:33

True. :roll:
I will send a PM to Admins about this problem.
NjVFQzY2Rg==

lachman
White ninja
White ninja
Posts: 9
Joined: 11 Nov 2011, 00:50
Location: Boston

Re: [HOWTO] improper way to compile/create module

Post#9 by lachman » 12 Nov 2011, 19:38

Thanks Hamza. Not trying to dirty up the place. My room is already a mess. No need for the forum to be :-)

User avatar
wread
Module Guard
Module Guard
Posts: 1080
Joined: 09 Jan 2011, 18:48
Distribution: Porteus v3.2.5-kde5-64 bits
Location: Santo Domingo
Contact:

Re: [HOWTO] improper way to compile/create module

Post#10 by wread » 12 Nov 2011, 20:43

Porteus has a built in script named /opt/porteus/changes-time.sh that does that. You have to invoke it after make install and it will put the changes in a folder in /root. Rename it as required, inspect it and right click it to convert it to a porteus module. This wheel is already invented by fanthom.

However, and I don't know why, but if you compile a source pre-worked for cmake, this method by fanthom sometimes fails; you have to complete it by hand copying some files, according to my experience. Maybe your method is better for that case.

You should go ahead with it. In the community there are many CLI-experts that could help you. It is a good exercise!

Regards
Porteus is proud of the FASTEST KDE ever made.....(take akonadi, nepomuk and soprano out and you will have a decent OS).
The Porteus Community never sleeps!

User avatar
fanthom
Site Admin
Site Admin
Posts: 4592
Joined: 28 Dec 2010, 02:42
Distribution: Porteus Kiosk
Location: Poland, currently - Cork, IE
Contact:

Re: [HOWTO] improper way to compile/create module

Post#11 by fanthom » 12 Nov 2011, 21:42

@lachman
we have a FAQ Q/A which covers this matter:
http://porteus.org/faq.html#29

i like your method of separating files but it's not perfect - it wont work in case of upgrading package when user is saving changes.
for exapmle when you compile never version of mplayer (and previous one is already in /mnt/live/memory/changes) majority of files will be the same thus not catched up by diff utility.

'changes-time.sh' script is better (but not best) cause it searches /mnt/live/memory/changes folder for files/dirs modified in last 1,2,3,n minutes.
'changes-time.sh' has one weakness - it wont work for precompiled binaries like Virtualbox when libs included in .run file were compiled some time ago (day, week, month).
Anyway - 'changes-time.sh' should work for all aps compiled directly from sources.

btw: i have deleted same topic from 'Development' as this 'HOWTO' fits better here.
Please add [Solved] to your thread title if the solution was found.

User avatar
brokenman
Site Admin
Site Admin
Posts: 5504
Joined: 27 Dec 2010, 03:50
Distribution: Porteus v3.2rcX all desktops
Location: Brazil
Contact:

Re: [HOWTO] improper way to compile/create module

Post#12 by brokenman » 14 Nov 2011, 21:22

I might just add that usually the DESTDIR variable is available when compiling from source. This negates the need to run around looking for changes.

Code: Select all

grep DESTDIR Makefile
If it exists you can simply create a folder and install directly there before stripping for porteus,

Code: Select all

make DESTDIR=/tmp/myfolder install
You can open /opt/porteus-scripts/txz2xzm to see how to strip a package of unwanted files.
How do i become super user?
Wear your underpants on the outside and put on a cape.

lachman
White ninja
White ninja
Posts: 9
Joined: 11 Nov 2011, 00:50
Location: Boston

Re: [HOWTO] improper way to compile/create module

Post#13 by lachman » 14 Nov 2011, 21:50

@fanthom
I did not know changes-time.sh existed. I found an instance where my build scripts don't work, some files were missing, and changes-time caught them.

It doesn't make sense to build packages one at a time while sleeping for the clock, so does it make sense to have a script that sets everything in /mnt/live/memory/changes to 1970 and use changes-time.sh. Ie:

./configure
make
/opt/changes-zero-clock.sh
make install
/opt/changes-time.sh (couple years)
build xzm

@brokenman
Thanks. I will try the DESTDIR.

Sniker
Ronin
Ronin
Posts: 2
Joined: 23 Dec 2011, 04:04
Location: Republica Dominicana

Re: [HOWTO] improper way to compile/create module

Post#14 by Sniker » 03 Jan 2012, 11:29

root@porteus:~/Documents/aMule-2.2.6# ./configure --prefix=/usr/

checking for a BSD-compatible install... /usr/bin/ginstall -c
checking whether build environment is sane... yes
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether to enable maintainer-specific portions of Makefiles... no
checking build system type... i686-pc-linux-gnu
checking host system type... i686-pc-linux-gnu
checking if this is a FreeBSD 4 or earlier system... no
checking for g++... g++
checking for C++ compiler default output file name... a.out
checking whether the C++ compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking for style of include used by make... GNU
checking dependency style of g++... gcc3
checking how to run the C++ preprocessor... /lib/cpp
configure: error: C++ preprocessor "/lib/cpp" fails sanity check
See `config.log' for more details.

LOOK UP.... I HAVE THIS ERROR...

User avatar
fanthom
Site Admin
Site Admin
Posts: 4592
Joined: 28 Dec 2010, 02:42
Distribution: Porteus Kiosk
Location: Poland, currently - Cork, IE
Contact:

Re: [HOWTO] improper way to compile/create module

Post#15 by fanthom » 03 Jan 2012, 20:25

@Sniker
What's your Porteus version and arch? where can i get source code for aMule (i would like to recreate error on my side)?
did you try to compile it in 'Always Fresh' mode with /base modules only?
finally - did you have development module activated when running configure?

please answer all of the questions above.
Please add [Solved] to your thread title if the solution was found.

Post Reply