FreeBSD Ports -> IRIX
#1
FreeBSD Ports -> IRIX
Hi SGI/IRIX'er,

in a act of naivety, I have started to see if I can get FreeBSD Ports working with IRIX to allow building of Open Source software in a repeatable and manageable way.

I have done fork of FreeBSD Ports tree and had a first stab at seeing what would be required to get this to work with IRIX.

As the Port tools are essentially a combination of Makefiles and Shell Scripts this seems to be something that is possible (if you are reasonably proficient with these tools, which most UNIX developers are).

As first step, I have got bmake update to work with IRIX and created a small number of IRIX wrappers for things where there is divergence between IRIX and BSD:
- FreeBSD fetch -> SGI Freeware wget & curl
- FreeBSD env -> mimic FreeBSD env
- FreeBSD pkg -> wrap IRIX inst

Raion, has also done some work previously on this approach, so we have been exchanging notes.

I have setup up gitlab repository here: https://gitlab.com/zebity/freebsd-ports
And github for getting current FreeBSD Ports tree here: https://github.com/zebity/freebsd-ports

The IRIX'ised code is in IRIX-6.5 branch.

This is not yet working and I am now starting to raise issues in gitlab as I find / fix issues.

Possibly another doomed exercise in IRIX software porting ...

But I would like to see if can get some mechanism going that:
- Builds software from current upstream source tree
- Avoids private enclaves, if the software cannot be built on upstream source tree, then manage updates via open git respository and request fixes to be pushed back into upsteam respository.
- Uses standard SGI IRIX build tools (compiler, linker etc as the SGI MIPSpro toolset provide the best MIPS code generation for IRIX ...)
- Doesn't try to make IRIX behave like a Linux distribution (i.e. Debian app, Redhat yum/rpm)

Personally I want to only build 64 Bit SW for MIPS4 architecture, but this is just a "configure" choice that can be managed by user.

Any help from make/shell guru's appreciated.

Just fork, bootstrap basic tools and submit fixes ;-)

The focus here is not to try to get every FreeBSD port working on IRIX, it is just to get the Ports tool chain working.

Cheers from Oz,


jwhat/John
(This post was last modified: 07-28-2023, 09:17 PM by jwhat.)
jwhat
Octane/O350/Fuel User

Trade Count: (0)
Posts: 513
Threads: 29
Joined: Jul 2018
Location: Australia
Find Reply
07-28-2023, 07:15 AM
#2
RE: FreeBSD Ports -> IRIX
(07-28-2023, 07:15 AM)jwhat Wrote:  in a act of naivety, I have started to see I can get FreeBSD Ports working with IRIX to allow building of Open Source software in a repeatable and manageable way.

I have done fork of FreeBSD Ports tree and had a first stab at see what would be required to get this to work with IRIX.
[...]
Interesting project!

Just out of curiosity: Why exactly Free BSD Ports and not NetBSD ports or OpenBSD ports for this?

Indigo Indy Indigo2 R10000/IMPACT O2 Octane Octane2 Origin 200=Origin 200-Origin 200=Origin 200
johnnym
Tezro

Trade Count: (0)
Posts: 268
Threads: 9
Joined: Jun 2018
Find Reply
07-28-2023, 02:48 PM
#3
RE: FreeBSD Ports -> IRIX
Hi Johnnym,

good question, it was just because I am long time FreeBSD user.

I first used FreeBSD 2.0.5 back in 1995 via Walnut Creek CDROM.

But your question is a good one, as OpenBSD has SGI MIPS support still doesn't it ?

If I get this going, then I imagine it would be pretty easy to put onto other BSDs with MIPS support.

I have now got the http fetching working (with a little bug that I will fix tomorrow), so can move to the patch/build process.

So far changes have been pretty small and bigger deltas are handled via the wrappers.

Cheers from Oz,

jwhat/John
(This post was last modified: 07-28-2023, 09:02 PM by jwhat.)
jwhat
Octane/O350/Fuel User

Trade Count: (0)
Posts: 513
Threads: 29
Joined: Jul 2018
Location: Australia
Find Reply
07-28-2023, 04:01 PM
#4
RE: FreeBSD Ports -> IRIX
(07-28-2023, 04:01 PM)jwhat Wrote:  good question, it was just because I am long time FreeBSD user.

I first used FreeBSD 2.0.5 back in 1995 via Walnut Creek CDROM.
I see, that explains it. I don't remember when I first used any of the BSDs. I believe, I first used GNU/Linux in the form of Slackware or maybe even Knoppix before that sometime around the 2000s or so. My first sort of OS would be CP/M on my dad's Amstrad PCW 256 (aka Schneider Joyce in Germany).

