Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Package Request: Oilshell #12835

Closed
Wychmire opened this issue Jul 6, 2019 · 6 comments · Fixed by #12891
Closed

Package Request: Oilshell #12835

Wychmire opened this issue Jul 6, 2019 · 6 comments · Fixed by #12891
Labels
request Package request

Comments

@Wychmire
Copy link
Contributor

Wychmire commented Jul 6, 2019

http://www.oilshell.org/
Releases are at https://www.oilshell.org/releases.html
I tried to make my own template file, but I don't know enough about xbps-src to get it working. Here's what I have, maybe it can speed things up a bit

# Template file for 'oilshell'
pkgname=oilshell
version=0.6.0
revision=2
wrksrc=oil-${version}
#archs="i686 x86_64"
build_style=gnu-configure
hostmakedepends="gcc"
makedepends="bash make readline"
#depends=""
short_desc="Oil, a new unix shell."
maintainer=" <>"
license="Apache"
homepage="http://www.oilshell.org/"
distfiles="https://${pkgname}.org/download/oil-${version}.tar.xz"
checksum=141e3a5c1997a696d65747966978aaa38921d77e303aad9e77b4ab4aedab84b7

do_configure() {
	./configure --prefix=/usr
}

do_build() {
	make
}

do_install() {
	vbin _bin/oil.ovm
}

And I wrote a working Arch PKGBUILD which might also be useful:

pkgname=oilshell
pkgver=0.6.0
pkgrel=3
license=('Apache')
pkgdesc="Oil, a new unix shell"
makedepends=(
	'wychmire-devel'
	'readline')
arch=('i686' 'x86_64')
url="https://www.oilshell.org/"
source=("https://www.oilshell.org/download/oil-$pkgver.tar.xz")
install=oilshell.install
sha256sums=('141e3a5c1997a696d65747966978aaa38921d77e303aad9e77b4ab4aedab84b7')
provides=('oilshell')
conflicts=('oilshell')

build() {
	cd "oil-$pkgver"
	./configure --prefix=/usr --with-readline
	make
}

package() {
	cd "oil-$pkgver"
	# the install script doesn't support DESTDIR
	install -Dm755 _bin/oil.ovm "$pkgdir/usr/bin/oil.ovm"
	ln -s /usr/bin/oil.ovm "$pkgdir/usr/bin/osh"
	ln -s /usr/bin/oil.ovm "$pkgdir/usr/bin/oshc"
	# for some reason osh expects itself to be in /usr/local/bin
	mkdir -p "$pkgdir/usr/local/bin"
	ln -s "$pkgdir/usr/bin/oil.ovm" "$pkgdir/usr/local/bin/osh"
}

(oilshell.install contains a simple script that checks if /usr/bin/osh exists in /etc/shells, and if not it adds it there)

@Hoshpak Hoshpak added the request Package request label Jul 6, 2019
@Hoshpak
Copy link
Member

Hoshpak commented Jul 6, 2019

I have no interest in maintaining this package so I won't submit it. In case you want to submit a PR or anyone else wants to submit a PR, here are my remarks regarding the pasted template:

  • the revision of a new template should always start at 1
  • commented out lines should be removed before submitting a PR (except the header line of course)
  • gcc is already installed by default in the build chroot, the hostmakedepends can be removed
  • same goes for make and bash
  • if the package links against readline, it needs the headers so it should have readline-devel in makedepends
  • the license requires a SPDX identifier, the appropriate one seems to be Apache-2.0
  • maybe the configure build_style would be more apropriate, this seems to be a custom solution, not gnu autotools
  • the functions (install, configure and build) are already provided by the build_style, you should be able to completely remove these from the template unless there's something you need to override

@Wychmire
Copy link
Contributor Author

Wychmire commented Jul 6, 2019

I'd be happy to submit a PR and maintain it, if I can get it to build.
I edited the template according to your suggestions:

# Template file for 'oilshell'
pkgname=oilshell
version=0.6.0
revision=1
wrksrc=oil-${version}
#archs="i686 x86_64"
build_style=configure
configure_args="--prefix=/usr --with-readline"
makedepends="readline-devel"
short_desc="Oil, a new unix shell."
maintainer=" <>"
license="Apache-2.0"
homepage="http://www.oilshell.org/"
distfiles="https://${pkgname}.org/download/oil-${version}.tar.xz"
checksum=141e3a5c1997a696d65747966978aaa38921d77e303aad9e77b4ab4aedab84b7

