Author Topic: RPM Spec file is ready  (Read 18667 times)

Offline TheTuxKeeper

  • Regular
  • ***
  • Posts: 293
  • daniel2000
RPM Spec file is ready
« on: October 16, 2005, 11:42:39 am »
Here is the first release of my Specfile. Since it's my first Spec it's a minimalistic one, but I want to add subpackages in the next time.

Here is a little Howto for building the rpm :
1. You need a fresh CVS version, no ./bootstrap or anything else should be done before in this directory !
2. rename the rootdirectory (the one with bootstrap and so on) to codeblocks-1.0
3. add the directory codeblocks-1.0 to an tar.gz or tar.bz2 archive named codeblocks-1.0-cvs.tar.gz (or .bz2)
Code
tar -czf codeblocks-1.0-cvs.tar.gz codeblocks-1.0 # gzip tar archive or
tar -cjf codeblocks-1.0-cvs.tar.bz2 codeblocks-1.0 # bzip2 tar archive
If you want to use a tar.bz2 archive you also have to edit the "Source:" line to %{name}-%{version}-%{release}.tar.bz2
4. copy the archive in the directory /usr/src/packages/SOURCES and the Specfile to /usr/src/packages/SPECS/codeblocks.spec
5. build the binary package as root with
Code
rpmbuild -bb /usr/src/packages/SPECS/codeblocks.spec
6. the package will be in one of the subdirectories of /usr/src/packages/RPMS/

Please contact me when there is any problem.

Daniel

EDIT: In the moment the package version is "1.0" and the release "cvs" so the complete version string will be 1.0-cvs and that's not good when you want to update later. You can edit the Release string perhaps to cvs.20051016 (no dashes "-" allowed!). But then the archive has to be renamed too. The package name must have the form %{name}-%{version}-%{release}.tar.gz in this example codeblocks-1.0-cvs.20051016.tar.gz

[attachment deleted by admin]
« Last Edit: October 16, 2005, 12:10:22 pm by daniel2000 »
Nightly builds for openSUSE

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4315
    • Code::Blocks IDE
Re: RPM Spec file is ready
« Reply #1 on: October 16, 2005, 12:23:28 pm »
Nice, thanks Daniel :D
Be patient!
This bug will be fixed soon...

Offline hongxing

  • Multiple posting newcomer
  • *
  • Posts: 60
Re: RPM Spec file is ready
« Reply #2 on: October 16, 2005, 04:13:53 pm »
I am a newbie, what the usage of spec file? can you explain it for me?
I have compiled the cvs-head codeblocks sucessfully, how can I buid rpm from it?

thanks!

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4315
    • Code::Blocks IDE
Re: RPM Spec file is ready
« Reply #3 on: October 16, 2005, 04:44:21 pm »
I am a newbie, what the usage of spec file? can you explain it for me?
I have compiled the cvs-head codeblocks sucessfully, how can I buid rpm from it?

thanks!

Why don't you read Daniel's post? He has written in detail what you have to do...
Be patient!
This bug will be fixed soon...

Offline hongxing

  • Multiple posting newcomer
  • *
  • Posts: 60
Re: RPM Spec file is ready
« Reply #4 on: October 18, 2005, 09:53:02 am »
thanks, I make the rpm successfully on my SuSE Linux 9

afecelis

  • Guest
Re: RPM Spec file is ready
« Reply #5 on: October 28, 2005, 04:43:11 pm »
Great! fantastic! outstanding!!!!  First time I ever get Codeblocks to run under linux!!!  :D :D Thank you Daniel!!! It also taught me how to build an rpm package. It worked perfectly for Suse 10. I had never been able to compile the source so this is by far a huge success for me!!!

The RPM package I built can be downloaded here:
http://www.danielpatton.com/afecelis/Codeblocks/codeblocks-1.0-cvs.i586.rpm

ps. Mandrav, many thanks for the Irrlicht project template!!  :D
« Last Edit: October 29, 2005, 02:48:00 am by afecelis »

Offline TheTuxKeeper

  • Regular
  • ***
  • Posts: 293
  • daniel2000
