GithubHelp home page GithubHelp logo

Put it on package managers about zola HOT 35 CLOSED

getzola avatar getzola commented on July 17, 2024
Put it on package managers

from zola.

Comments (35)

BrendanBuono avatar BrendanBuono commented on July 17, 2024 10

https://chocolatey.org/ is generally the best package manager for Windows. I haven't actually uploaded a package there before, but I can take a look over the weekend if no one else has time

from zola.

bfontaine avatar bfontaine commented on July 17, 2024 5

FYI the Homebrew PR has been merged; so one can now install Gutenberg on macOS using:

brew install gutenberg

from zola.

perryprog avatar perryprog commented on July 17, 2024 3

Mac user here! I don't know anything about making homebrew packages, but here's ripgrep's formula.

I would recommend against .pkg installs. They're pains in the butt, and it's uncommon to find any programer without homebrew installed.

EDIT: Fixed formula link.

EDIT 2: Homebrew's docs on creating formula.

from zola.

bfontaine avatar bfontaine commented on July 17, 2024 3

I just submitted a PR to the core repository: Homebrew/homebrew-core#19650

from zola.

bfontaine avatar bfontaine commented on July 17, 2024 2

Experienced Homebrew-formula writer here—I just started writing a formula after seeing Gutenberg on HN. Is someone already on it? Otherwise if I don’t hit any issue it should be ready tonight.

from zola.

rushmorem avatar rushmorem commented on July 17, 2024 1

If no one beats me to it, I will create a Nix package for it.

from zola.

Keats avatar Keats commented on July 17, 2024 1

@saghm Sorry for the delay, only got around to testing it!

I have tried the following:

pkgname=gutenberg-git
pkgver=0.2.0
pkgrel=1
pkgdesc="An opinionated static site generator written in Rust"
arch=('any')
url="https://github.com/Keats/gutenberg"
license=('MIT')
makedepends=('oniguruma' 'rust' 'git')
source=('git+https://github.com/Keats/gutenberg.git')
sha512sums=('SKIP')
conflicts=('gutenberg')
provides=('gutenberg')

build() {
  cd "$srcdir/gutenberg"
  cargo build --release
}

package() {
  cd "$srcdir/gutenberg"
  install -Dm644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
  install -Dm755 target/release/gutenberg "$pkgdir/usr/bin/gutenberg"
}

and the Dockerfile:

FROM base/archlinux

RUN pacman -Syu --noconfirm
RUN pacman -S --noconfirm --needed base-devel git rust

# Setup non-root user to run makepkg
RUN useradd -m -G wheel nonroot
RUN echo "nonroot ALL=(root) NOPASSWD:ALL" > /etc/sudoers.d/nonroot && \
    chmod 0440 /etc/sudoers.d/nonroot

WORKDIR /home/nonroot
COPY PKGBUILD .

USER nonroot

CMD makepkg -si --noconfirm && gutenberg --version && git clone https://gitlab.com/Keats/vincent.is && cd vincent.is && gutenberg build && ls public/ && cat public/app.css

And that seems to work! The main change is putting oniguruma as build dep as it will be linked statically by Gutenberg so we don't need it after.

I want to write the PKGBUILD for gutenberg-bin next as I wouldn't really recommend using gutenberg master branch, it might be buggy sometimes.

from zola.

Keats avatar Keats commented on July 17, 2024 1

And

pkgname=gutenberg-bin
pkgver=0.2.0
pkgrel=1
pkgdesc="An opinionated static site generator - Precompiled binary from official repository"
arch=('any')
url="https://github.com/Keats/gutenberg"
license=('MIT')
provides=('gutenberg')
conflicts=('gutenberg')

source=("https://github.com/Keats/gutenberg/releases/download/v${pkgver}/${pkgname/-bin}-v${pkgver}-x86_64-unknown-linux-gnu.tar.gz")
sha256sums=('e41e65cd182dfce0aa77afe77c88f162839b9dfb527274476e2f9de3256bcc40')

package() {
  install -Dm755 "${srcdir}/${pkgname/-bin}" "${pkgdir}/usr/bin/${pkgname/-bin}"
}

does the job for a gutenberg-bin.

@rushmorem any chance you can make a nix derivation for 0.2.0 that was just released?

from zola.

rushmorem avatar rushmorem commented on July 17, 2024 1

@Keats Will be happy to. Will try to make time for that.

from zola.

Keats avatar Keats commented on July 17, 2024 1

I see. Looking at https://github.com/Homebrew/homebrew-core/blob/master/Formula/ripgrep.rb it seems that it's building from source so maybe we can do that as well if people don't mind a long compilation time.

