{"id":16730429,"url":"https://github.com/oschulz/swmod","last_synced_at":"2025-04-10T11:12:57.392Z","repository":{"id":8108424,"uuid":"9523964","full_name":"oschulz/swmod","owner":"oschulz","description":"Simple Software Module Management Tool","archived":false,"fork":false,"pushed_at":"2016-11-16T14:49:12.000Z","size":92,"stargazers_count":7,"open_issues_count":3,"forks_count":5,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-04-06T10:41:49.323Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/oschulz.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"COPYING","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-04-18T14:41:56.000Z","updated_at":"2018-02-16T07:06:29.000Z","dependencies_parsed_at":"2022-09-09T12:02:58.294Z","dependency_job_id":null,"html_url":"https://github.com/oschulz/swmod","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oschulz%2Fswmod","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oschulz%2Fswmod/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oschulz%2Fswmod/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oschulz%2Fswmod/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/oschulz","download_url":"https://codeload.github.com/oschulz/swmod/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248208565,"owners_count":21065202,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-12T23:33:28.556Z","updated_at":"2025-04-10T11:12:57.374Z","avatar_url":"https://github.com/oschulz.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"swmod - A Simple Software Module Management Tool\n================================================\n\nswmod is a simple tool to manage custom compiled software (in your home\ndirectory or a central location). It handles software as \"modules\" - modules\ncan be loaded, and new software packages can be installed into a module.\n\nBasically, swmod sets environment variables like `PATH` and `LD_LIBRARY_PATH`\nand can automatically supply options like `--prefix` to configure scripts.\n\nswmod is currently only works with bash, though it may in the future also\nsupport other `sh`-compatible shells. There are no plans to support `tcsh` or\nsimilar, so far.\n\n\nInstalling swmod\n----------------\n\nCopy the shell script `swmod.sh` from `bin` into (e.g.)\n\n    $HOME/.local/bin\n\nand add the following to your `.bashrc` (resp. `.profile`):\n\n    export PATH=\"$HOME/.local/bin:$PATH\"\n    . swmod.sh init\n\nYou may, of course, use any other directory in your `$PATH` instead of\n`$HOME/.local/bin`.\n\n\nUsing swmod\n-----------\n\n### Software Module Structure\n\nAny directory structure of the form\n\n    MODULE_NAME/`swmod hostspec`/MODULE_VERSION\n\nthat looks like a binary software installation (there's a `bin` or `lib`\ndirectory or an `swmod.deps` file, etc.) can be used as an swmod software\nmodule.\n\nThe output of the `swmod hostspec` command (part of swmod) is a system\nspecific string, e.g. \"linux-ubuntu-12.04-x86_64\", to support heterogeneous\ncomputing environments. You can override it with the environment variable\n`$SWMOD_HOSTSPEC`.\n\nswmod looks for modules in all directories listed in the (colon-separated)\npath `$SWMOD_MODPATH`. `$SWMOD_MODPATH` defaults to `$HOME/.local/sw/`.\n\nSo a typical user-installed module might look like this:\n\n    $HOME/.local/sw/my-software/linux-ubuntu-12.04-x86_64/4.2\n\nOf course, a module may comprise several individual software packages with the\nsame installation prefix.\n\n\n### Loading Software Modules\n\nJust run\n\n    # swmod load mysoftware\n\nor\n\n    # swmod load mysoftware@1.2.3\n\nif you want to load a specific one. Otherwise swmod will try to guess which\nversion is the current one. For numerical versions, it is legal to specify\nonly a part of the version number:\n\n    # swmod load mysoftware@1.2\n\nAgain, swmod will try to do the right thing.\n\n\nImportant: In shell scripts (like `.bashrc`) you have to use\n\n    . swmod.sh load ...\n\ninstead of\n\n    swmod load ...\n\nsince the `swmod` alias that is set up by `source swmod.sh init` does not work\nin shell scripts.\n\n\n### Creating Software Modules\n\nswmod compatible software module can be created simply by manually installing\n(or copying) software packages into a prefix directory with a path of a\ncertain structure (see above). However, swmod also provides several tools\nto assist with the installation of software packages into a module.\n\nFist, specify the installation target module and it's version, e.g.:\n\n    # swmod target mysoftware@1.2.3\n\nThis is the module (here, module \"mysoftware\", version \"1.2.3\"), into which\nyou want to install your software. You can specify a new module, or add more\nsoftware packages to an existing module.\n\nBy default, the module will be created under the path `$HOME/.local/sw/`. You\ncan override the default installation base path with the environment variable\n`$SWMOD_INST_BASE`.\n\nTo make things more comfortable, you can use `swmod target -l`, e.g.\n\n    # swmod target -l mysoftware@1.2.3\n\nas a shortcut for the frequently used combination\n\n    # swmod target mysoftware@1.2.3\n    # swmod load mysoftware@1.2.3\n\nThe software package(s) you want to install into your module (\"mysoftware\", in\nthis example) may depend on other software to build and to run. You can\npermanently add dependencies on other modules to the target module using\n`swmod add-deps`:\n\n    # swmod add-deps some_dep@1.0.1 some_other_dep@1.2.0\n\nThis way, the correct versions  of your dependencies will be automatically\nloaded when you load your module:\n\n    # swmod load mysoftware@1.2.3\n\nUse the `-l` option to immediately load the added dependencies, e.g.\n\n    # swmod add-deps -l some_dep@1.0.1 some_other_dep@1.2.0\n\nThis comes in handy when adding dependencies to an already loaded module.\n\nYou may also add the special dependency `!clflags`. If added to a module, the\ninclude and library directories in the module will be added with `-I` and `-L`\noptions to the environment variables `SWMOD_CPPFLAGS` and `SWMOD_LDFLAGS`.\n`swmod configure` and similar try to pass these through to the build system of\npackages to be configured or installed. Usually, this is not necessary as\nmodern software uses mechanisms like `...-config` or `pkg-config ...` to get\nthe necessary compiler and linker options for their dependencies. Where such\na mechanism is not provided, adding the special dependency `!clflags` can\nhelp.\n\nNow build and install the desired software package(s) into the module. swmod\nhas direct support for the following build systems:\n\n* GNU Autotools (and compatible \"configure\" scripts)\n* CMake\n* Phyton setup.py\n\n#### Installing GNU Autotools Projects\n\nIf the software package you want to install uses GNU Autoconf (and possibly\nAutomake) or provides a compatible \"configure\" script, run `swmod ./configure`\ninstead of `./configure`. `configure` must support the usual options like\n`--prefix` for this to work. Then run `make` and `make install` as usual:\n\n    # swmod ./configure\n    # make \u0026\u0026 make install \u0026\u0026 echo OK\n\nAfterwards, you should find a directory structure like this (depending on your\nsystem and the software package(s) you installed):\n\n* `$HOME/.local/sw/mysoftware/linux-ubuntu-14.04-x86_64/1.2.3/bin`\n* `$HOME/.local/sw/mysoftware/linux-ubuntu-14.04-x86_64/1.2.3/lib`\n* ...\n\nYou can also use\n\n    # swmod path/to/project/dir/configure\n\nfor Autoconf/Automake out-of-tree builds (if supported by the project).\n\n#### Installing CMake Projects\n\nFor CMake projects, use `swmod cmake` instead of `cmake`, then run `make` and\n`make install` as usual:\n\n    # cd my/build/dir\n    # swmod cmake path/to/project/dir\n    # make \u0026\u0026 make install \u0026\u0026 echo OK\n\n#### Installing Python Projects with setup.py\n\nTo build and install Python projects based on \"setup.py\", use\n\n    # swmod setup.py\n\nswmod will run `python setup.py` with the correct `--prefix` option (and\nalso create the \"site-packages\" directory first, if necessary).\n\n\n#### Installing Python Packages from PyPI\n\nTo download and install Python packages via `pip`, use\n\n    # swmod pip install ...\n\nThis is equivalent to\n\n    PYTHONUSERBASE=\"${SWMOD_INST_PREFIX}\" pip install --user ...\n\n\n#### Installing Projects Using Other Build Systems\n\nIf the software package you are installing uses SCons or another build system,\nyou have to pass the installation target directory to the build system\nmanually. `swmod target` exports an environment variable `SWMOD_INST_PREFIX`\nthat may come in handy.\n\n\n### Module-Specific Init Scripts\n\nIf your software module requires special initialization, environment\nvariables, etc., a create shell script named `swmodrc.sh` inside\n`$SWMOD_INST_PREFIX`. `swmod load` will source this script - after loading the\ndependencies of the module, but before modifying environment variables\n(`PATH`, ...) for the module itself. Environment variables already modified by\n`swmodrc.sh` are skipped by swmod afterwards, instead of changing them in the\nusual fashion.\n\nThe variable `SWMOD_INST_PREFIX` is available from within `swmodrc.sh`. Also,\nthe command `swmod_load` is available from within `swmodrc.sh`, to manually\nload other modules.\n\nFor example, if the software in question already provides a script like\n`bin/env.sh`, to set all paths and so on, just create a file `swmodrc.sh`\ncontaining\n\n    . \"$SWMOD_PREFIX/bin/env.sh\"\n\ninside the `$SWMOD_INST_PREFIX` directory.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foschulz%2Fswmod","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Foschulz%2Fswmod","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foschulz%2Fswmod/lists"}