Re: RPM Spec file is ready
« Reply #6 on: November 03, 2005, 02:07:07 am »
I added a new article in the wiki with the current Specfile.
-> Compiling Code::Blocks in RPM based distributions

Happy codeblocking  :D

Daniel
Nightly builds for openSUSE

Offline fiammy

  • Multiple posting newcomer
  • *
  • Posts: 46
    • Nebulagame
Re: RPM Spec file is ready
« Reply #7 on: November 03, 2005, 03:44:08 pm »
It works, but (yes, there's always a but, not necessarily with 2 't' s :-) ) when I want to build the package on SuSE 10.0 x86_64, the system complains that the paths for the libaries aren't right. On 64-bit systems, the 'lib' directory is replaced with a 'lib64'. I don't know if it is possible to autodetect the 'lib' path on the system?

else, great script. Thanks. It's simple enough to show me how to do a .rpm setup for my own projects, and still it had enough features to make it really usefull.

Thanks.

Offline baboo

  • Multiple posting newcomer
  • *
  • Posts: 15
Re: RPM Spec file is ready
« Reply #8 on: November 03, 2005, 05:08:42 pm »
Hello
I installed all the prerequisites for the RPM and this is what i ran:

[[email protected]]# rpm -i codeblocks-1.0-cvs.i586.rpm
error: unpacking of archive failed: cpio: Bad magic


Any ideas why? I didnt build the rpm on my machine. It is downloaded from the address from the first post.

Thank you.

I am running Fedora Core 4 on an Athlon 2600+/ 512MB/ 40GB.

« Last Edit: November 03, 2005, 05:10:48 pm by baboo »

Offline TheTuxKeeper

  • Regular
  • ***
  • Posts: 293
  • daniel2000
Re: RPM Spec file is ready
« Reply #9 on: November 03, 2005, 06:27:26 pm »
[[email protected]]# rpm -i codeblocks-1.0-cvs.i586.rpm
error: unpacking of archive failed: cpio: Bad magic


Any ideas why? I didnt build the rpm on my machine. It is downloaded from the address from the first post.

Thank you.

I am running Fedora Core 4 on an Athlon 2600+/ 512MB/ 40GB.
Don't even try to use binary RPM's compiled for other distribution  :twisted:  Even RPM's of Suse 9.2 doesn't work in Suse 9.3 in many cases. :(

The file are linked to different lib's with different versions and features.

So it's better using the source RPM from the download page and build it yourself. ;)


It works, but (yes, there's always a but, not necessarily with 2 't' s :-) ) when I want to build the package on SuSE 10.0 x86_64, the system complains that the paths for the libaries aren't right. On 64-bit systems, the 'lib' directory is replaced with a 'lib64'. I don't know if it is possible to autodetect the 'lib' path on the system?
Oh, that's a bug in my Specfile !!!

I didn't set the lib path manually. So it's always /usr/lib but your lib path is /usr/lib64.

Add the red marked line to the Specfile:
Quote
%build
  ./bootstrap
  ./configure \
     --prefix=%{_prefix} \
     --libdir=%{_libdir}\
     --exec-prefix=%{_exec_prefix} \
     --datadir=%{_datadir} \
     --sysconfdir=%{_sysconfdir} \
     --with-docdir=%{_docdir} \
     CXXFLAGS="$RPM_OPT_FLAGS" \
     CFLAGS="$RPM_OPT_FLAGS"
  make

When you use the source RPM just install it as root:
Code
rpm -i codeblocks-1.0-rc2.src.rpm

The Specfile will be in /usr/src/packages/SPECS (codeblocks-rc2.spec).

Thank you
Nightly builds for openSUSE

Offline baboo

  • Multiple posting newcomer
  • *
  • Posts: 15
Re: RPM Spec file is ready
« Reply #10 on: November 03, 2005, 06:39:56 pm »
>Don't even try to use binary RPM's compiled for other distribution    Even RPM's of Suse 9.2 doesn't work in Suse 9.3 in many cases. 
>The file are linked to different lib's with different versions and features.
>So it's better using the source RPM from the download page and build it yourself.

Well, i tried to build it from sources... i got lost in a makefile.unix thing...
please give me a clue what is happening.

thank you.

Offline TheTuxKeeper

  • Regular
  • ***
  • Posts: 293
  • daniel2000
Re: RPM Spec file is ready
« Reply #11 on: November 04, 2005, 11:41:36 am »
@baboo: Take the source RPM from the Download section and compile it with:
Code
rpmbuild --rebuild codeblocks-1.0-rc2.src.rpm
To compile it, on your fedora has to be installed wxGTK2-devel, wxGTK2-xrc-devel + non devel packages (should be installed automatically because of the dependencies). I think these are the right package names, but it can also be wxGTK without the "2" instead.

It's also described in the wiki: Compiling Code::Blocks in RPM based distributions

Daniel
Nightly builds for openSUSE

Offline baboo

  • Multiple posting newcomer
  • *
  • Posts: 15
Re: RPM Spec file is ready
« Reply #12 on: November 04, 2005, 12:32:58 pm »
Hello,
I tried to
rpmbuild --rebuild codeblocks-1.0-rc2.src.rpm

and this is the error:

cbthreadpool.cpp:253: error: 'wxUSleep' was not declared in this scope
make[4]: *** [cbthreadpool.lo] Error 1
make[4]: Leaving directory `/usr/src/redhat/BUILD/codeblocks-1.0rc2/src/sdk'
make[3]: *** [all-recursive] Error 1
make[3]: Leaving directory `/usr/src/redhat/BUILD/codeblocks-1.0rc2/src/sdk'
make[2]: *** [all] Error 2
make[2]: Leaving directory `/usr/src/redhat/BUILD/codeblocks-1.0rc2/src/sdk'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/usr/src/redhat/BUILD/codeblocks-1.0rc2/src'
make: *** [all-recursive] Error 1
error: Bad exit status from /var/tmp/rpm-tmp.86085 (%build)

RPM build errors:
    user daniel does not exist - using root
    user daniel does not exist - using root
    Bad exit status from /var/tmp/rpm-tmp.86085 (%build)


Please tell me why and how can I fix it.
Thank you a lot.

Offline TheTuxKeeper

  • Regular
  • ***
  • Posts: 293
  • daniel2000
Re: RPM Spec file is ready
« Reply #13 on: November 04, 2005, 03:01:55 pm »
It the same error like here: http://forums.codeblocks.org/index.php/topic,1146.0.html

To fix it do these steps as root:

1. Extract the sources and the specfile
Code
rpm -i codeblocks-1.0-rc2.src.rpm
2. move (not only copy) the sources ( /usr/src/packages/SOURCES/codeblocks-1.0rc2.tgz ) to another place, perhaps to the home directory
3. go to the home directory and extract the sources with
Code
tar -xzf codeblocks-1.0rc2.tgz
4. go in the directory codeblocks-1.0rc2/src/sdk of the extracted sources
5. edit in the lines 253 and 268 of cbthreadpool.cpp "wxUSleep" to "wxUsleep" ( uppercase 'S' to lowercase 's')
6. go back to the home directory
7. create a new archive in the directory where the old ones were with
Code
tar -czf /usr/src/packages/SOURCES/codeblocks-1.0rc2.tgz codeblocks-1.0rc2
8. build the rpm by using the specfile:
Code
rpmbuild -bb /usr/src/packages/SPECS/codeblocks-rc2.spec
9. when everything goes right the binary RPM should be in one of the subdirectories of /usr/src/packages/RPMS (normally i586 or i686)

Puh, I hope that works and I've no typo ;)

Daniel
Nightly builds for openSUSE

Online killerbot

  • Administrator
  • Lives here!
  • *****
  • Posts: 5291
Re: RPM Spec file is ready
« Reply #14 on: November 04, 2005, 04:21:43 pm »
I got the same problem (suse 10) as baboo, then tried out your new method Daniel, but I get errors :
configure.in:61: error: possibly undefined macro: AM_OPTIONS_WXCONFIG
      If this token and others are legitimate, please use m4_pattern_allow.
      See the Autoconf documentation.
configure.in:62: error: possibly undefined macro: AM_PATH_WXCONFIG
error: Bad exit status from /var/tmp/rpm-tmp.933 (%build)


RPM build errors:
    Bad exit status from /var/tmp/rpm-tmp.933 (%build)


Lieven