do_install() {
	vbin _bin/oil.ovm
 	# symlink osh, oshc to oil.ovm.
	cd ${DESTDIR}/usr/bin
	ln -s oil.ovm osh
	ln -s oil.ovm oshc 
	# for some reason osh expects itself to be in /usr/local/bin
	mkdir -p "${DESTDIR}/usr/local/bin"
	ln -s "${DESTDIR}/usr/bin/oil.ovm" "${DESTDIR}/usr/local/bin/osh"
}

I'm not sure if oilshell supports i686 or not. If the project doesn't mention anything about support, is it safe to assume there is no i686 support, or should I ask? For configure_args, by default it uses --prefix=/usr. Does adding a flag to that (--with-readline) overwrite the existing args? (in other words, do I need to add --prefix=/usr?)

It's failing to build with the message

=> oilshell-0.6.0_1: running do_build ...
strip -o _build/oil/ovm-opt.stripped _build/oil/ovm-opt  # What's the difference with debug symbols?
strip-wrapper: ignoring arguments: -o _build/oil/ovm-opt.stripped _build/oil/ovm-opt
# We need a relative path since it will be _bin/oil.ovm
objcopy --add-gnu-debuglink=_build/oil/ovm-opt.symbols _build/oil/ovm-opt.stripped
objcopy: '_build/oil/ovm-opt.stripped': No such file
make: *** [Makefile:157: _build/oil/ovm-opt.stripped] Error 1
=> ERROR: oilshell-0.6.0_1: do_build: '${make_cmd} ${makejobs} ${make_build_args} ${make_build_target}' exited with 2
=> ERROR:   in do_build() at common/build-style/configure.sh:14

Oilshell doesn't support out-of-tree builds, could that be causing this failure?

@Hoshpak
Copy link
Member

Hoshpak commented Jul 6, 2019

As you can see in the build output, strip is not actually called by the build process but rather a wrapper (common/wrappers/strip.sh) which ignores the arguments passed to it and returns. As a result, the file is not created and the following step fails.

I assume the wrapper is in place to ensure that no stripping happens during the build phase so xbps can do the stripping by itself and create a -dbg package. However if we let xbps strip the package, it results in a broken binary as documented in oilshell/oil#47 . So what would need to happen is that the wrapper needs to be deactivated and xbps needs to not strip the package.

Perhaps setting nostrip=yes in the template and removing the wrapper as it is done in the grub template would work but I haven't got time to test myself right now.

Putting things in /usr/local is strictly forbidden in packages and will make the build fail. So we have to find a way to do without the symlink.

If it builds on i686, it is fine to ship it. We don't require official upstream support for every architecture a package is created for. configure_args would be added to the default ones for the gnu-configure build_style, the configure build_style has no default arguments so there's nothing that could be overwritten, manually adding the prefix is correct in this case.

@Wychmire
Copy link
Contributor Author

Wychmire commented Jul 6, 2019

I added

pre_build() {
	rm -f ${XBPS_WRAPPERDIR}/strip
}

like found in the grub template and it gave me an error about /usr/local being forbidden like you mentioned, so I deleted that chunk and re-ran the build and it works. I installed the package with sudo xbps-install --repository=hostdir/binpkgs oilshell and that works too. The issue that caused me to symlink to /usr/local in the first place isn't occurring.

I tried to compile it to i686 with ./xbps-src -a i686 pkg oilshell but readline-devel never gets installed, so it fails. If I remove --with-readline from the configure-args if fails with lots of

#error "LONG_BIT definition appears wrong for platform (bad gcc/glibc config?)."

and then

objcopy --only-keep-debug _build/oil/ovm-opt _build/oil/ovm-opt.symbols
objcopy: '_build/oil/ovm-opt': No such file
make: *** [Makefile:150: _build/oil/ovm-opt.symbols] Error 1
=> ERROR: oilshell-0.6.0_1: do_build: '${make_cmd} ${makejobs} ${make_build_args} ${make_build_target}' exited with 2
=> ERROR:   in do_build() at common/build-style/configure.sh:14

So I don't think it supports i686. I attached the whole log regardless

If I add /usr/bin/osh to /etc/shells and chsh to it, I can't log into tty2, though all other ttys work. I can log into it with root, or if I chsh back to /bin/bash

i686.log

@Wychmire
Copy link
Contributor Author

Wychmire commented Jul 7, 2019

Following the directions in the readme about compiling for musl from a chroot, and it worked. Ran the template through xlint and corrected the issues it mentioned.
Made a PR at #12891 that closes this, thanks for the help with writing the template!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
request Package request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants
@Wychmire @Hoshpak and others