(07-28-2023, 04:01 PM)jwhat Wrote:  But your question is a good one, as OpenBSD has SGI MIPS support still doesn't it ?
Indeed, they have both little (loongson) and big endian (octeon) MIPS platforms, from which I use octeon userlands for SGI machines and OpenBSD versions where I haven't yet produced sgi userlands (I'm still missing the 7.3 OpenBSD/sgi userland). Thankfully they still use MIPS-III for binaries (also in ports):

Code:
root@nfs:/srv/nfs/openbsd/7.3/octeon/hosts/indigo2/root/bin# file cat
cat: ELF 64-bit MSB shared object, MIPS, MIPS-III version 1 (SYSV), dynamically linked, for OpenBSD, stripped

...hence everything runs unmodified on SGI hardware originally supported by OpenBSD, though I have to copy over LLVM/clang libs to allow them to work, see the part below "2023-02-06" on for example https://github.com/the-machine-hall/open...bsd.70.sgi for details.

(07-28-2023, 04:01 PM)jwhat Wrote:  If I get this going, then I imagine it would be pretty easy to put onto other BSDs with MIPS support.

I have now got the http fetching working (with a little bug that I will fix tomorrow), so can move to the patch/build process.

So far changes have been pretty small and bigger deltas are handle via the wrappers.
Keep going! Smile

Indigo Indy Indigo2 R10000/IMPACT O2 Octane Octane2 Origin 200=Origin 200-Origin 200=Origin 200
johnnym
Tezro

Trade Count: (0)
Posts: 268
Threads: 9
Joined: Jun 2018
Find Reply
07-28-2023, 05:09 PM
#5
RE: FreeBSD Ports -> IRIX
HI SGI/IRIX'ers,

currently having issue with "extract" target, which is adding a back-quote "`" in the extract target command:

