dnote: seperate package for cli and server

dnote-server: build css/js
This commit is contained in:
Raven Ravener 2022-11-01 04:33:28 +00:00 committed by Henrik Grimler
parent 7bec235ec5
commit f182b5cd20
No known key found for this signature in database
GPG Key ID: B0076E490B71616B
6 changed files with 58 additions and 107 deletions

View File

@ -0,0 +1,44 @@
TERMUX_PKG_HOMEPAGE=https://www.getdnote.com/
TERMUX_PKG_DESCRIPTION="This package contains the Dnote server. It comprises of the web interface, the web API, and the background jobs."
TERMUX_PKG_LICENSE="AGPL-V3"
TERMUX_PKG_MAINTAINER="Ravener <ravener.anime@gmail.com>"
TERMUX_PKG_VERSION=2.0.1
TERMUX_PKG_REVISION=3
TERMUX_PKG_SRCURL=https://github.com/dnote/dnote/archive/refs/tags/server-v${TERMUX_PKG_VERSION}.tar.gz
TERMUX_PKG_SHA256=28cc3bf93b3849b9a4a5e65e531f8a34d6be6048427d924c56ab8c7887676bad
TERMUX_PKG_BUILD_IN_SRC=true
TERMUX_PKG_SUGGESTS="postgresql"
termux_step_pre_configure() {
termux_setup_nodejs
termux_setup_golang
go mod download
# build assets for dnote-server:
cd "$TERMUX_PKG_SRCDIR/pkg/server/assets"
npm update && npm i
./js/build.sh
./styles/build.sh
}
termux_step_make() {
cd "$TERMUX_PKG_SRCDIR"
# build binary
moduleName="github.com/dnote/dnote"
ldflags="-X '$moduleName/pkg/server/buildinfo.CSSFiles=main.css' -X '$moduleName/pkg/server/buildinfo.JSFiles=main.js' -X '$moduleName/pkg/server/buildinfo.Version=$TERMUX_PKG_VERSION' -X '$moduleName/pkg/server/buildinfo.Standalone=true'"
go build -o dnote-server -ldflags "$ldflags" pkg/server/main.go
}
termux_step_make_install() {
install -Dm700 $TERMUX_PKG_SRCDIR/dnote-server $TERMUX_PREFIX/bin/dnote-server
}
termux_step_install_license() {
install -Dm600 -t "${TERMUX_PREFIX}/share/doc/${TERMUX_PKG_NAME}" \
"${TERMUX_PKG_SRCDIR}/licenses/AGPLv3.txt"
install -Dm600 -t "${TERMUX_PREFIX}/share/doc/${TERMUX_PKG_NAME}" \
"${TERMUX_PKG_SRCDIR}/LICENSE"
}

View File