from zola.

saghm avatar saghm commented on July 17, 2024

Is the AUR package blocked on anything? I'd be happy to submit/maintain an AUR package if someone is needed.

from zola.

Keats avatar Keats commented on July 17, 2024

@saghm Nothing, I just didn't find the time for it yet

from zola.

saghm avatar saghm commented on July 17, 2024

I wrote up a PKGBUILD file (minus the checksum, which is liable to change); feel free to use it!

pkgname=gutenberg-git
pkgver=0.1.3
pkgrel=1
_file="${pkgname}-v${pkgver}-x86_64-unknown-linux-gnu.tar.gz"
pkgdesc="An opinionated static site generator written in Rust"
arch=('any')
url="${_file}::https://github.com/Keats/gutenberg"
license=('MIT')
depends=('oniguruma')
makedepends=('rust')
source=($url/archive/v$pkgver.tar.gz)
sha512sums=('..')

build() {
  cd "$srcdir/gutenberg-$pkgver"
  cargo build --release
}

package() {
  cd "$srcdir/gutenberg-$pkgver"
  install -Dm644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
  install -Dm755 target/release/gutenberg "$pkgdir/usr/bin/gutenberg"
}

from zola.

Keats avatar Keats commented on July 17, 2024

I'm not sure that would work, the sass library for example requires at least git as well and if you want to build from source you'll need rust/cargo too. Is there a way to test the PKGBUILD in a container or something?
Also the source links to the already built package so you don't need to cargo build

from zola.

saghm avatar saghm commented on July 17, 2024

I'm not sure that would work, the sass library for example requires at least git as well

I don't think it should be necessary, but if you'd prefer, you can add git in the makedepends section.

if you want to build from source you'll need rust/cargo too

Yep, that's what the makedepends=('rust') line is for.

Also the source links to the already built package so you don't need to cargo build.

From downloading and inspecting this, it doesn't seem to be the case. Either way, it's generally preferable to build from source whenever possible (e.g. when installing a proprietary package) since that's what will be expected if the package is ever accepted in the main repos. For things that take an extraordinary long time to build, it's not uncommon to provide a separate <pkgname>-bin package for users who don't want to build from source. See for example [exa](https://aur.archlinux.org/packages/exa-git/

Is there a way to test the PKGBUILD in a container or something?

Sure! Here's a Dockerfile that installs the package:

FROM base/archlinux

RUN pacman -Syu --noconfirm 
RUN pacman -S --noconfirm --needed base-devel 

# Setup non-root user to run makepkg
RUN useradd -m -G wheel nonroot
RUN echo "nonroot ALL=(root) NOPASSWD:ALL" > /etc/sudoers.d/nonroot && \
    chmod 0440 /etc/sudoers.d/nonroot

WORKDIR /home/nonroot
COPY PKGBUILD .

USER nonroot

CMD makepkg -si --noconfirm && gutenberg --version

from zola.

saghm avatar saghm commented on July 17, 2024

@Keats Awesome, I'm glad it's working! Looking forward to being able to install it through the AUR

from zola.

Keats avatar Keats commented on July 17, 2024

I uploaded https://aur.archlinux.org/packages/gutenberg-bin/ but I don't think i'll upload a git version myself though

from zola.

saghm avatar saghm commented on July 17, 2024

Awesome! I don't plan on using anything but the releases, so the binary version works for me.

from zola.

danieleggert avatar danieleggert commented on July 17, 2024

For macOS, it’d be great to provide an installer .pkg.

from zola.

Keats avatar Keats commented on July 17, 2024

@danieleggert is it possible to generate one on Travis? If so, any guide/article on how to do so?

from zola.

Larusso avatar Larusso commented on July 17, 2024

I created a few brew Formulars and brew cask Formulars as well. Depends if you want to build it on the machines or just install the packed binaries. I am happy to help out.

from zola.

danieleggert avatar danieleggert commented on July 17, 2024

@Keats Yes, you can do it on Travis. As opposed to @perryprog I’d strongly prefer .pkg. I think it’s very much as question of preference. Some people have homebrew others don't.

from zola.

perryprog avatar perryprog commented on July 17, 2024

Fair enough, why not do both?

from zola.

Keats avatar Keats commented on July 17, 2024

@Larusso thanks! I think installing the packed binaries is the easiest way as a cargo build --release is going to take a long time.

Is there some kind of convention in Brew like in AUR? In AUR, you can have several packages like $NAME-bin means for the precompiled binary, $NAME-git for building from source from git master and $NAME would be building building from a tagged commit I guess.

