github.com/gohugoio/hugo@v0.88.1/snap/snapcraft.yaml (about)

     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: stable # "devel" or "stable"
    12  
    13  apps:
    14    hugo:
    15      command: bin/hugo
    16      completer: hugo-completion
    17      plugs:
    18        - home
    19        - network-bind
    20        - removable-media
    21  
    22  parts:
    23    git:
    24      plugin: nil
    25      stage-packages:
    26        - git
    27      organize:
    28        usr/bin/: bin/
    29      prime:
    30        - bin/git
    31  
    32    hugo:
    33      plugin: nil
    34      build-snaps: [go/1.16/stable]
    35      source: .
    36      override-build: |
    37        set -ex
    38  
    39        echo "\nStarting override-build:"
    40        export GOPATH=$(realpath ../go)
    41        export PATH=$GOPATH/bin:$PATH
    42  
    43        echo ' * Running "go get -v github.com/magefile/mage"...'
    44        go get -v github.com/magefile/mage
    45  
    46        #echo ' * Running "mage -v test"...'
    47        #mage -v test
    48  
    49        echo " * SNAPCRAFT_IMAGE_INFO=${SNAPCRAFT_IMAGE_INFO=}"
    50        # Example: SNAPCRAFT_IMAGE_INFO='{"build_url": "https://launchpad.net/~gohugoio/+snap/hugo-extended-dev/+build/344022"}'
    51        export HUGO_BUILD_TAGS=""
    52        if echo $SNAPCRAFT_IMAGE_INFO | grep -q '/+snap/hugo-extended'; then
    53          HUGO_BUILD_TAGS="extended"
    54        fi
    55        echo " * Building hugo (HUGO_BUILD_TAGS=\"$HUGO_BUILD_TAGS\")..."
    56        [ "$SNAPCRAFT_PROJECT_GRADE" = "stable" ] && mage -v hugoNoGitInfo || mage -v hugo
    57        ./hugo version
    58        ldd hugo || :
    59  
    60        echo " * Building shell completion..."
    61        ./hugo gen autocomplete --completionfile=hugo-completion
    62  
    63        echo " * Installing to ${SNAPCRAFT_PART_INSTALL}..."
    64        install -d $SNAPCRAFT_PART_INSTALL/bin
    65        cp -av hugo $SNAPCRAFT_PART_INSTALL/bin/
    66        mv -v hugo-completion $SNAPCRAFT_PART_INSTALL/
    67  
    68        echo " * Stripping binary..."
    69        ls -l $SNAPCRAFT_PART_INSTALL/bin/hugo
    70        strip --remove-section=.comment --remove-section=.note $SNAPCRAFT_PART_INSTALL/bin/hugo
    71        ls -l $SNAPCRAFT_PART_INSTALL/bin/hugo
    72  
    73    node:
    74      plugin: nil
    75      stage-packages:
    76        - nodejs
    77      organize:
    78        usr/bin/: bin/
    79        usr/lib/: lib/
    80      prime:
    81        - bin/node
    82        - lib/*/lib*.so*
    83  
    84    pandoc:
    85      plugin: nil
    86      stage-packages:
    87        - libatomic1
    88        - pandoc
    89        - pandoc-data
    90      organize:
    91        usr/bin/: bin/
    92        usr/lib/: lib/
    93      prime:
    94        - bin/pandoc