You are not logged in.

#1 2012-06-04 00:43:12

Amzo2
Member
Registered: 2012-06-02
Posts: 50

Arch-BSD

Well, I stumbled across this old thread, which I actually enjoyed reading, and thought I would give it a try my self as a personal project.

The thread can be found here: https://bbs.archlinux.org/viewtopic.php?id=11550

Most of the points mentioned in that thread, I have over came with relatively easy solutions. Such as the PKGBUILD problem, you'd encounter on FreeBSD.

Why would I do this?

If like me, you enjoy FreeBSD and love it, but also like the philosophy behind Arch Linux, which is a fast, lightweight, optimized distro, I figured why not combine the both. Even tho you could just do it on FreeBSD using the ports, not everyone wants to compile.

FreeBSD

 .--.                  Pacman v4.0.3 - libalpm v7.0.3
/ _.-' .-.  .-.  .-.   Copyright (C) 2006-2012 Pacman Development Team
\  '-. '-'  '-'  '-'   Copyright (C) 2002-2006 Judd Vinet
 '--'
                       This program may be freely redistributed under
                       the terms of the GNU General Public License.

So, anyways, to overcome the PKGBUILD problem, I wrote my own makepkg, to make the packages using FreeBSDs make file. It does this in a simple way.

sets the pkgname to the PORTNAME=
sets the pkgver to PORTVERSION=
sets the pkgrel to PORTREVISION

Then it calls make to compile and install the port into the $workdir/pkg, then creates the .PKGINFO files and packages up. It's not as advance as the makepkg for Arch Linux, but it creates working packages. I have tests this by makign a package of the FreeBSD kernel.

This works without a hitch, I've compiled a few test kernels, packaged them up and instaleld them using pacman, and the system booted fine. I have made a final test package with a generic kernel.

Password:
loading packages...
warning: freebsd-kernel-9-0 is up to date -- reinstalling
resolving dependencies...
looking for inter-conflicts...

Targets (1): freebsd-kernel-9-0


