├── .github ├── FUNDING.yml └── ISSUE_TEMPLATE │ ├── bug_report.md │ ├── feature_request.md │ └── other.md ├── .gitignore ├── LICENSE ├── README.md ├── build-zsh-portable-libc-ubuntu.sh ├── build-zsh-portable-musl-alpine-portable.sh ├── build-zsh-portable-musl-alpine.sh ├── config.modules ├── result ├── zsh-portable-Linux-x86_64.tar.gz ├── zsh-portable-musl-alpine-Linux-x86_64.tar.gz └── zsh-portable-musl-alpine-portable-Linux-x86_64.tar.gz ├── zsh-portable-libc-ubuntu.Dockerfile ├── zsh-portable-musl-alpine-portable.Dockerfile ├── zsh-portable-musl-alpine.Dockerfile └── zsh.sh /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | # These are supported funding model platforms 2 | 3 | #github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2] 4 | patreon: xonssh # Replace with a single Patreon username 5 | #open_collective: # Replace with a single Open Collective username 6 | #ko_fi: # Replace with a single Ko-fi username 7 | #tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel 8 | #community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry 9 | #liberapay: # Replace with a single Liberapay username 10 | #issuehunt: # Replace with a single IssueHunt username 11 | #otechie: # Replace with a single Otechie username 12 | #custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] 13 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Local OS (where xxh is installed):** 11 | **Destination host OS:** 12 | **xxh version:** 13 | **xxh-plugins installed:** 14 | 15 | **Steps to Reproduce** 16 | 1. I run `xxh ... +v` 17 | 2. The output log: 18 | 3. What is the problem 19 | 20 | **For community:** 21 | ⬇️ **Please click the 👍 reaction instead of leaving a `+1` or 👍 comment** 22 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Is your feature request related to a problem? Please describe.** 11 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] 12 | 13 | **Describe the solution you'd like** 14 | A clear and concise description of what you want to happen. 15 | 16 | **Describe alternatives you've considered** 17 | A clear and concise description of any alternative solutions or features you've considered. 18 | 19 | **Additional context** 20 | Add any other context or screenshots about the feature request here. 21 | 22 | **For community:** 23 | ⬇️ **Please click the 👍 reaction instead of leaving a `+1` or 👍 comment** 24 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/other.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Other 3 | about: Any other questions 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | 11 | 12 | **For community:** 13 | ⬇️ **Please click the 👍 reaction instead of leaving a `+1` or 👍 comment** 14 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | xxh 2 | squashfs-root 3 | appimage 4 | xxh-shell* 5 | xxh-plugin* 6 | *.pyc 7 | *.out 8 | *.xcf 9 | *.egg 10 | .eggs/ 11 | .pytest_cache/ 12 | build/ 13 | dist/ 14 | xxh_xxh.egg-info/ 15 | venv/ 16 | 17 | # temporary files from vim and emacs 18 | *~ 19 | *# 20 | .#* 21 | *.swp 22 | *.swo 23 | 24 | # Editor project files 25 | *.komodo* 26 | .cache 27 | .idea 28 | .vscode/ 29 | 30 | # Mac 31 | .DS_Store 32 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | BSD 2-Clause License 2 | 3 | Copyright (c) 2020, xxh 4 | All rights reserved. 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted provided that the following conditions are met: 8 | 9 | 1. Redistributions of source code must retain the above copyright notice, this 10 | list of conditions and the following disclaimer. 11 | 12 | 2. Redistributions in binary form must reproduce the above copyright notice, 13 | this list of conditions and the following disclaimer in the documentation 14 | and/or other materials provided with the distribution. 15 | 16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 20 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 22 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 23 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 24 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 25 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | | Note! The best version was created in https://github.com/romkatv/zsh-bin/ - use it fisrt. | 2 | |---| 3 | 4 | The docker containers to build portable zsh. Originally created for [xxh project](https://github.com/xxh/xxh). 5 | 6 | ## Building 7 | ### libc 8 | ```shell script 9 | ./build-zsh-portable-libc-ubuntu.sh 10 | ls -la ./result 11 | ``` 12 | 13 | ### musl 14 | ``` 15 | ./build-zsh-portable-musl-alpine.sh 16 | ``` 17 | Version with relative lib path: 18 | ``` 19 | ./build-zsh-portable-musl-alpine-portable.sh 20 | ``` 21 | 22 | ## Example 23 | ``` 24 | mkdir -p /tmp/zsh-portable 25 | cp ./result/* /tmp/zsh-portable 26 | cd /tmp/zsh-portable && tar -xvzf zsh-portable-musl-alpine-portable-Linux-x86_64.tar.gz 27 | ./zsh.sh 28 | ``` 29 | 30 | ## Related 31 | * [zsh.org / Portable rootless ZSH](https://www.zsh.org/mla/workers/2019/msg00866.html) 32 | -------------------------------------------------------------------------------- /build-zsh-portable-libc-ubuntu.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | docker build . -f zsh-portable-libc-ubuntu.Dockerfile -t xxh/zsh-portable-libc-ubuntu #--no-cache --force-rm 4 | docker run --rm -v `pwd`/result:/result xxh/zsh-portable-libc-ubuntu 5 | -------------------------------------------------------------------------------- /build-zsh-portable-musl-alpine-portable.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | ./build-zsh-portable-musl-alpine.sh 4 | 5 | docker build . -f zsh-portable-musl-alpine-portable.Dockerfile -t xxh/zsh-portable-musl-alpine-portable #--no-cache --force-rm 6 | docker run --rm -v `pwd`/result:/result xxh/zsh-portable-musl-alpine-portable 7 | -------------------------------------------------------------------------------- /build-zsh-portable-musl-alpine.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | docker build . -f zsh-portable-musl-alpine.Dockerfile -t xxh/zsh-portable-musl-alpine #--no-cache --force-rm 4 | docker run --rm -v `pwd`/result:/result xxh/zsh-portable-musl-alpine 5 | -------------------------------------------------------------------------------- /config.modules: -------------------------------------------------------------------------------- 1 | # Edit this file to change the way modules are loaded. 2 | # The format is strict; do not break lines or add extra spaces. 3 | # Run `make prep' if you change anything here after compiling 4 | # (there is no need if you change this just after the first time 5 | # you run `configure'). 6 | # 7 | # Values of `link' are `static', `dynamic' or `no' to compile the 8 | # module into the shell, link it in at run time, or not use it at all. 9 | # In the final case, no attempt will be made to compile it. 10 | # Use `static' or `no' if you do not have dynamic loading. 11 | # 12 | # Values of `load' are `yes' or `no'; if yes, any builtins etc. 13 | # provided by the module will be autoloaded by the main shell 14 | # (so long as `link' is not set to `no'). 15 | # 16 | # Values of `auto' are `yes' or `no'. configure sets the value to 17 | # `yes'. If you set it by hand to `no', the line will be retained 18 | # when the file is regenerated in future. 19 | # 20 | # Note that the `functions' entry extends to the end of the line. 21 | # It should not be quoted; it is used verbatim to find files to install. 22 | # 23 | # You will need to run `config.status --recheck' if you add a new 24 | # module. 25 | # 26 | # You should not change the values for the pseudo-module zsh/main, 27 | # which is the main shell (apart from the functions entry). 28 | name=zsh/main modfile=Src/zsh.mdd link=static auto=yes load=yes functions=Functions/Chpwd/* Functions/Exceptions/* Functions/Math/* Functions/Misc/* Functions/MIME/* Functions/Prompts/* Functions/VCS_Info/* Functions/VCS_Info/Backends/* 29 | name=zsh/rlimits modfile=Src/Builtins/rlimits.mdd link=static auto=yes load=yes 30 | name=zsh/sched modfile=Src/Builtins/sched.mdd link=static auto=yes load=yes 31 | name=zsh/attr modfile=Src/Modules/attr.mdd link=static auto=yes load=no 32 | name=zsh/cap modfile=Src/Modules/cap.mdd link=static auto=yes load=no 33 | name=zsh/clone modfile=Src/Modules/clone.mdd link=static auto=yes load=no 34 | name=zsh/curses modfile=Src/Modules/curses.mdd link=static auto=yes load=no 35 | name=zsh/datetime modfile=Src/Modules/datetime.mdd link=static auto=yes load=no functions=Functions/Calendar/* 36 | name=zsh/db/gdbm modfile=Src/Modules/db_gdbm.mdd link=no auto=yes load=no 37 | name=zsh/example modfile=Src/Modules/example.mdd link=static auto=yes load=no 38 | name=zsh/files modfile=Src/Modules/files.mdd link=static auto=yes load=no 39 | name=zsh/langinfo modfile=Src/Modules/langinfo.mdd link=static auto=yes load=no 40 | name=zsh/mapfile modfile=Src/Modules/mapfile.mdd link=static auto=yes load=no 41 | name=zsh/mathfunc modfile=Src/Modules/mathfunc.mdd link=static auto=yes load=no 42 | name=zsh/nearcolor modfile=Src/Modules/nearcolor.mdd link=static auto=yes load=no 43 | name=zsh/newuser modfile=Src/Modules/newuser.mdd link=static auto=yes load=no functions=Scripts/newuser Functions/Newuser/* 44 | name=zsh/param/private modfile=Src/Modules/param_private.mdd link=static auto=yes load=no 45 | name=zsh/parameter modfile=Src/Modules/parameter.mdd link=static auto=yes load=yes 46 | name=zsh/pcre modfile=Src/Modules/pcre.mdd link=static auto=yes load=no 47 | name=zsh/regex modfile=Src/Modules/regex.mdd link=static auto=yes load=no 48 | name=zsh/net/socket modfile=Src/Modules/socket.mdd link=static auto=yes load=no 49 | name=zsh/stat modfile=Src/Modules/stat.mdd link=static auto=yes load=no 50 | name=zsh/system modfile=Src/Modules/system.mdd link=static auto=yes load=no 51 | name=zsh/net/tcp modfile=Src/Modules/tcp.mdd link=static auto=yes load=no functions=Functions/TCP/* 52 | name=zsh/termcap modfile=Src/Modules/termcap.mdd link=static auto=yes load=yes 53 | name=zsh/terminfo modfile=Src/Modules/terminfo.mdd link=static auto=yes load=yes 54 | name=zsh/zftp modfile=Src/Modules/zftp.mdd link=static auto=yes load=no functions=Functions/Zftp/* 55 | name=zsh/zprof modfile=Src/Modules/zprof.mdd link=static auto=yes load=no 56 | name=zsh/zpty modfile=Src/Modules/zpty.mdd link=static auto=yes load=no 57 | name=zsh/zselect modfile=Src/Modules/zselect.mdd link=no auto=yes load=no 58 | name=zsh/zutil modfile=Src/Modules/zutil.mdd link=static auto=yes load=yes 59 | name=zsh/compctl modfile=Src/Zle/compctl.mdd link=static auto=yes load=yes 60 | name=zsh/complete modfile=Src/Zle/complete.mdd link=static auto=yes load=yes functions=Completion/*comp* Completion/AIX/*/* Completion/BSD/*/* Completion/Base/*/* Completion/Cygwin/*/* Completion/Darwin/*/* Completion/Debian/*/* Completion/Linux/*/* Completion/Mandriva/*/* Completion/Redhat/*/* Completion/Solaris/*/* Completion/openSUSE/*/* Completion/Unix/*/* Completion/X/*/* Completion/Zsh/*/* 61 | name=zsh/complist modfile=Src/Zle/complist.mdd link=static auto=yes load=yes 62 | name=zsh/computil modfile=Src/Zle/computil.mdd link=static auto=yes load=yes 63 | name=zsh/deltochar modfile=Src/Zle/deltochar.mdd link=static auto=yes load=no 64 | name=zsh/zle modfile=Src/Zle/zle.mdd link=static auto=yes load=yes functions=Functions/Zle/* 65 | name=zsh/zleparameter modfile=Src/Zle/zleparameter.mdd link=static auto=yes load=yes 66 | -------------------------------------------------------------------------------- /result/zsh-portable-Linux-x86_64.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xxh/zsh-portable/aa8c64004a4b4b04df0a474bbe01e386ace115c9/result/zsh-portable-Linux-x86_64.tar.gz -------------------------------------------------------------------------------- /result/zsh-portable-musl-alpine-Linux-x86_64.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xxh/zsh-portable/aa8c64004a4b4b04df0a474bbe01e386ace115c9/result/zsh-portable-musl-alpine-Linux-x86_64.tar.gz -------------------------------------------------------------------------------- /result/zsh-portable-musl-alpine-portable-Linux-x86_64.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xxh/zsh-portable/aa8c64004a4b4b04df0a474bbe01e386ace115c9/result/zsh-portable-musl-alpine-portable-Linux-x86_64.tar.gz -------------------------------------------------------------------------------- /zsh-portable-libc-ubuntu.Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu:14.04 2 | VOLUME /result 3 | 4 | ENV ZSH_VER 5.8 5 | 6 | RUN mkdir -p /zsh /result 7 | 8 | WORKDIR /zsh 9 | RUN apt update && apt install -y wget mc make xz-utils build-essential libncurses-dev git python locales 10 | RUN locale-gen en_US.UTF-8 11 | RUN wget https://downloads.sourceforge.net/project/zsh/zsh/$ZSH_VER/zsh-$ZSH_VER.tar.xz 12 | RUN tar xf zsh-$ZSH_VER.tar.xz 13 | 14 | # 15 | # Build portable zsh (https://www.zsh.org/mla/workers/2019/msg00866.html) 16 | # 17 | WORKDIR zsh-$ZSH_VER 18 | RUN ./configure --disable-dynamic --prefix=$PWD/run --bindir=$PWD/run --enable-etcdir=./run/etc --enable-scriptdir=./run/scripts --enable-fndir=./run/functions --enable-function-subdirs --disable-site-fndir --with-tcsetpgrp 19 | ADD config.modules ./config.modules-new 20 | RUN cp config.modules-new config.modules 21 | RUN make && make install 22 | WORKDIR run 23 | RUN cp /lib/x86_64-linux-gnu/libtinfo.so.5 /lib/x86_64-linux-gnu/libncurses.so.5 ./ 24 | ADD zsh.sh . 25 | RUN chmod +x zsh.sh && rm zsh-* 26 | # This name is used in https://github.com/xxh/xxh please don't change 27 | CMD tar -zcf /result/zsh-portable-`uname`-`uname -m`.tar.gz * && ls -sh1 /result 28 | -------------------------------------------------------------------------------- /zsh-portable-musl-alpine-portable.Dockerfile: -------------------------------------------------------------------------------- 1 | FROM xxh/zsh-portable-musl-alpine 2 | VOLUME /result 3 | ENV ZSH_VER 5.8 4 | WORKDIR /zsh/zsh-$ZSH_VER/run 5 | RUN sed -i 's/\/lib\/ld-musl/.\/\/\/\/ld-musl/' zsh 6 | CMD tar -zcf /result/zsh-portable-musl-alpine-portable-`uname`-`uname -m`.tar.gz * && ls -sh1 /result 7 | -------------------------------------------------------------------------------- /zsh-portable-musl-alpine.Dockerfile: -------------------------------------------------------------------------------- 1 | FROM alpine 2 | VOLUME /result 3 | 4 | ENV ZSH_VER 5.8 5 | 6 | RUN mkdir -p /zsh /result 7 | 8 | WORKDIR /zsh 9 | RUN apk update && apk add wget mc make alpine-sdk ncurses-dev git python 10 | RUN wget https://downloads.sourceforge.net/project/zsh/zsh/$ZSH_VER/zsh-$ZSH_VER.tar.xz 11 | RUN tar xf zsh-$ZSH_VER.tar.xz 12 | 13 | # 14 | # Build portable zsh (https://www.zsh.org/mla/workers/2019/msg00866.html) 15 | # 16 | WORKDIR zsh-$ZSH_VER 17 | RUN ./configure --disable-dynamic --prefix=$PWD/run --bindir=$PWD/run --enable-etcdir=./run/etc --enable-scriptdir=./run/scripts --enable-fndir=./run/functions --enable-function-subdirs --disable-site-fndir --with-tcsetpgrp 18 | ADD config.modules ./config.modules-new 19 | RUN cp config.modules-new config.modules 20 | RUN make && make install 21 | WORKDIR run 22 | RUN cp /lib/ld-musl-x86_64.so.1 ./libc.musl-x86_64.so.1 && cp /usr/lib/libncursesw.so.6 ./ 23 | ADD zsh.sh . 24 | RUN chmod +x zsh.sh && rm zsh-* 25 | CMD tar -zcf /result/zsh-portable-musl-alpine-`uname`-`uname -m`.tar.gz * && ls -sh1 /result 26 | -------------------------------------------------------------------------------- /zsh.sh: -------------------------------------------------------------------------------- 1 | CDIR="$(cd "$(dirname "$0")" && pwd)" 2 | cd $CDIR 3 | 4 | export LD_LIBRARY_PATH=$CDIR:$LD_LIBRARY_PATH 5 | export ZDOTDIR=$CDIR 6 | export PATH=$CDIR:$PATH 7 | export ZSH_DISABLE_COMPFIX=true 8 | 9 | # Creating this recursive symlink placed here instead of creating it while building to avoid recursive reading while scp 10 | [ ! -d run ] && ln -sf . run 11 | [ -f libc.musl-x86_64.so.1 ] && ln -sf libc.musl-x86_64.so.1 ld-musl-x86_64.so.1 12 | ./zsh -fc "typeset -p fpath" | sed "s,./run,$CDIR,g" > .zshenv 13 | ./zsh "$@" 14 | --------------------------------------------------------------------------------