Skip to content

nimpacker/nimpacker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

89 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

nimpacker Build Status

Build and packaging nimble binary package for Windows, macOS and Linux.

Usage

Build

nimpacker build --target <windows|linux|macos> --icon data/logo.png --release

on Windows will generate .ico and embedd into .exe via rcedit.

on macOS will generate .icns and put into .app directory.

on Linux just binary.

Produced files under ./build

Packaging

nimpacker pack --target <windows|linux|macos> --icon data/logo.png --release

Packaging nimble binary package into (.exe, .dmg, .deb)

on Windows will generate installer exe via Inno Setup.

on macOS will generate .dmg via create-dmg.

on Linux will generate .deb via dpkg-dev and .AppImage via linuxdeployqt.

Produced files under ./dist

example directory structure.

.
├── APPID.txt (Recommend for best practice)
├── .nimpacker_cache/
├── VERSION.txt (Recommend for best practice)
├── build
│   ├── linux
│   │   └── Release
│   │       ├── debian
│   │       │   └── control
│   │       └── usr
│   │           ├── bin
│   │           │   └── package_name
│   │           └── share
│   │               ├── applications
│   │               │   └── package_name.desktop
│   │               └── icons
│   │                   └── package_name.png
│   ├── windows
│   │   └── Release
│   │       └── package_name.exe
│   └── macos
│       └── Release
│           └── package_name.app
│               └── Contents
│                   ├── Info.plist
│                   ├── MacOS
│                   │   └── package_name
│                   └── Resources
│                       └── app.icns
├── dist
├── package_name.nimble
├── nimpacker
│   ├── post_build.nims
│   ├── meta.nims
│   └── debian
│       ├── preinst
│       ├── postinst
│       ├── prerm
│       └── postrm

.nimpacker_cache/ is cache direcotry for nimpacker.

nimpacker/post_build.nims is nimscript executed after build.

nimpacker/meta.nims is variables defined for app meta info.

nimpacker/debian scripts for deb package.

example nimpacker/post_build.nims

#!/usr/bin/env nim

mode = ScriptMode.Verbose # or .Silent

import std/[os, strformat]

const APP_DIR {.strdefine.} = ""

echo "Build directory: " & APP_DIR

let exe = "chromedriver".toExe

when defined(macosx):
  const ResourcesDir = APP_DIR / "Contents" / "Resources"
  cpDir "data", ResourcesDir / "data"
  mkDir ResourcesDir / "drivers"
  let src = "drivers" / "chromedriver-mac-arm64" / exe
  cpFile src, ResourcesDir / "drivers" / exe
elif defined(windows):
  mkDir APP_DIR / "drivers"
  cpDir "data", APP_DIR / "data"
  let src = "drivers" / "chromedriver-win64" / exe
  cpFile src, APP_DIR / "drivers" / exe
elif defined(linux):
  mkDir APP_DIR / "usr" / "share" / "package_name"
  cpDir "data", APP_DIR / "usr" / "share" / "package_name" / "data"
  let src = "drivers" / "chromedriver-linux64" / exe
  cpFile src, APP_DIR / "usr" / "bin" / exe

APP_DIR is defined via nimpacker

example nimpacker/meta.nims

import os

productName = "NimPacker" # default to package name

# a GUID required by InnoSetup
appId = staticRead(getCurrentDir() / "APPID.txt")

# file associations, used for MacOS
fileAssociations = @[
    DocumentType(
        exts: @["xlsx", "xls"],
        mimes: @[
            "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
            "application/vnd.ms-excel"
        ],
        utis: @[
            "org.openxmlformats.spreadsheetml.sheet",
            "com.microsoft.excel.xls"
            ],
        role: DocumentTypeRole.Viewer
    )
]

maintainer = "Debian QA Group <packages@qa.debian.org>" # deb Maintainer
homepage = "https://nim-lang.org" # deb and exe Homepage
linuxCategories = @["Utility"]

About

Build and packaging nimble binary package for Windows, macOS and Linux.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages