Fedora Linux Support Community & Resources Center
  #1  
Old 2nd May 2017, 07:38 PM
ThanosApostolou Online
Registered User
 
Join Date: Nov 2016
Location: Athens, Greece
Posts: 17
linuxfedorafirefox
Is there a guide to convert arch's PKGBUILD to RPM packages?

Hello, I am a manjaro user (sometimes I'm using arch and ubuntu). I'm starting to love fedora but there is some software missing, which prevents me from using it full time. So, I've been trying to learn fedora's packaging, because the software I want needs some patches and dependencies of other additional software which makes it really hard and messy to just compile it and use it without packaging it. However fedora's packaging seems a lot more complicated than arch's pkgbuild with which I have a little experience (at least for my skills).

Is there any guide/tutorial which compares side by side pkgbuild files and fedora's .spec files or anything similar to that? I thought I could find something like that easily but "pkgbuild to rpm" google search doesn't give anything useful...
Reply With Quote
  #2  
Old 2nd May 2017, 09:33 PM
antikythera Offline
Administrator
 
Join Date: Dec 2013
Location: United Kingdom
Posts: 4,058
windows_7chrome
Re: Is there a guide to convert arch's PKGBUILD to RPM packages?

what software are you missing? it may be available from copr or rpmfusion for example. it's always best to mention what packages you can't find as it may be far simpler than you think to get them installed.
__________________
Download, Install and Share Fedora - Official ISO Torrents | Live ISO Respins containing post-release updates
Reply With Quote
  #3  
Old 2nd May 2017, 10:07 PM
ThanosApostolou Online
Registered User
 
Join Date: Nov 2016
Location: Athens, Greece
Posts: 17
linuxfedorafirefox
Re: Is there a guide to convert arch's PKGBUILD to RPM packages?

Thx for replying, I've checked and there aren't any copr repositories for those I'm looking for (I'm planning to create one of my own after I achieve to create the packages and learn how copr works). I want to use `ns2`, `nam` and `xgraph` which I need for my University's projects (https://sourceforge.net/projects/nsnam/?source=navbar). There is a different precompiled binary `xgarph` so that's not the problem. However, ns2 requires build dependencies `otcl` and `tclcl` (http://otcl-tclcl.sourceforge.net/otcl/).

The PKGBUILDs which I am trying to convert to RPMs are taken from here (including the patches):

https://aur.archlinux.org/packages/ns/
https://aur.archlinux.org/packages/nam/
https://aur.archlinux.org/packages/otcl/
https://aur.archlinux.org/packages/tclcl/

I am trying to package `otcl` for now but I'm failing big time... I haven't even understood if I need to include the source file or if it gets automatically downloaded like when using makepkg at arch. Also I haven't understood if I suppose to use `fedpkg` or `rpmbuild` command.
Reply With Quote
  #4  
Old 3rd May 2017, 01:39 AM
donatom Offline
Registered User
 
Join Date: Jan 2013
Location: Ventura, CA
Posts: 44
linuxfirefox
Re: Is there a guide to convert arch's PKGBUILD to RPM packages?

I use arch linux too. I find that arch has fewer programs than fedora. Of course, you can get most of the popular apps through AUR (Arch Users' Repository) which consists of programs that were converted from rpms (fedora) or debs (Debian).

As antikythera has said, you should be able to find almost any program for fedora if you set up the rpmfusion repository.

If you do find that there is no rpm for a certain program but there is a deb file for that program, you might want to use alien which can convert rpms into debs and debs into rpms. Here is a link which explains alien from a Debian/Ubuntu perspective: http://www.debianadmin.com/install-r...nd-ubuntu.html

Last edited by donatom; 3rd May 2017 at 01:42 AM. Reason: correction
Reply With Quote
  #5  
Old 3rd May 2017, 06:18 AM
topiwala Offline
Registered User
 
Join Date: Aug 2011
Location: India
Age: 31
Posts: 332
linuxfedorafirefox
Re: Is there a guide to convert arch's PKGBUILD to RPM packages?

I use pkgs.org to know which repositories contain the software i need for Fedora. Also Copr. Most needs are met.
Reply With Quote
  #6  
Old 3rd May 2017, 03:44 PM
ThanosApostolou Online
Registered User
 
Join Date: Nov 2016
Location: Athens, Greece
Posts: 17
linuxfedorafirefox
Re: Is there a guide to convert arch's PKGBUILD to RPM packages?

Thx guys but the software I mentioned doesn't exist in rpmfusion or any copr repository and it will be a learning experience building it from scratch instead of trying to use a modified deb file (which I doubt it will work).

I have successfully build `otcl` for start, which I have uploaded at a github repository until I learn to use copr (https://github.com/ThanosApostolou/f...ee/master/otcl). I built it with mock (which I'm starting to really like!!) and everything seems ok.

My only problem is that the libraries go to folder /usr/lib, but if I understood correctly, I believe they should go to /usr/lib64 when you build on x86_64 right? I even tried the argument `-libdir=%{buildroot}/%{_libdir}` at `%configure` but it seems to have no effect. If anyone can look at my spec file on github and give me some directions on how to fix that (or any general advice) I would be grateful
Reply With Quote
  #7  
Old 3rd May 2017, 04:03 PM
PabloTwo Offline
"Registered User" T-Shirt Winner
 
Join Date: Mar 2007
Location: Seville, FL
Posts: 7,533
linuxchrome
Re: Is there a guide to convert arch's PKGBUILD to RPM packages?

Quote:
....My only problem is that the libraries go to folder /usr/lib, but if I understood correctly, I believe they should go to /usr/lib64 when you build on x86_64 right?
Yes, that is correct. 32 bit libs should go to /usr/lib/ and 64 bit libs should go to /usr/lib64 on Fedora.

The "%configure" macro alone should set that correctly. You should not add %{buildroot} to libdir path. I don't have any experience in using mock, but I do rpm package building for myself in Fedora using rpmbuild.
Code:
$ uname -m
x86_64
Code:
$ rpm -E %{_libdir}
/usr/lib64
Code:
$ rpm -E %configure | grep libdir
	--libdir=/usr/lib64 \
Notice also that -libdir= is not correct. Should be --libdir= (double hyphen).

Last edited by PabloTwo; 3rd May 2017 at 04:17 PM.
Reply With Quote
  #8  
Old 3rd May 2017, 04:46 PM
PabloTwo Offline
"Registered User" T-Shirt Winner
 
Join Date: Mar 2007
Location: Seville, FL
Posts: 7,533
linuxchrome
Re: Is there a guide to convert arch's PKGBUILD to RPM packages?

I did find rpm packages for the packages you specified, but they are for OpenSuSE, which are often not directly compatible with Fedora. But here they are if you want them for reference purposes or to just see what's in them.
Code:
http://rpm.pbone.net/index.php3/stat/4/idpl/23357553/dir/opensuse/com/ns2-2.35-3.32.x86_64.rpm.html
http://rpm.pbone.net/index.php3/stat/4/idpl/23357541/dir/opensuse/com/nam-1.15-1.31.x86_64.rpm.html
http://rpm.pbone.net/index.php3/stat/4/idpl/23357561/dir/opensuse/com/otcl-1.14-1.34.x86_64.rpm.html
http://rpm.pbone.net/index.php3/stat/4/idpl/23357577/dir/opensuse/com/tclcl-1.20-1.34.x86_64.rpm.html
In my opinion, for what it's worth, for anyone attempting building rpm packages for Fedora, there is simply no substitute for learning the basic rpm package building skills (the Fedora way). A good understanding of how to construct a spec file and what all the various components in it do is essential. The spec file controls every aspect of the code compiling and package building process. That can range anywhere from really simple to extremely complex.

Fedora has good guides for learning:
Code:
https://fedoraproject.org/wiki/How_to_create_an_RPM_package
https://docs.fedoraproject.org/en-US/Fedora_Draft_Documentation/0.1/html/RPM_Guide/index.html
Would be a good place to start (perhaps you've already been there). Also notice the "Packaging Guidelines" link on that page.

Also, don't just assume that patch files for compiling code and building a package from one Linux distribution would necessarily apply to another Linux distribution. You need to know what the "patch" does and why it's being applied.

Last edited by PabloTwo; 3rd May 2017 at 05:43 PM.
Reply With Quote
  #9  
Old 3rd May 2017, 06:01 PM
ThanosApostolou Online
Registered User
 
Join Date: Nov 2016
Location: Athens, Greece
Posts: 17
linuxfedorafirefox
Re: Is there a guide to convert arch's PKGBUILD to RPM packages?

Quote:
Originally Posted by PabloTwo View Post
Notice also that -libdir= is not correct. Should be --libdir= (double hyphen).
Yeah you are right However I cannot get the libraries under /usr/lib64 no matter what configure arguments I pass. Maybe the software's configure file is problematic. I have to use these lines in order to have the desired behavior"

Code:
%prep
%setup
%patch0 -p1

%build
%configure --prefix=%{buildroot}/usr
%make_build -j1

%install
%make_install
if test "%{_arch}" == x86_64; then
    install -Dm755 %{buildroot}/usr/lib/libotcl.a %{buildroot}/%{_libdir}/libotcl.a
    install -Dm755 %{buildroot}/usr/lib/libotcl.so %{buildroot}/%{_libdir}/libotcl.so
    rm %{buildroot}/usr/lib/libotcl.a %{buildroot}/usr/lib/libotcl.so
fi
If you have time to test it yourself and tell me if I'm doing something wrong. The final otcl.spec file is this: https://pastebin.com/nngqcC7M
Reply With Quote
  #10  
Old 3rd May 2017, 06:59 PM
PabloTwo Offline
"Registered User" T-Shirt Winner
 
Join Date: Mar 2007
Location: Seville, FL
Posts: 7,533
linuxchrome
Re: Is there a guide to convert arch's PKGBUILD to RPM packages?

From your spec file:
Code:
Summary:        The "Hello World" program from GNU
Give it a proper and meaningful line.
Code:
%configure --prefix=%{buildroot}/usr
As I said earlier, "--prefix=%{buildroot}/usr" should not be added here. The "%configure" macro defines the proper directory structure for fedora. Defining --prefix=%{buildroot}/usr makes the $BUILDROOT as part of the actual install path. Just try using %configure by itself.

What does the patch file do and where can I get it? I tried compiling the source code (no patch applied) and got:
Code:
Makfile:91: recipe for target 'libotcl.a' failed
make: *** [libotcl.a] Error 1
And, official Fedora packages do not install static libraries unless there is a compelling reason to do so.

Edit: Got the patch file.

Last edited by PabloTwo; 3rd May 2017 at 07:12 PM.
Reply With Quote
  #11  
Old 3rd May 2017, 07:30 PM
ThanosApostolou Online
Registered User
 
Join Date: Nov 2016
Location: Athens, Greece
Posts: 17
linuxfedorafirefox
Re: Is there a guide to convert arch's PKGBUILD to RPM packages?

Well I cannot get it to build with just %configure. I get "permission denied" error because it tries to put files directly into /usr.

I don't know what exactly the patch does, but it fixes the compilation errors. You can get it here: https://aur.archlinux.org/cgit/aur.g...t.patch?h=otcl (I have uploaded the latest files at my github too https://github.com/ThanosApostolou/f...ee/master/otcl).

I'm trying to build `tclcl` now but it cannot find the otcl libraries. I think it works only if they are on the /usr/lib and not /usr/lib64 folder. That's why the opensuse links you gave me have more patches (unfortunately those packages depend on tcl 8.5 and it's hard for me to build them).
Reply With Quote
  #12  
Old 3rd May 2017, 07:50 PM
PabloTwo Offline
"Registered User" T-Shirt Winner
 
Join Date: Mar 2007
Location: Seville, FL
Posts: 7,533
linuxchrome
Re: Is there a guide to convert arch's PKGBUILD to RPM packages?

Patch file worked so the code compiled OK, but the install script in this source code is not honoring the DESTDIR=<install_path>. It wants to install directly to the / root directory install location instead of where the DESTDIR= location is pointing to.
Code:
$ rpm -E %make_install
/usr/bin/make install DESTDIR=/home/paul/rpmbuild/BUILDROOT/%{name}-%{version}-%{release}.x86_64
Which is where the %make_install directive would/should install to if I were building an rpm package. My test case was to configure and compile directly from the untarred souce code and then using:
Code:
make install DESTDIR=/home/paul/Work/otcl
, as normal user which didn't work as it tried to install to /usr/..... and bombed with a "permission denied", gratefully.

So it may be necessary to forego the %make_install command and just manually use install to direct all files into the proper locations in the %{buildroot}. I'll play with this some more, including building the rpm package from spec file.
Reply With Quote
  #13  
Old 3rd May 2017, 07:54 PM
PabloTwo Offline
"Registered User" T-Shirt Winner
 
Join Date: Mar 2007
Location: Seville, FL
Posts: 7,533
linuxchrome
Re: Is there a guide to convert arch's PKGBUILD to RPM packages?

The "install-sh" script in the source code may be fouling up the works here. It's things like this that can complicate simple rpm package building. I also ran the ./configure command with all the standard Fedora %configure dir paths, and that was also not honored by make install. All the install paths are hardwired by some configuration and/or script files here. I've run into this situation before and had to manually install all the package files into the %{buildroot}/... in the spec file. This appears to be one of those cases.

Here's an example from a spec file where I had to manually install every single file....
Code:
%install
rm -rf $RPM_BUILD_ROOT

install -d -m 775 $RPM_BUILD_ROOT%{_sysconfdir}/%{name}
install -d -m 775 $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/stat
install -d -m 755 $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/hooks
install -d -m 755 $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/admin-tools
install -m 774 etc/hooks/* $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/hooks
install -m 664 etc/acihelp etc/banner etc/channels* etc/gateway.conf etc/gwhelp etc/hosts \
$RPM_BUILD_ROOT%{_sysconfdir}/%{name}
install -m 664 admin/*.xml $RPM_BUILD_ROOT%{_sysconfdir}/%{name}
install -m 664 admin/.version_info $RPM_BUILD_ROOT%{_sysconfdir}/%{name}
install -m 755 admin/*.py $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/admin-tools
rm $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/admin-tools/updateversion.py

mkdir -p $RPM_BUILD_ROOT%{_bindir}
install -m 755 rmschanstat/rmschanstat rmsgw/rmsgw rmsgw_aci/rmsgw_aci rmsgwmon/rmsgwmon \
$RPM_BUILD_ROOT%{_bindir}

mkdir -p $RPM_BUILD_ROOT%{_mandir}/man1
mkdir -p $RPM_BUILD_ROOT%{_mandir}/man5
mkdir -p $RPM_BUILD_ROOT%{_mandir}/man8
install -m 644 man/*.1 $RPM_BUILD_ROOT%{_mandir}/man1
install -m 644 man/*.5 $RPM_BUILD_ROOT%{_mandir}/man5
install -m 644 man/*.8 $RPM_BUILD_ROOT%{_mandir}/man8
Note that if using "$RPM_BUILD_ROOT" that includes the trailing "/", but if using %{buildroot} instead, you need to add the trailing "/"

Last edited by PabloTwo; 3rd May 2017 at 08:19 PM.
Reply With Quote
  #14  
Old 3rd May 2017, 08:21 PM
ThanosApostolou Online
Registered User
 
Join Date: Nov 2016
Location: Athens, Greece
Posts: 17
linuxfedorafirefox
Re: Is there a guide to convert arch's PKGBUILD to RPM packages?

Yeah this software is pretty old (I hate it when my University uses so old software because some teachers are bored to change what they learned 10 years ago...) so the configure script is custom made (I believe autotools have become "popular" only lately).

Anyway I've successfully built tclcl too now and I will try to build ns2 and nam. I just build them the way they are on the AUR, so I put the libraries at /usr/lib and not /usr/lib64 because that seems hardwired too and tclcl couldn't find the otcl libraries otherwise.

If I am successful I will probably just create the RPMs and distribute them at my colleagues since I don't think anyone else will be interested it in this old software in order to create a copr repository. Thx for your help
Reply With Quote
  #15  
Old 3rd May 2017, 09:46 PM
PabloTwo Offline
"Registered User" T-Shirt Winner
 
Join Date: Mar 2007
Location: Seville, FL
Posts: 7,533
linuxchrome
Re: Is there a guide to convert arch's PKGBUILD to RPM packages?

Well, your spec file is getting the job done (building the otcl rpm package), which is more than I can say with my modified otcl.spec file. Getting a,
Code:
Makefile:102: recipe for target 'libotcl.so' failed
..though it compiled OK directly from the source code tarball.
Reply With Quote
Reply

Tags
arch, convert, guide, packages, pkgbuild, rpm

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] packages with multiple arch installed on my system... tracubo Installation, Upgrades and Live Media 2 2nd February 2015 02:34 PM
Arch BSD: Arch Linux Atop The FreeBSD Kernel Wayne Linux Chat 4 27th January 2013 05:16 AM
how to convert deb packages to rpm justwarm Using Fedora 5 28th June 2010 08:20 PM
dual boot F9/Arch - Arch fails FS check on F9 partition daneel971 Linux Chat 0 29th May 2008 02:51 PM
The easy guide to media installation - No Arch K1u Guides & Solutions (Not For Questions) 1 12th October 2007 04:20 AM


Current GMT-time: 00:31 (Saturday, 27-05-2017)

TopSubscribe to XML RSS for all Threads in all ForumsFedoraForumDotOrg Archive
logo

All trademarks, and forum posts in this site are property of their respective owner(s).
FedoraForum.org is privately owned and is not directly sponsored by the Fedora Project or Red Hat, Inc.

Privacy Policy | Term of Use | Posting Guidelines | Archive | Contact Us | Founding Members

Powered by vBulletin® Copyright ©2000 - 2012, vBulletin Solutions, Inc.

FedoraForum is Powered by RedHat