void-linux / void-packages

The Void source packages collection
https://voidlinux.org
Other
2.49k stars 2.11k forks source link

Package request: Tachidesk-Server #48155

Open jaminW55 opened 7 months ago

jaminW55 commented 7 months ago

Package name

Tachidesk

Package homepage

https://github.com/Suwayomi/Suwayomi-Server/

Description

A free and open source manga reader server that runs extensions built for Tachiyomi.

Suwayomi is an independent Tachiyomi compatible software and is not a Fork of Tachiyomi.

Does the requested package meet the package requirements?

System, Compiled

Is the requested package released?

Yes

jaminW55 commented 7 months ago

I've done some work on this template and have it down to a single error: => ERROR: Tachidesk-Server-0.7.0_1: cannot find build helper /void-packages/common/build-style/gradle.sh!

This is only my 3rd attempt at package building for Void, so I am not entirely certain the correct approach here. Could someone help verify? Below is the current template.

# Template file for `Tachidesk-Server`
pkgname=Tachidesk-Server
version=0.7.0
revision=1
build_style=gradle
hostmakedepends="openjdk8"
depends="openjdk8"
short_desc="A free and open source manga reader server written in Kotlin"
maintainer="jaminW55 <wellerbp@protonmail.com>"
license="MPL-2.0"
homepage="https://github.com/Suwayomi/Tachidesk-Server"
distfiles="https://github.com/Suwayomi/Suwayomi-Server/releases/download/v0.7.0/Tachidesk-Server-v0.7.0-r1197-linux-x64.tar.gz"
checksum=cc1bc67b387d687a1bbbf4cc10e6437f66aa70c477df1eeaab5eff6cd9569c51

do_install() {
    vmkdir /usr/share/Tachidesk-Server
    vcopy build/libs/*.jar /usr/share/Tachidesk-Server
    # Create a symlink for the executable
    vln -s /usr/share/Tachidesk-Server/Tachidesk-Server.jar /usr/bin/tachidesk-server
}
classabbyamp commented 7 months ago

there's no such thing as a gradle build style. the available build styles are in common/build-style/

jaminW55 commented 7 months ago

This program builds with gradle per the build instructions for the package. What are my options for resolving this issue? I do not have the understanding on how to compose a build-style.

I do believe, from past experience on Fedora, that simply correctly placing the .jar file within the tar.gz in an area whereby it can be executed should be sufficient. for running the program as a webui at the bare minimum.

classabbyamp commented 7 months ago

write out the template yourself. build style are not necessary, they are just handy shortcuts for common types of builds. grep around for other templates using gradle

jaminW55 commented 7 months ago

write out the template yourself. build style are not necessary, they are just handy shortcuts for common types of builds. grep around for other templates using gradle

I've tried building one myself, but went wrong somewhere. => ERROR: Tachidesk-Server-0.7.0_1: do_build: './gradlew build' exited with 127 => ERROR: in do_build() at srcpkgs/Tachidesk-Server/template:22 I'll check for others.

# Template file for 'Tachidesk-Server'
pkgname=Tachidesk-Server
version=0.7.0
revision=1
build_style=fetch
hostmakedepends="openjdk8"
depends="openjdk8"
short_desc="A free and open source manga reader server written in Kotlin"
maintainer="jaminW55 <wellerbp@protonmail.com>"
license="MPL-2.0"
homepage="https://github.com/Suwayomi/Tachidesk-Server"
distfiles="https://github.com/Suwayomi/Suwayomi-Server/releases/download/v0.7.0/Tachidesk-Server-v0.7.0-r1197-linux-x64.tar.gz"
checksum=cc1bc67b387d687a1bbbf4cc10e6437f66aa70c477df1eeaab5eff6cd9569c51

do_extract() {
    tar -xzf ${XBPS_SRCDISTDIR}/${pkgname}-${version}/${pkgname}-v${version}-r1197-linux-x64.tar.gz -C ${wrksrc}
}

do_build() {
    export JAVA_HOME=/usr/lib/jvm/java-1.8-openjdk
    ./gradlew build
}

do_check(){
    cd ${wrksrc}
    gradle build
}

do_install() {
    vmkdir /usr/share/Tachidesk-Server
    vcopy build/libs/*.jar /usr/share/Tachidesk-Server
    # Create a symlink for the executable
    vln -s /usr/share/Tachidesk-Server/Tachidesk-Server.jar /usr/bin/tachidesk-server
}
oreo639 commented 7 months ago

https://github.com/void-linux/void-packages/commit/80a7f1151e7dbb9985f1fc46b18739407923b2ea The openjdk8 JAVA_HOME path changed, it should be /usr/lib/jvm/openjdk8 instead of /usr/lib/jvm/java-1.8-openjdk

classabbyamp commented 7 months ago

don't manually export JAVA_HOME, source /etc/profile.d/jdk.sh

meator commented 6 months ago

The void-packages repository expects the packages to be built by it. This is one of the package requirements and you specified that it fulfills the Compiled requirement in this issue. GitHub releases usually contain prebuilt binaries. void-packages doesn't distribute these[^1]. Void packages usually use the Source code (tar.gz) asset of releases[^2].

Recommended changes to template

5: You don't have to specify a build style. The default one already defines do_fetch() and do_extract(). 12: distfiles should use the version variable. A standard package update procedure involves changing two lines: version and checksum. When distfiles relies on version, it doesn't have to be changed in an update. 16-18: This can be removed (when the build_style is removed). Also xbps-src prefers bsdtar over tar. bsdtar is installed on every masterdir by default (because it is a dependency of base-chroot which is installed on masterdirs), tar has to be added to hostmakedepends manually. Also xbps-src uses bsdtar internally. 22: Your build is failing because you are using the wrong distfile described above. gradle is already packaged in Void, so it should be used. I don't know gradle well, but some googling showed me that the purpose of the gradlew script is to download gradle automatically. You should add gradle to hostmakedepends and use it directly[^3]. I've also seen some templates use the --no-daemon flag, that can be useful. 25-28: That doesn't look like it's doing any checking (but I don't have much experience with Java). If the package doesn't have any checks, don't define do_check(). 32,34: All package files[^4] must be put to ${DESTDIR}. Your template is currently polluting the masterdir. 34: I don't think vln exists. Use ln instad.

Here is the template modified with my and classabbyamp's suggestions:

# Template file for 'Tachidesk-Server'
pkgname=Tachidesk-Server
version=0.7.0
revision=1
hostmakedepends="openjdk8 gradle"
depends="openjdk8"
short_desc="A free and open source manga reader server written in Kotlin"
maintainer="jaminW55 <wellerbp@protonmail.com>"
license="MPL-2.0"
homepage="https://github.com/Suwayomi/Tachidesk-Server"
distfiles="https://github.com/Suwayomi/Suwayomi-Server/archive/refs/tags/v${version}.tar.gz"
checksum=ba18fa09ac4b7a1703d054da1ae8ff6d55af3b3b4d88b874260725ff94011656

do_build() {
    . /etc/profile.d/jdk.sh
    gradle --no-daemon build
}

do_install() {
    # TBD
}

This template doesn't work, but it's closer to the desired result. I do not have experience with gradle nor Java, so I can't really help more with this.

[^1]: There are some exceptions to this rule, void-packages contain some -bin packages, but it is discouraged. [^2]: This asset is generated automatically by GitHub for every release. It is a snapshot of that repository at that tag (excluding submodules). Some repositories don't have releases, but have tags. The process is very similar. [^3]: But I've also read that version mismatch between repo's gradle and the real gradle can create problems. The repo looks like it wants gradle-7.6, Void packages gradle-8.5. In that case, using gradlew might be necessary. But these problems should be solved by someone more knowledgeable of gradle, I have never used it. [^4]: Things that should actually be present in the resulting package, I don't mean the source code nor intermediate build artifacts, these belong to wrksrc.

jaminW55 commented 6 months ago

Update:

I managed to get the build to run, however, the package is having issues identifying the entered sha. I used xbps-fetch -s URL to retrieve the associated sha, so I am not certain why this may be the case. Regardless, here is the progress thus far.

I am certain I've made other errors, please feel free to correct.

TLDR: It builds, but does not install.

# Template file for 'Tachidesk-Server'
pkgname=Tachidesk-Server
version=0.7.0
revision=1
hostmakedepends="openjdk8 gradle unzip"
depends="openjdk8"
short_desc="Free and open source manga reader server written in Kotlin"
maintainer="jaminW55 <jaminW@proton.me>"
license="MPL-2.0"
homepage="https://github.com/Suwayomi/Tachidesk-Server"
distfiles="https://github.com/Suwayomi/Suwayomi-Server/archive/refs/tags/v${version}.tar.gz
https://github.com/Suwayomi/Suwayomi-Server/releases/download/v${version}/Tachidesk-Server-v${version}-r1197.jar"
checksums="ba18fa09ac4b7a1703d054da1ae8ff6d55af3b3b4d88b874260725ff94011656
e033b55a2042bbff32a45809741984c105d0d716960256edf0de5310ba265550"

do_build() {
    export JAVA_HOME=/usr/lib/jvm/openjdk8
    gradle --no-daemon #build
}

do_install() {
    echo "Listing all contents of ${wrksrc}..."
    find ${wrksrc} -name "*.jar" -exec ls -l {} \;

    cp ${wrksrc}/buildSrc/build/libs/*.jar /usr/share/Tachidesk-Server
    cp ${wrksrc}/gradle/wrapper/gradle-wrapper.jar /usr/share/Tachidesk-Server

    vinstall ${FILESDIR}/tachidesk-server.sh 755 usr/bin tachidesk-server
    vmkdir /usr/share/applications
    vinstall ${FILESDIR}/tachidesk-server.desktop 644 usr/share/applications
}