Proceed with installation? [Y/n] y
(1/1) checking package integrity                                                                                               [#############################################################################] 100%
(1/1) loading package files                                                                                                    [#############################################################################] 100%
(1/1) checking for file conflicts                                                                                              [#############################################################################] 100%
(1/1) checking available disk space                                                                                            [#############################################################################] 100%
(1/1) upgrading freebsd-kernel                                                                                                 [#############################################################################] 100%

Listing installed packages:

[amzo@Bahamut /usr/src]$ pacman -Q
freebsd-kernel 9-0
irssi 0.8.15-3

Now, I just have one problem I'd like someone to help with, or maybe a developer could help with, and that is generating an efficient PKGINFO:

Now I'm guessing that all these are normally made in the pkginfo file. but my output of pacman -Qi shows:

Name           : freebsd-kernel
Version        : 9-0
URL            : None
Licenses       : None
Groups         : None
Provides       : None
Depends On     : None
Optional Deps  : None
Required By    : None
Conflicts With : None
Replaces       : None
Installed Size :   0.00 KiB
Packager       : None
Architecture   : None
Build Date     : None
Install Date   : Mon Jun 4 01:37:59 2012
Install Reason : Explicitly installed
Install Script : No
Description    : None

So there you go, for the thread someone made about 7 years ago, I've made quite a bit of progress on it in just under a day. tongue

Offline

#2 2012-06-04 00:58:48

Jristz
Member
From: America/Santiago
Registered: 2011-06-11
Posts: 1,022

Re: Arch-BSD

Giveme a install-edia that work w my sistem and I migrated to arch-bsd

maybe in the PKGBUILD you need specify all tose parts
second I read that FBSD use pdksh/ksh/mirksh instead of bash, this can have influence


Well, I suppose that this is somekind of signature, no?

Offline

#3 2012-06-04 01:05:02

Amzo2
Member
Registered: 2012-06-02
Posts: 50

Re: Arch-BSD

The makepkg I wrote uses the FreeBSD shell in /bin/sh and i've also made a package of bash from the ports. I haven't made a working install media, I still have a lot to fix with my makepkg, to generate all the info for the pkginfo. Also, it doesn't use pkgbuilds. You just change in to the port direct and run makepkg which I have in /usr/local/bin/

Example:

cd /usr/ports/x11-wm/dwm ; makepkg

[amzo@Bahamut /usr/ports/x11-wm/dwm]$ sudo makepkg
==> Building Package...
===>  Installing for dwm-6.0_1
===>   dwm-6.0_1 depends on file: /usr/local/libdata/pkgconfig/x11.pc - found
===>   Generating temporary packing list
===>  Checking if x11-wm/dwm already installed
==> Generating .PKGINFO file...
==> Stripping debugging symbols from libraries...
==> Stripping symbols from binaries...
==> Compressing package...
==> Cleaning up
==> Finished
[amzo@Bahamut /usr/ports/x11-wm/dwm]$ sudo pacman -U dwm-6.0-1.pkg.tar.gz 
loading packages...
resolving dependencies...
looking for inter-conflicts...

Targets (1): dwm-6.0-1


Proceed with installation? [Y/n]  

I just need to make my makepkg more efficient and generate mroe info for PKGINFO from the FreeBSD makefiles.

Last edited by Amzo2 (2012-06-04 01:05:31)

Offline

#4 2012-06-04 23:20:42

Amzo2
Member
Registered: 2012-06-02
Posts: 50

Re: Arch-BSD

Well, I've been making some progress on making a base:

[amzo@Bahamut /usr/jails]$ sudo pacman -R freebsd-kernel
checking dependencies...
error: failed to prepare transaction (could not satisfy dependencies)
:: sh: requires freebsd-kernel

So far my makepkg takes three arguments

-k to make a package of the FreeBSD kernel

-c to make a coreutils package of FreeBSD

-p to make a package of a port.

Since it reads makefiles from the ports, and it's different to generate a package for each one, it seemed easier to use functions for each one and call it via a arguement.

I guess no one really cares tho. o_O

Last edited by Amzo2 (2012-06-05 00:24:08)

Offline

#5 2012-06-07 08:46:42

Barthalion
Forum Fellow
From: Poland
Registered: 2010-02-26
Posts: 111

Re: Arch-BSD

Somebody will care, if you start sharing the code on GitHub.

Offline

#6 2012-06-07 14:15:49

ANOKNUSA
Member
Registered: 2010-10-22
Posts: 2,141

Re: Arch-BSD

It's not that no one cares; it's that this is the Arch forum.  While there are no doubt some FreeBSD users here, most of us are not.  Sooner or later people are bound to pick up on this and get interested (maybe not a lot of people, but some), but since you're doing this for a different operating system, it's not relevant to most of us here.  Share your code on Git or SVN or whatever, make some blog posts, bring it up on *BSD forums...

Offline

#7 2012-06-07 15:14:45

Amzo2
Member
Registered: 2012-06-02
Posts: 50

Re: Arch-BSD

Oh, I'm going to share the code, just I don't think it's ready yet, still a lot of bugs, and making the most minimal i686 FreeBSD core is proving hard. Having already made packages for the Kernel, coreutils, etc, it's getting there.

I just thought it would be better to psot it here, since there was some discussion about it in a previous thread, and some people seemed interested.

Offline

#8 2012-06-18 02:06:40

Amzo2
Member
Registered: 2012-06-02
Posts: 50

Re: Arch-BSD

Well, For those whoa re interested, Here is the link to the git. The code is no where near finished for makepkg, while it's working partially, I still have a lot to do. It's completely made from scratch and is no way based on the makepkg used in Arch Linux.

How ever, I am using the inittools from Arch Linux as well as the AIF, but I'll move to those when I finish makepkg.


ArchBSD GIT

I don't think it was against the policy to use the logo, um, I think I'm meant to keep the TM next to the logo. Maybe someone could clarify.

2OfiT.png

Last edited by Amzo2 (2012-06-18 03:28:12)

Offline

#9 2012-06-18 04:39:24

mynis01
Member
Registered: 2011-04-29
Posts: 71

Re: Arch-BSD

Forgive me for not reading through the code to figure this out on my own, but would Arch-BSD use clang/llvm over gcc?

Offline

#10 2012-06-18 06:10:00

Zancarius
Member
From: NM, USA
Registered: 2012-05-06
Posts: 207

Re: Arch-BSD

mynis01 wrote:

Forgive me for not reading through the code to figure this out on my own, but would Arch-BSD use clang/llvm over gcc?

FreeBSD 9 hasn't yet. Although it looks like 10 might.


He who has no .plan has small finger.
~Confucius on UNIX.

Offline

#11 2012-06-18 09:10:19

Amzo2
Member
Registered: 2012-06-02
Posts: 50

Re: Arch-BSD

I don't have an issue with clang much, and I've already built my FreeBSD base with clang, even tho it hasn't nearly been around as long as GCC, it's still fairly good and most code compiles. Code that doesn't compile in clang, and does compile in GCC, is mostly down to GCC which should reject certain code, but doesn't.

int myFunction() {
	return;
}

That is rejected by clang, but not GCC.

"non-void function should return a value" build failure(s)

clang doesn't actually lose any performance over GCC when both compiled without optimisation, and clang was actually faster in some cases, while gcc probably would be superior in optimisation, but that can lead to a lot of problems optimising everything.

Last edited by Amzo2 (2012-06-18 09:11:50)

Offline

#12 2012-06-18 09:34:12

Allan
Pacman
From: Brisbane, AU
Registered: 2007-06-09
Posts: 11,472
Website

Re: Arch-BSD

gcc -Wall...

test.c:2:2: warning: ‘return’ with no value, in function returning non-void [-Wreturn-type]

A summary from almost all decent benchmarking on gcc vs clang shows that clang tends to compile faster but gcc creates more optimized binaries.  Although... if you use gcc -O1 (which is basically equivalent of clang -O2 in terms of optimization), then the compile time difference becomes much less - almost negligible.   That is not too surprising - clang/llvm have all the basic optimization passes applied, and more complex optimization requires much more compile time for relatively little gain.

Offline

#13 2012-06-18 09:49:52

Amzo2
Member
Registered: 2012-06-02
Posts: 50

Re: Arch-BSD

Yeah, I am looking forward to clang, it's fairly new, but has come along way in the past few years, I find having too much optimization can always cause little, to no gain, regardless of the compiler. Sometimes it can even case a slow down. Tho, considering the GCC that is shipped with FreeBSD is fairly outdated due to the them not liking GPLv3, clang has done a good job replacing it, and now entire world builds with clang. 10 aims to replace clang completely, but they have problems with some ports. Also, I'm sure GCC default standard is C89, while Clangs is C99.

gcc version 4.2.1 20070831 patched [FreeBSD]

but the port version is fairly up to date:

gcc-4.6.4.20120608  GNU Compiler Collection 4.6

gcc 4.6.4 is currently what I'm using to build packages.

Last edited by Amzo2 (2012-06-18 09:53:48)

Offline

#14 2012-06-19 03:07:32

Amzo2
Member
Registered: 2012-06-02
Posts: 50

Re: Arch-BSD

Well, I made a test repo today, took awhile to create the core.db manually to see how it works, but I have the hang of it now. Going to create the script that will create it automatically. There was a few problems with my packages tho, but it's mostly due to the naming I have used in my script which I can easily fix.

[amzo@Bahamut ~/ArchBSD/ArchBSD/makepkg]$ sudo pacman -Sy
Password:
:: Synchronizing package databases...
 core                                                                                     604.0   B  5.05M/s 00:00 [####################################################################] 100%

And fetching, and installation works well.

[amzo@Bahamut ~/ArchBSD/ArchBSD/makepkg]$ sudo pacman -S weechat
resolving dependencies...
looking for inter-conflicts...

Targets (2): libiconv-1.14-0  weechat-0.3.8-0

Total Download Size:    2.25 MiB
Total Installed Size:   2.54 MiB

Proceed with installation? [Y/n] y
:: Retrieving packages from core...
 libiconv-1.14-0                                                                         1117.5 KiB   558K/s 00:02 [####################################################################] 100%
 weechat-0.3.8-0                                                                         1117.6 KiB   451K/s 00:02 [####################################################################] 100%
(2/2) checking package integrity                                                                                   [####################################################################] 100%
(2/2) loading package files                                                                                        [####################################################################] 100%
(2/2) checking available disk space                                                                                [####################################################################] 100%
(1/2) installing libiconv                                                                                          [####################################################################] 100%
(2/2) installing weechat                                                                                           [####################################################################] 100%

The only problem at the is it causes database problems.

[amzo@Bahamut ~/ArchBSD/ArchBSD/makepkg]$ pacman -Qs weechat
error: invalid name for database entry 'libiconv-1.14'
error: invalid name for database entry 'weechat-0.3.8'

I'm pretty sure this is due to it never appended the PORTREVISION number to the end of the name, but this will easily be fixed.

Offline

#15 2012-06-20 10:35:15

dimigon
Member
Registered: 2009-03-07
Posts: 139
Website

Re: Arch-BSD

Awesome!  I am gonna have a play with this at some point soon smile

Offline

#16 2012-06-20 15:48:09

Amzo2
Member
Registered: 2012-06-02
Posts: 50

Re: Arch-BSD

I'm still fixing some problems making packages from the FreeBSD ports. Some problems are the naming string in the MakeFiles. They vary from PORTVERSION, PORTREVISION, PORTEPOCH etc. I've pretty much sorted this porblem out, and sometimes freebsd will names files with different symbols - , _ So I've set-up some checking for these files. Which is working pretty great.

Bison is just an example as it uses , in it's naming.

+ '[' -f /usr/ports/packages/All/bison-2.5.tbz ']'
+ '[' -f /usr/ports/packages/All/bison-2.5,1.tbz ']'
+ packagedname=/usr/ports/packages/All/bison-2.5,1.tbz
   if [ -f "$packagedir"/All/"$pkgname"-"$pkgver".tbz ]
   then 
      packagedname="$packagedir"/All/"$pkgname"-"$pkgver".tbz
   elif [ -f "$packagedir"/All/"$pkgname"-"$pkgver","$pkgrel".tbz ]
      then
      packagedname="$packagedir"/All/"$pkgname"-"$pkgver","$pkgrel".tbz
   else
      packagedname="$packagedir"/All/"$pkgname"-"$pkgver"_"$pkgrel".tbz
   fi

Now that it's able to detect all packages correctly regardless of what time of characters it includes. IT's successfully making working packages. Just a few more things I need to fix, such as some problems I have with making the .PKGINFO.

Last edited by Amzo2 (2012-06-20 15:49:40)

Offline

#17 2012-06-20 22:46:59

Amzo2
Member
Registered: 2012-06-02
Posts: 50

Re: Arch-BSD

I've just rewrote parts of my makepkg. Now making packages is twice as fast. What would take 6 hours for some packages, now only takes 3 hours. SPEED BABY!

I added a new function that would save created packages to a database and skip it if it's already been built, this was because the makepkg would rebuild the same packages for multiple ports, and waste more time. So using this has sped up the process even further.

I know speed is everything, first I got down looping through depends from 40 seconds down to 2 seconds, build a port is twice as fast, what would take 3 hours would take 1 and a half. And now it won't build packages that've already been built saving even moar time.

[amzo@Bahamut ~/ArchBSD/ArchBSD/makepkg]$ sudo sh makepkg -p irc/weechat
Creating Package irc/weechat
/usr/ports/irc/weechat
Packages /usr/ports/irc/weechat Already created
[amzo@Bahamut ~/ArchBSD/ArchBSD/makepkg]$ 

Offline

#18 2012-06-24 14:34:28

exapplegeek
Member
From: Macedonia
Registered: 2012-06-24
Posts: 36

Re: Arch-BSD

I am looking forward testing this soon.
Keep up the good work! (I really need to learn to code, then I would be able to help you big_smile)

Blessings!


Soli Deo Gloria!
I Stand Up For Christ! Do you?
________________________
Always have your stuff when you need it with Dropbox. Sign up for free (under my referral link)! http://db.tt/3rOCPK4r

Offline

#19 2012-06-25 16:51:56

Amzo2
Member
Registered: 2012-06-02
Posts: 50

Re: Arch-BSD

I'm not the best of coders my self, but learning new things as I go along.

I made a bootable iso, that used a ramfs of FreeBSD and used grub, which is completely different to the traditional way. It made the boot time a lot faster.

I have started to write some patches for the FreeBSD rc to enable a style config like Arch Linux, and colorized output. There is still some functions I also need to add into makepkg.

Also some friends been working on some artwork for the gnome bootsplash, to make it resemble the arch linux scheme, just with red instead of blue:


splash.png

K2uww.png

Last edited by Amzo2 (2012-06-25 19:38:27)

Offline

#20 2012-06-25 19:07:35

Anonymo
Member
Registered: 2005-04-07
Posts: 427
Website

Re: Arch-BSD

Wow!  This is becoming reality

Offline

#21 2012-06-25 21:39:41

Amzo2
Member
Registered: 2012-06-02
Posts: 50

Re: Arch-BSD

Yeah, I'm almost finished with the makepkg, I have made a bootable iso, but none of the tools have been added onto it. I need to make the recursive package building from the FreeBSD port tree work a bit better. So far it will only recurse one level.

Cd to the ports > Generate dependency list > Create packages of the Dependencies > then create package of the port. > Save the created package names to a database, to prevent rebuilding.

I want it to go

Cd to the port we're making. Check depends list, then recursive through their depends to make the packages.

Tho, I have just wrote the function to create the directory layout and files for the core.db.

Offline

#22 2012-06-26 00:19:37

Beastie
Member
Registered: 2012-01-14
Posts: 39

Re: Arch-BSD

Hey, Amzo on the arch forums !

Offline

#23 2012-06-26 00:43:32

Amzo2
Member
Registered: 2012-06-02
Posts: 50

Re: Arch-BSD

I didn't realize you where a member on here as well Beastie. You should boot up your BSD box and help me spread the building of some test packages.

Offline

#24 2012-06-26 01:35:44

shixhaxermod98
Member
Registered: 2011-09-03
Posts: 5

Re: Arch-BSD

If this becomes a reality, I'm going to miss the options I get to choose from when I install something from ports.

Offline

#25 2012-06-26 19:14:12

Beastie
Member
Registered: 2012-01-14
Posts: 39

Re: Arch-BSD

@shix, it's already the case with pkg_add. You get all the options.

Offline

Board footer

Powered by FluxBB