Software port suggestions

HPKG is not a proprietary format,it’s open-source and documented.
There’s a quick introduction to the format here: A Brief Look Inside HPKG | Haiku Project and you can read the full technical specification here: Making sure you're not a bot!
Besides that,you can look into the source code of Haiku to see how it all works.
Maybe you can even reuse some of Haikus code for the cross-platform CLI implementation you want.
I agree that it would be nice to be able to open HPKGs everywhere.
It’s totally possible to write such an utility,it just hasn’t been done yet.

4 Likes

I can’t see why not. I think this is a good idea and such a tool would be very useful. Interoperability with other systems is a good thing in my book, even if not everybody agrees :wink:

1 Like

I see package and libpackage_build.so under objects/haiku_host in my haiku build generated directory, which I think is for stuff needed in the host to build Haiku. That is, you may get it “just” by starting to build Haiku wherever you need the utility.

It may even preserve them either as extended attributes if supported by the file system or as files faking them, as is done for the build.

Just for fun, I swear!

I don’t speak C++, so I asked someone who does

After feeding Claude the two documents @nipos mentioned, I got some code back. It fails to compile on both Haiku and MacOS (error messages included in attachment). I could set up my raspberry pi to see what would happen on Linux, but I suspect the same thing would happen there: The error messages don’t look OS-specific to me.

unhpkg.zip

1 Like

Missing #include <fcntl.h> :slight_smile: (done on Haiku)

Doesn’t seem to work though :slight_smile:

/Opslag/wip/unhpkg> unhpkg assimp_devel-6.0.2-1-x86_64.hpkg 
Error: Not a valid HPKG file (magic mismatch)
Error: Cannot open file 'assimp_devel-6.0.2-1-x86_64.hpkg'
1 Like
$ git clone --depth=1 https://review.haiku-os.org/buildtools
...
$ cd buildtools/jam/
$ make
...
$ ./jam0 -sBINDIR="${HOME}/.local/bin" install
...
$ cd -
$ git clone --depth=1 https://review.haiku-os.org/haiku
...
$ cd haiku
$ ./configure --host-only
Configured successfully!
$ jam '<build>package'
...
$ mkdir /tmp/hpkg
$ curl -L 'https://sourceforge.net/projects/misc-haiku-utilities-and-ports/files/tidyspace/tidyspace-1.0-1-any.hpkg/download' -o /tmp/hpkg/tidyspace.hpkg
...
$ generated/objects/linux/x86_64/release/tools/package/package list /tmp/hpkg/tidyspace.hpkg 
package-attributes:
	name: tidyspace
	summary: Clean up text files
	description: Remove all leading, trailing and multiple spaces from a text file

Usage: tidyspace text_file.txt

Output is to stdout

	vendor: clasqm
	packager: Michel Clasquin-Johnson <clasqm@gmail.com>
	architecture: any
	version: 1.0-1
	copyright: Timothy Musson
	license: Public Domain
	URL: https://trmusson.dreamhosters.com/programs.html#misc
	provides: tidyspace = 1.0-1
	provides: cmd:tidyspace
	requires: cmd:sed
.PackageInfo                           524  2025-06-14 23:50:23  -rw-r--r--
bin                                      0  2025-06-14 23:43:48  drwxr-xr-x
  tidyspace                            181  2007-02-18 07:45:11  -rwxrwxrwx
$ ls -alR /tmp/hpkg
/tmp/hpkg:
total 4
drwxr-xr-x.  2 madmax madmax   60 jun 19 17:44 .
drwxrwxrwt. 23 root   root    540 jun 19 17:47 ..
-rw-r--r--.  1 madmax madmax 1910 jun 19 17:44 tidyspace.hpkg
$ generated/objects/linux/x86_64/release/tools/package/package extract -C /tmp/hpkg /tmp/hpkg/tidyspace.hpkg
$ ls -alR /tmp/hpkg
/tmp/hpkg:
total 8
drwxr-xr-x.  3 madmax madmax  100 jun 19 17:48 .
drwxrwxrwt. 23 root   root    540 jun 19 17:47 ..
drwxr-xr-x.  2 madmax madmax   60 jun 19 17:48 bin
-rw-r--r--.  1 madmax madmax  524 jun 14 23:50 .PackageInfo
-rw-r--r--.  1 madmax madmax 1910 jun 19 17:44 tidyspace.hpkg