@ -1,38 +1,27 @@
TERMUX_PKG_HOMEPAGE=https://www.getdnote.com/
TERMUX_PKG_DESCRIPTION="A simple command line notebook for programmers"
TERMUX_PKG_LICENSE="AGPL-V3,GPL-3.0"
TERMUX_PKG_MAINTAINER="2096779623 <admin@utermux.dev>"
TERMUX_PKG_VERSION=2.0.1
TERMUX_PKG_REVISION=2
TERMUX_PKG_SRCURL=https://github.com/dnote/dnote/archive/refs/tags/server-v${TERMUX_PKG_VERSION}.tar.gz
TERMUX_PKG_SHA256=28cc3bf93b3849b9a4a5e65e531f8a34d6be6048427d924c56ab8c7887676bad
TERMUX_PKG_LICENSE="GPL-3.0"
TERMUX_PKG_MAINTAINER="Ravener <ravener.anime@gmail.com>"
TERMUX_PKG_VERSION=1:0.12.0
TERMUX_PKG_SRCURL=https://github.com/dnote/dnote/archive/refs/tags/cli-v${TERMUX_PKG_VERSION:2}.tar.gz
TERMUX_PKG_SHA256=2b2c276f3b381a853e155ed2eab7007c5b5f2ec927b3d882d5605f2650b15085
TERMUX_PKG_BUILD_IN_SRC=true
TERMUX_PKG_AUTO_UPDATE=true
TERMUX_PKG_SUGGESTS="postgresql, dnote-server, dnote-client"
TERMUX_PKG_BREAKS=dnote-client
TERMUX_PKG_REPLACES=dnote-client
termux_step_pre_configure() {
termux_setup_nodejs
termux_setup_golang
go mod download
# build assets for dnote-server:
cd "$TERMUX_PKG_SRCDIR/pkg/server/assets"
npm update && npm i
termux_setup_golang
go mod download
}
termux_step_make() {
cd "$TERMUX_PKG_SRCDIR"
export GOOS=android
$TERMUX_PKG_SRCDIR/scripts/cli/build.sh ${TERMUX_PKG_VERSION}
$TERMUX_PKG_SRCDIR/scripts/server/build.sh ${TERMUX_PKG_VERSION}
cd "$TERMUX_PKG_SRCDIR"
go build -o dnote -ldflags "-X main.versionTag=${TERMUX_PKG_VERSION:2}" pkg/cli/main.go
}
termux_step_make_install() {
install -Dm700 $TERMUX_PKG_SRCDIR/build/server/android-$GOARCH/dnote-server "$TERMUX_PREFIX/bin/dnote-server"
install -Dm700 $TERMUX_PKG_SRCDIR/build/cli/android-$GOARCH/dnote "$TERMUX_PREFIX/bin/dnote"
install -Dm644 /dev/null "${TERMUX_PREFIX}/share/bash-completion/completions/dnote.bash"
install -Dm700 $TERMUX_PKG_SRCDIR/dnote $TERMUX_PREFIX/bin/dnote
install -Dm644 /dev/null "${TERMUX_PREFIX}/share/bash-completion/completions/dnote.bash"
install -Dm644 /dev/null "${TERMUX_PREFIX}/share/zsh/site-functions/_dnote"
install -Dm644 /dev/null "${TERMUX_PREFIX}/share/fish/vendor_completions.d/dnote.fish"
}
@ -49,8 +38,6 @@ termux_step_create_debscripts() {
termux_step_install_license() {
install -Dm600 -t "${TERMUX_PREFIX}/share/doc/${TERMUX_PKG_NAME}" \
"${TERMUX_PKG_SRCDIR}/licenses/GPLv3.txt"
install -Dm600 -t "${TERMUX_PREFIX}/share/doc/${TERMUX_PKG_NAME}" \
"${TERMUX_PKG_SRCDIR}/licenses/AGPLv3.txt"
install -Dm600 -t "${TERMUX_PREFIX}/share/doc/${TERMUX_PKG_NAME}" \
install -Dm600 -t "${TERMUX_PREFIX}/share/doc/${TERMUX_PKG_NAME}" \
"${TERMUX_PKG_SRCDIR}/LICENSE"
}

View File

@ -1,41 +0,0 @@
diff -uNr dnote-server-v2.0.1/scripts/cli/build.sh dnote-server-v2.0.1.mod/scripts/cli/build.sh
--- dnote-server-v2.0.1/scripts/cli/build.sh 2022-05-09 19:37:02.000000000 +0800
+++ dnote-server-v2.0.1.mod/scripts/cli/build.sh 2022-10-29 18:03:03.282780947 +0800
@@ -76,37 +76,9 @@
if [ "$platform" == "windows" ]; then
flags+=("-buildmode=exe")
fi
-
- xgo \
- -go "$goVersion" \
- -targets="$platform/$arch" \
- -ldflags "$ldflags" \
- -dest="$destDir" \
- -out="cli" \
- "${flags[@]}" \
- -tags "$tags" \
- -pkg pkg/cli \
- .
fi
-
- popd
-
binaryName=$(get_binary_name "$platform")
mv "$destDir/cli-${platform}-"* "$destDir/$binaryName"
-
- # build tarball
- tarballName="dnote_${version}_${platform}_${arch}.tar.gz"
- tarballPath="$outputDir/$tarballName"
-
- cp "$projectDir/licenses/GPLv3.txt" "$destDir"
- cp "$basedir/README.md" "$destDir"
- tar -C "$destDir" -zcvf "$tarballPath" "."
- rm -rf "$destDir"
-
- # calculate checksum
- pushd "$outputDir"
- shasum -a 256 "$tarballName" >> "$outputDir/dnote_${version}_checksums.txt"
- popd
}
if [ -z "$GOOS" ] && [ -z "$GOARCH" ]; then

View File

@ -1,2 +0,0 @@
TERMUX_SUBPKG_DESCRIPTION="dnote client"
TERMUX_SUBPKG_INCLUDE="bin/dnote share/doc/${TERMUX_PKG_NAME}/GPLv3.txt"

View File

@ -1,2 +0,0 @@
TERMUX_SUBPKG_DESCRIPTION="dnote server"
TERMUX_SUBPKG_INCLUDE="bin/dnote-server share/doc/${TERMUX_PKG_NAME}/AGPLv3.txt"

View File

@ -1,35 +0,0 @@
diff -uNr dnote-server-v2.0.1/scripts/server/build.sh dnote-server-v2.0.1.mod/scripts/server/build.sh
--- dnote-server-v2.0.1/scripts/server/build.sh 2022-05-09 19:37:02.000000000 +0800
+++ dnote-server-v2.0.1.mod/scripts/server/build.sh 2022-10-29 17:44:33.332781370 +0800
@@ -26,8 +26,8 @@
fi
build() {
- platform=$1
- arch=$2
+ platform=android
+ arch=$GOARCH
pushd "$basedir"
@@ -46,20 +46,8 @@
popd
- # build tarball
- tarballName="dnote_server_${version}_${platform}_${arch}.tar.gz"
- tarballPath="$outputDir/$tarballName"
-
cp "$projectDir/licenses/AGPLv3.txt" "$destDir"
cp "$basedir/README.md" "$destDir"
- tar -C "$destDir" -zcvf "$tarballPath" "."
- rm -rf "$destDir"
-
- # calculate checksum
- pushd "$outputDir"
- shasum -a 256 "$tarballName" >> "$outputDir/dnote_${version}_checksums.txt"
- popd
-
}
build linux amd64