snapcraft.yaml (2952B)
1 name: hugo 2 version: git 3 summary: Fast and Flexible Static Site Generator 4 description: | 5 Hugo is a static HTML and CSS website generator written in Go. It is 6 optimized for speed, easy use and configurability. Hugo takes a directory 7 with content and templates and renders them into a full HTML website. 8 license: "Apache-2.0" 9 base: core20 10 confinement: strict 11 grade: devel # "devel" or "stable" 12 13 package-repositories: 14 - type: apt 15 components: [main] 16 suites: [focal] 17 key-id: 9FD3B784BC1C6FC31A8A0A1C1655A0AB68576280 18 url: https://deb.nodesource.com/node_16.x 19 20 plugs: 21 system-gitconfig: 22 interface: system-files 23 read: 24 - /etc/gitconfig 25 user-gitconfig: 26 interface: personal-files 27 read: 28 - $HOME/.gitconfig 29 - $HOME/.config/git/config 30 31 apps: 32 hugo: 33 environment: 34 HOME: $SNAP_REAL_HOME 35 command: bin/hugo 36 completer: hugo-completion 37 plugs: 38 - home 39 - network-bind 40 - removable-media 41 - system-gitconfig 42 - user-gitconfig 43 44 parts: 45 git: 46 plugin: nil 47 stage-packages: 48 - git 49 organize: 50 usr/bin/: bin/ 51 prime: 52 - bin/git 53 54 hugo: 55 plugin: nil 56 build-snaps: [go/1.18/stable] 57 source: . 58 override-build: | 59 set -ex 60 61 echo "\nStarting override-build:" 62 export GOPATH=$(realpath ../go) 63 export PATH=$GOPATH/bin:$PATH 64 65 echo ' * Running "go install -v github.com/magefile/mage"...' 66 go install -v github.com/magefile/mage 67 68 #echo ' * Running "mage -v test"...' 69 #mage -v test 70 71 echo " * SNAPCRAFT_IMAGE_INFO=${SNAPCRAFT_IMAGE_INFO=}" 72 # Example: SNAPCRAFT_IMAGE_INFO='{"build_url": "https://launchpad.net/~gohugoio/+snap/hugo-extended-dev/+build/344022"}' 73 export HUGO_BUILD_TAGS="" 74 if echo $SNAPCRAFT_IMAGE_INFO | grep -q '/+snap/hugo-extended'; then 75 HUGO_BUILD_TAGS="extended" 76 fi 77 echo " * Building hugo (HUGO_BUILD_TAGS=\"$HUGO_BUILD_TAGS\")..." 78 [ "$SNAPCRAFT_PROJECT_GRADE" = "stable" ] && mage -v hugoNoGitInfo || mage -v hugo 79 ./hugo version 80 ldd hugo || : 81 82 echo " * Building shell completion..." 83 ./hugo completion bash > hugo-completion 84 85 echo " * Installing to ${SNAPCRAFT_PART_INSTALL}..." 86 install -d $SNAPCRAFT_PART_INSTALL/bin 87 cp -av hugo $SNAPCRAFT_PART_INSTALL/bin/ 88 mv -v hugo-completion $SNAPCRAFT_PART_INSTALL/ 89 90 echo " * Stripping binary..." 91 ls -l $SNAPCRAFT_PART_INSTALL/bin/hugo 92 strip --remove-section=.comment --remove-section=.note $SNAPCRAFT_PART_INSTALL/bin/hugo 93 ls -l $SNAPCRAFT_PART_INSTALL/bin/hugo 94 95 node: 96 plugin: nil 97 stage-packages: 98 - nodejs 99 organize: 100 usr/bin/: bin/ 101 usr/lib/: lib/ 102 prime: 103 - bin/node 104 - lib/*/lib*.so* 105 106 pandoc: 107 plugin: nil 108 stage-packages: 109 - libatomic1 110 - pandoc 111 - pandoc-data 112 organize: 113 usr/bin/: bin/ 114 usr/lib/: lib/ 115 prime: 116 - bin/pandoc