Code:
for file in dialog4ports-0.1.6.tar.gz; do  if ! (cd /usr/ports/ports-mgmt/dialog4ports/work && `        /usr/freeware/bin/tar -xf /usr/ports/distfiles//$file --no-same-owner --no-same-permissions); then  echo "===>  Failed to extract \"/usr/ports/distfiles//$file\".";  exit 1;  fi;  done
Execute: 'for file in dialog4ports-0.1.6.tar.gz; do  if ! (cd /usr/ports/ports-mgmt/dialog4ports/work && `      /usr/freeware/bin/tar -xf /usr/ports/distfiles//$file --no-same-owner --no-same-permissions); then  echo "===>  Failed to extract \"/usr/ports/distfiles//$file\".";  exit 1;  fi;  done'


Any shell/bmake experts please muck in to see if you can see where problem is.

I have raised the following GitLab issue: https://gitlab.com/zebity/freebsd-ports/-/issues/3

Thanks for everyone who would like to help.

Cheers from Oz,


jwhat/John
(This post was last modified: 07-31-2023, 01:56 PM by jwhat.)
jwhat
Octane/O350/Fuel User

Trade Count: (0)
Posts: 513
Threads: 29
Joined: Jul 2018
Location: Australia
Find Reply
07-31-2023, 01:57 AM
#6
RE: FreeBSD Ports -> IRIX
What shell are you having it use? IRIX ksh is ancient ksh88 that is not compatible. You need mksh to be on the system. Base IRIX stuff is inadequate, as I've tried to kindly stress a few ways. You at minimum need to upgrade awk, sed, perl, ksh, and a few other tools to properly use ports.

Edit: to clarify, I'm not certain this is the cause, but basically I found that IRIX's stock tools were causing string handling bugs. You aren't going to be able to do this on a stock IRIX without a massive amount of hacks and wrappers to the env, so I think it's best to rule out your ksh, and string processing tools.

I'm the system admin of this site. Private security technician, licensed locksmith, hack of a c developer and vintage computer enthusiast. 

https://contrib.irixnet.org/raion/ -- contributions and pieces that I'm working on currently. 

https://codeberg.org/SolusRaion -- Code repos I control

Technical problems should be sent my way.
(This post was last modified: 07-31-2023, 03:23 AM by Raion.)
Raion
Chief IRIX Officer

Trade Count: (9)
Posts: 4,256
Threads: 535
Joined: Nov 2017
Location: Eastern Virginia
Website Find Reply
07-31-2023, 02:38 AM
#7
RE: FreeBSD Ports -> IRIX
HI Raion,

I am using IRIX default sh == Korn Shell.

Yes appreciate your guidance and know that there are issues with Port Shell/Make scripting that need fixing.
In particular Ports uses:
- $( ) instead of classic shell “back quoting" "`"
- Uses $(( )) arithmetic rather than Korn let "blah"
- It seems to be relying on bmake collapsing $$ to single $ and allowing nested parameter expansion
- Initially can only download via http/ftp (not https)
- Initially need to disable CHECKSUM validation as this requires OpenSSL (or other digest generation alternate)

I have allowed for some of this in my updates to the .mk & .sh sources.
Before I move to having to bootstrap a bunch of other stuff like alternate ksh, sed, awk, perl etc, I want to see if can get basic process going.

I might have a look at much early and likely much downsized Port code to see if that is better candidate, as I decided to look at Ports originally to avoid having to manually download and bootstrap a whole lot of other SW.

On the "string bugs" front this might be the case if there are command line buffer overruns.

Need to get definitive diagnosis ...

Cheers from Oz,

jwhat/John
(This post was last modified: 08-01-2023, 02:51 AM by jwhat.)
jwhat
Octane/O350/Fuel User

Trade Count: (0)
Posts: 513
Threads: 29
Joined: Jul 2018
Location: Australia
Find Reply
07-31-2023, 10:24 AM
#8
RE: FreeBSD Ports -> IRIX
Just build mksh from here: http://www.mirbsd.org/mksh.htm Then:

mv /sbin/sh /sbin/sh.old

cp mksh /sbin/sh

temporarily. See if it changes the problem.

I'm the system admin of this site. Private security technician, licensed locksmith, hack of a c developer and vintage computer enthusiast. 

https://contrib.irixnet.org/raion/ -- contributions and pieces that I'm working on currently. 

https://codeberg.org/SolusRaion -- Code repos I control

Technical problems should be sent my way.
Raion
Chief IRIX Officer

Trade Count: (9)
Posts: 4,256
Threads: 535
Joined: Nov 2017
Location: Eastern Virginia
Website Find Reply
07-31-2023, 11:29 AM
#9
RE: FreeBSD Ports -> IRIX
Hi Raion,

thanks very much for going to trouble.

I had looked up pdksh, as Simon (who helped with getting bmake going) is ex-maintainer of pdksh, so good to see that MirBSD Korn Shell has picked up where pdksh dropped off.

I have solved the "back-quote" tar problem.

Once I run a little Make test to understand the behaviour of bmake/shell interaction & put in some debug diagnostics, it became apparent that in changing from default "tar" to "/usr/freeware/bin/tar" my clumsy finger typing (was very late at night is my excuse) had put a back-quote in the parameter definition (oooopppps!!!).

So I have raised next issue via gitlab which is that Ports does not seem to be automatically choosing the extract method (tar/unzip/xz ... etc) based on the file suffix.

This could be easy to fix by simply over riding the extract method, but this seems pretty primitive.

Anyhow I am now starting to get quite a good feel for how the Ports stuff works...

Cheers from Oz,


jwhat/John.
(This post was last modified: 08-01-2023, 02:53 AM by jwhat.)
jwhat
Octane/O350/Fuel User

Trade Count: (0)
Posts: 513
Threads: 29
Joined: Jul 2018
Location: Australia
Find Reply
07-31-2023, 12:32 PM
#10
RE: FreeBSD Ports -> IRIX
Hi Raion & others,

I now have it successfully completing: fetch -> extract -> bulid

It blows up in the, diaglog4port compile, due to IRIX / FreeBSD C header/lib differences.

I am pretty confident that this can work, bmake is working without issues and default shell has not been cause of any mysterious bugs (just need to update scripts slightly).

Its really just a matter of going through each target and its sub-targets and addressing the IRIX variation impact (these are now mostly return code handling related).

Raion - if you have an already compiling version of dialog4ports then I could use this to generate a patch file.

This would then mean that the entire process to get first bootstrap stage done, would be going!!

I will likely need to put this aside for rest of week and do work stuff ;-)

Open issues are there for people to tackle ;-)

EDIT: POP cork and small celebration!!!

Cheers from Oz,

jwhat/John
(This post was last modified: 08-02-2023, 09:54 AM by jwhat.)
jwhat
Octane/O350/Fuel User

Trade Count: (0)
Posts: 513
Threads: 29
Joined: Jul 2018
Location: Australia
Find Reply
08-02-2023, 05:21 AM


Forum Jump:


Users browsing this thread: 1 Guest(s)