/tmp/hpkg/bin:
total 4
drwxr-xr-x. 2 madmax madmax  60 jun 19 17:48 .
drwxr-xr-x. 3 madmax madmax 100 jun 19 17:48 ..
-rwxrwxrwx. 1 madmax madmax 181 feb 18  2007 tidyspace
$
1 Like

Feed Claude the error messages and tell it to fix the errors.

1 Like

Yes package extractwill do it, but this is only true if you’re already on Haiku.

What’s missing is a cross-platform tool to extract the content of an HPKG file from any platform, Windows, Linux, macOS etc.

That session was on Fedora, not Haiku. package is built on the host system for the host system, as it is needed as part of the build. So just get the sources, build jam, jam ‘<build>package’ and off you go.

1 Like

oh, didn’t catch up it was a cross-compile of the “package” tool on Fedora.

Yes, that’s one way.
Now the question is how to distribute such cross-compiled package tool for most used platforms? Asking to people to do it manually is not an option.

Of course. But I ran into a daily limit and I don’t love Claude enough to get a paid account.

For some reasons I am working on porting thorpy instead pyfltk for porting python GUI library(I may move back to pyfltk later). Thorpy is a GUI library totally based on pygame so porting should be easy. I installed thorpy with pip and the installation was success. However, when I compile some thorpy example codes, this error appears.

python3 thorpy_showcasetheres2.py 
pygame 2.0.0 (SDL 1.2.15, python 3.10.16)
Hello from the pygame community. https://www.pygame.org/contribute.html
Traceback (most recent call last):
  File "/boot/home/Desktop/thorpy_showcasetheres2.py", line 5, in <module>
    import thorpy as tp
  File "/packages/python3.10-3.10.16-1/.self/non-packaged/lib/python3.10/site-packages/thorpy/__init__.py", line 4, in <module>
    from . import elements
  File "/packages/python3.10-3.10.16-1/.self/non-packaged/lib/python3.10/site-packages/thorpy/elements.py", line 20, in <module>
    from . import styles, loops
  File "/packages/python3.10-3.10.16-1/.self/non-packaged/lib/python3.10/site-packages/thorpy/styles.py", line 8, in <module>
    from . import parameters as p
  File "/packages/python3.10-3.10.16-1/.self/non-packaged/lib/python3.10/site-packages/thorpy/parameters.py", line 19, in <module>
    cursor:Optional[pygame.Cursor] = None
AttributeError: module 'pygame' has no attribute 'Cursor'. Did you mean: 'cursors'?

How can I solve this problem?

Looks like thorpy depends on pygames having a Cursor object, which is not existing in the pygames 2.0.0, probably not under this name or class hierarchy, at least.

Maybe thorpy depends on an older, 1.x.x, version of pygames module.
Try, via ‘pip install pygames<2.0.0’, to downgrade and see if it make thorpy more happy.

My guess is that thorpy is not yet compatible with pygames 2.x API

The pygame is from Haikudepot, with 2.0.0 only. I’ll try to install older versions of pygame with pip, but it may mote likely fail.

I tried “pip install pygames<2.0.0”
and this error is shown:

Collecting pygame<2.0.0
  Downloading pygame-1.9.6.tar.gz (3.2 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 3.2/3.2 MB 92.3 kB/s eta 0:00:00
  Installing build dependencies ... done
  Getting requirements to build wheel ... error
  error: subprocess-exited-with-error
  
  × Getting requirements to build wheel did not run successfully.
  │ exit code: 1
  ╰─> [29 lines of output]
      
      
      WARNING, No "Setup" File Exists, Running "buildconfig/config.py"
      Using UNIX configuration...
      
      /bin/sh: line 1: sdl-config: command not found
      /bin/sh: line 1: sdl-config: command not found
      /bin/sh: line 1: sdl-config: command not found
      Package freetype2 was not found in the pkg-config search path.
      Perhaps you should add the directory containing `freetype2.pc'
      to the PKG_CONFIG_PATH environment variable
      No package 'freetype2' found
      Package freetype2 was not found in the pkg-config search path.
      Perhaps you should add the directory containing `freetype2.pc'
      to the PKG_CONFIG_PATH environment variable
      No package 'freetype2' found
      Package freetype2 was not found in the pkg-config search path.
      Perhaps you should add the directory containing `freetype2.pc'
      to the PKG_CONFIG_PATH environment variable
      No package 'freetype2' found
      /bin/sh: line 1: freetype-config: command not found
      /bin/sh: line 1: freetype-config: command not found
      /bin/sh: line 1: freetype-config: command not found
      
      Hunting dependencies...
      WARNING: "sdl-config" failed!
      WARNING: "pkg-config freetype2" failed!
      WARNING: "freetype-config" failed!
      Unable to run "sdl-config". Please make sure a development version of SDL is installed.
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error

× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> See above for output.

note: This error originates from a subprocess, and is likely not a problem with pip.

Maybe I should try thorpy 1.

I installed thorpy 1.8.1 with pygame 2.0.0 installed and succefully compiled some examples provided from thorpy website.


https://www.thorpy.org/old_website/examples/overview.html


https://www.thorpy.org/old_website/examples/submenus.html

This warning will show everytime compiling:

[midi] WARNING: Endpoint 7 (0x1139f8dbf4e0) has not been Release()d properly (refcount = 1)
[midi] WARNING: Endpoint 8 (0x1139f8de28c0) has not been Release()d properly (refcount = 1)

But when I try compiling game NinArow( ThorPy ), error appears:

pygame 2.0.0 (SDL 1.2.15, python 3.10.16)
Hello from the pygame community. https://www.pygame.org/contribute.html
Traceback (most recent call last):
  File "/boot/home/Desktop/NinArow/play.py", line 83, in <module>
    e_thorpy_options = thorpy.make_global_display_options(METADATA_PATH,
  File "/packages/python3.10-3.10.16-1/.self/non-packaged/lib/python3.10/site-packages/thorpy/elements/_wrappers.py", line 337, in make_global_display_options
    disp_options = make_display_options_setter(fn, "Display options")
  File "/packages/python3.10-3.10.16-1/.self/non-packaged/lib/python3.10/site-packages/thorpy/elements/_wrappers.py", line 284, in make_display_options_setter
    if limvalsw[1] is None: limvalsw = (limvalsw[0], maxsize[0])
TypeError: 'NoneType' object is not subscriptable
[midi] WARNING: Endpoint 7 (0x1139f8dbf4e0) has not been Release()d properly (refcount = 1)
[midi] WARNING: Endpoint 8 (0x1139f8de28c0) has not been Release()d properly (refcount = 1)

2 Likes

Thorpy and Pygame worked quite well for the game ThePhantomRacer.

We may even fork Thorpy 1.8 to add Be-styled themes to this library.

Instead of forking, first try to contact thorpy developer(s) to see if he’s/they’re opened to merge request to add some haiku plateform theme changes.

From the screenshot of existing themes, “simple” looks like a good basis to tune to make it look even like native Haiku look.

https://thorpy.org/doc/themes.html

Maybe it’s supported only by thorpy 2.x, though.
Asking first cost nothing, I guess.

EDIT: anyway, to propose a MR, forking is needed somehow, please ignore whatever I just said :wink:

Hi did anyone tried to port eclipse-ide already or again? My first attempt did not work out unfortunatly.

I’m looking for an app like this (prefer native / already ported (or maybe someone is interested in porting this if it’s even possible - I see it’s Qt/Qml based which gives me some hope):

1 Like