@danieleggert @perryprog Agreed, if we can do both, let's do both!

from zola.

perryprog avatar perryprog commented on July 17, 2024

@Keats I don't think so — brew isn't like that too much, https://docs.brew.sh/Formula-Cookbook.html describes how most of the Formulas work and look.

In case you're wondering, installing something using homebrew looks something like this:

brew install ripgrep
brew install vim --without-python2
brew install emacs --with-cocoa

from zola.

Larusso avatar Larusso commented on July 17, 2024

@Keats There is a difference between brew and brew cask to start with. Brew Formulars build from Source. But you can provide prebuild binaries so called bottles. Cask on the other hand is for binary packages only. It allows you to execute an install script which can download an app package pkg or whatever. You can even symlink tools for command line use. This is helpfully for apps that also allow command line execution. The Formulars have a different DSL. If you want to build from source you also need to install all the dependencies. I don’t know if this is still the case but MacPorts was way saver when also quite verbose when it comes to compiler dependencies. Brew just falls back to system libraries. The Formular file can get quite complicated when you need to support older versions of Mac OS. With MacPorts you have the complete toolchain under control.

from zola.

Calinou avatar Calinou commented on July 17, 2024

Scoop can be interesting to package for; it's a simple Windows package manager targeted at CLI applications.

I can work on adding Gutenberg to it.

Edit: I submitted a pull request to Scoop. Providing 32-bit binaries (possibly using the GNU ABI) may have to be done, I'm not sure.

from zola.

danieleggert avatar danieleggert commented on July 17, 2024

@Keats I’m a bit at loss wrt. Travis. But you’d want to run something like this

#!/bin/sh
#
# Package into a product archive for the macOS installer
#

VERSION=1
IDENTIFIER=is.vincent.gutenberg
TOOL_PATH=${HOME}/Downloads/gb
TEMP=.
OUTPUT_PATH=.

ROOT=${TEMP}/gutenberg.dst
BIN=usr/local/bin

mkdir -p ${ROOT}/${BIN}
for x in gutenberg; do
    xcrun ditto ${TOOL_PATH}/${x} ${ROOT}/${BIN}/${x}
done

componentpkg=gutenberg-component.pkg

xcrun pkgbuild \
	--root ${ROOT} \
	--identifier ${IDENTIFIER}.component \
	--version ${VERSION} \
	--ownership recommended \
	${OUTPUT_PATH}/${componentpkg}

xcrun productbuild \
	--product gutenberg-requirements.plist \
	--package ${componentpkg} \
	--identifier ${IDENTIFIER} \
	--version ${VERSION} \
	${OUTPUT_PATH}/gutenberg.pkg

And the resulting ${OUTPUT_PATH}/gutenberg.pkg would then be what you’d distribute.
I’m not sure if you need to clear out $TMP on Travis or not. And you obviously need to fix the paths in this script to point to where things are on Travis.

This doesn’t sign the package, but it’d be a good start.

from zola.

Calinou avatar Calinou commented on July 17, 2024

A follow-up to the Scoop packaging: the pull request has been merged. 😄

from zola.

r15ch13 avatar r15ch13 commented on July 17, 2024

gutenberg is now available for Windows via scoop. New GitHub releases will be added automagically 😄

$ scoop install gutenberg

from zola.

danieleggert avatar danieleggert commented on July 17, 2024

@Keats How would I go about adding the above script for macOS to the Travis configuration?

from zola.

Keats avatar Keats commented on July 17, 2024

@Calinou @r15ch13 thanks! I've added it to the docs in 7cf120d

Can you install a specific version or will it always get the latest?

from zola.

Keats avatar Keats commented on July 17, 2024

@danieleggert I'm not entirely sure to be honest. I am using https://github.com/japaric/trust for the cross-compilation CI and I believe in that case it would need to change https://github.com/Keats/gutenberg/blob/master/ci/before_deploy.sh

However, if .pkg is something Mac users want, it would make sense to do an issue/PR on trust so it will happen for way more Rust binaries than just Gutenberg but I don't know whether @japaric is interested in that.

from zola.

Calinou avatar Calinou commented on July 17, 2024

Can you install a specific version or will it always get the latest?

Scoop doesn't support this, only the latest version can be installed (the version number cannot be specified upon installing), see Chocolatey Comparison for details.

from zola.

r15ch13 avatar r15ch13 commented on July 17, 2024

@Calinou @Keats it's possible to install other versions like so:

$ scoop install [email protected]

But it creates a new manifest file and doesn't validate the hash values. It creates a manifest on the fly.

from zola.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.