From 41476a1ef9718cab68092c4527eb2355ecd98296 Mon Sep 17 00:00:00 2001 From: Phantop Date: Sat, 15 May 2021 15:34:16 -0400 Subject: [PATCH] dwarfs, latest builds, add java --- .gitignore | 2 + README.md | 34 ++++++++++++ mkjava | 19 +++++++ wine/AppRun | 24 +++++++++ LICENSE => wine/LICENSE | 0 wine/README.md | 108 +++++++++++++++++++++++++++++++++++++ wine/mkruntime | 53 ++++++++++++++++++ wine/mkwine | 62 +++++++++++++++++++++ wine/runtime_libs_list.txt | 64 ++++++++++++++++++++++ 9 files changed, 366 insertions(+) create mode 100644 .gitignore create mode 100755 mkjava create mode 100755 wine/AppRun rename LICENSE => wine/LICENSE (100%) create mode 100644 wine/README.md create mode 100755 wine/mkruntime create mode 100755 wine/mkwine create mode 100644 wine/runtime_libs_list.txt diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ef00958 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +java +wine/wine diff --git a/README.md b/README.md index 1ee35d3..a6783b2 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,36 @@ +<<<<<<< HEAD # wine-portable-executable Wine builds packed into a portable executables +======= +## Description + +These scripts automatically fetch the latest version of their respective program and compress them into a portable image using [dwarfs](https://github.com/mhx/dwarfs) in a similar format to an [AppImage.](https://appimage.org/) + +## Requirements + +In order to create the images, you will need: + +- [dwarfs](https://github.com/mhx/dwarfs), specifically the `dwarfs` and `mkdwarfs` utilities (`dwarfs2` works, but you must either edit the script or link `dwarfs` to it) + +- My `appdwarf` script from [here](https://github.com/Phantop/dotfiles/blob/main/.local/bin/appdwarf) + +If you only wish to run an existing image, only `dwarfs` (or `dwarfs2`) is needed. + +## How to create portable executables + +Use the corresponding script for the desired program. + +This script will use ready-to-use binaries to create portable executables. + +## Notes + +Keep in mind that this project is new and it has not been thoroughly tested. Please report any problems you find. + +## Credits + +[wine-portable-executable](https://github.com/Kron4ek/wine-portable-executable) and [Wine-Builds](https://github.com/Kron4ek/Wine-Builds) by [Kron4ek](https://github.com/Kron4ek) + +[dwarfs](https://github.com/mhx/dwarfs) by [mhx](https://github.com/mhx) + +Java builds from [AdoptOpenJDK](https://adoptopenjdk.net/) +>>>>>>> fe54f14 (dwarfs, latest builds, add java) diff --git a/mkjava b/mkjava new file mode 100755 index 0000000..752ead7 --- /dev/null +++ b/mkjava @@ -0,0 +1,19 @@ +#!/bin/bash +DIR=/tmp/dwarf-portable-executable/java +mkdir -p $DIR +curl -L https://api.adoptopenjdk.net/v3/binary/latest/11/ga/linux/x64/jre/openj9/normal/adoptopenjdk | tar xz -C$DIR +JDK=$(echo $DIR/jdk*) + +cat > $JDK/AppRun << 'EOF' +#!/bin/sh +HERE=$(dirname $(readlink -f "${0}")) +export LD_LIBRARY_PATH="${HERE}":$PATH +"${HERE}"/bin/java $@ +rm -r ~/javasharedresources +EOF + +chmod +x $JDK/AppRun + +appdwarf $JDK +mv $(basename $JDK).sh java +rm -rf $DIR diff --git a/wine/AppRun b/wine/AppRun new file mode 100755 index 0000000..055ee27 --- /dev/null +++ b/wine/AppRun @@ -0,0 +1,24 @@ +#!/usr/bin/env bash + +script_dir="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")" + +if [ -z "$DISABLE_RUNTIME" ]; then + export LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${script_dir}/wine-runtime/lib:${script_dir}/wine-runtime/lib32" +fi + +export WINE="${script_dir}"/wine/bin/wine +export WINE64="${script_dir}"/wine/bin/wine64 +export WINESERVER="${script_dir}"/wine/bin/wineserver +export WINETRICKS="${script_dir}"/winetricks + +if [ "$1" = "winetricks" ]; then + if [ $# -ge 2 ]; then + shift + "${WINETRICKS}" "$@" + else + "${WINETRICKS}" --help + fi +else + "${WINE}" "$@" + "${WINESERVER}" -w +fi diff --git a/LICENSE b/wine/LICENSE similarity index 100% rename from LICENSE rename to wine/LICENSE diff --git a/wine/README.md b/wine/README.md new file mode 100644 index 0000000..390d2f5 --- /dev/null +++ b/wine/README.md @@ -0,0 +1,108 @@ +## Deprecated + +The project is deprecated in favor of another my project [**Conty**](https://github.com/Kron4ek/Conty), which is basically a much improved and extended version of this project. + +Conty not only allows to run Wine without any dependecies installed, but also allows to run anything else. Take a look, if you are interested. + +https://github.com/Kron4ek/Conty + + +## Description + +This project allows you to pack Wine and almost all of its required libraries into a single portable executable that should work on most Linux distributions. This project uses SquashFS as the container for Wine and its libraries (similar to what AppImage does). + +What are the benefits compared to regular Wine builds? The main benefit is that fewer libraries need to be installed. Another benefit is that SquashFS supports fast compression algorithms (such as lz4 or zstd), so Wine can launch faster and use less disk space. + +This is the structure of the portable executables generated (from the beginning to the end of the file): + +1. A script that mounts the bundled squashfs image and runs Wine +2. The squashfuse binary and its libraries, in case squashfuse isn't installed +3. The squashfs image that contains Wine, its required libraries (wine-runtime) +and a custom launch script + +--- + +## Requirements + +First of all, **FUSE** is required. + +Despite that most required libraries are included into the squashfs image, some libraries still need to be installed. This is the list of libraries that need to be installed: + +* libc6 (glibc) +* libstdc++6 (gcc-libs) +* libgcc1 (gcc-libs) +* libfreetype6 (freetype2) +* libasound2 (alsa-lib; required for sound to work) +* libgl1 (required for running OpenGL applications and for using WineD3D) +* vulkan-driver (required for running Vulkan applications and for using DXVK) + +Here are optional libraries that may be required for some applications: + +* libgnutls30 (gnutls) +* libldap-2.4-2 (libldap) +* libgmp10 (gmp) + +It's important to install both the 32-bit and 64-bit versions of these libraries. + +**GLIBC 2.27** or newer is required as the runtime is from Ubuntu 18.04. + +--- + +## How to use portable Wine executables + +You can download ready-to-use portable Wine/Proton executables from the [releases](https://github.com/Kron4ek/wine-portable-executable/releases) page. + +Root rights are **not required**! + +Make the script executable and run it. For example: + + chmod +x wine-portable-5.x-staging-amd64.sh + ./wine-portable-5.x-staging-amd64.sh application.exe + +To run winecfg (you can run regedit the same way): + + ./wine-portable-5.x-staging-amd64.sh winecfg + +You can also use the built-in winetricks to install dlls and other components. For example, the command below will install dxvk and d3dcompiler_47: + + ./wine-portable-5.x-staging-amd64.sh winetricks dxvk d3dcompiler_47 + +For testing purposes or if installing libraries is not a problem for you (but you like SquashFS and the idea of a single Wine executable), you can disable the included libraries (runtime), in which case Wine will use only system libraries: + + export DISABLE_RUNTIME=1 + ./wine-portable-5.x-staging-amd64.sh application.exe + +--- + +## How to create portable Wine executables + +Use **create_wine_portable.sh**. + +This script will use ready-to-use binaries to create portable Wine executable. + +If you want to create a runtime, squashfuse and Wine build from the scratch, then read the next section below. + +--- + +## From the scratch / Sources + +All components used in this project (the runtime, the squashfuse and the Wine builds) were created using the official sources. + +For my and your convenience i regularly upload ready-to-use runtime, squashfuse and Wine builds. + +If you want, you can create everything yourself using the available scripts. + +Available scripts: + +* **create_ubuntu_chroots.sh** creates two Ubuntu chroots (32-bit and 64-bit). +* **build_wine.sh** compiles Wine builds using two Ubuntu chroots (32-bit and 64-bit). +* **create_wine_runtime.sh** creates runtime by copying libraries from two Ubuntu chroots (32-bit and 64-bit). +* **build_squashfuse.sh** compiles squashfuse, lz4 and zstd in 64-bit Ubuntu chroot and creates squashfuse.tar with them included. + +The first two scripts are available in another my project: https://github.com/Kron4ek/Wine-Builds + +--- + +### Notes + +Keep in mind that this project is new and it has not been thoroughly tested. Please report any problems you find. diff --git a/wine/mkruntime b/wine/mkruntime new file mode 100755 index 0000000..ebe54c0 --- /dev/null +++ b/wine/mkruntime @@ -0,0 +1,53 @@ +#!/usr/bin/env bash + +## This script creates runtime for Wine by using two Ubuntu chroots + +scriptdir="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")" + +CHROOT_X64="${HOME}/chroots/bionic64_chroot" +CHROOT_X32="${HOME}/chroots/bionic32_chroot" + +if [ ! -d "${CHROOT_X64}" ] || [ ! -d "${CHROOT_X32}" ]; then + echo "Chroots are required for the runtime creation!" + exit 1 +fi + +if [ ! -f "${scriptdir}"/runtime_libs_list.txt ]; then + echo "runtime_libs_list.txt is required!" + exit 1 +fi + +rm -rf "${scriptdir}"/wine-runtime +mkdir -p "${scriptdir}"/wine-runtime/lib32 +mkdir -p "${scriptdir}"/wine-runtime/lib + +echo "Copying libraries..." +while read lib; do + if [ -f "${CHROOT_X32}"/usr/local/lib/"${lib}" ]; then + cp "${CHROOT_X32}"/usr/local/lib/"${lib}" "${scriptdir}"/wine-runtime/lib32 2>/dev/null + else + cp "${CHROOT_X32}"/lib/i386-linux-gnu/"${lib}" "${scriptdir}"/wine-runtime/lib32 2>/dev/null + cp "${CHROOT_X32}"/usr/lib/i386-linux-gnu/"${lib}" "${scriptdir}"/wine-runtime/lib32 2>/dev/null + fi + + if [ -f "${CHROOT_X64}"/usr/local/lib/"${lib}" ]; then + cp "${CHROOT_X64}"/usr/local/lib/"${lib}" "${scriptdir}"/wine-runtime/lib 2>/dev/null + else + cp "${CHROOT_X64}"/lib/x86_64-linux-gnu/"${lib}" "${scriptdir}"/wine-runtime/lib 2>/dev/null + cp "${CHROOT_X64}"/usr/lib/x86_64-linux-gnu/"${lib}" "${scriptdir}"/wine-runtime/lib 2>/dev/null + fi +done < "${scriptdir}"/runtime_libs_list.txt + +cd "${scriptdir}" || exit 1 + +find wine-runtime -type f -exec strip --strip-unneeded {} \; + +echo "Creating and compressing archive..." +tar -cf wine-runtime.tar wine-runtime +xz -9 wine-runtime.tar + +rm -r wine-runtime + +if [ -d binaries ]; then ln -sfr wine-runtime.tar.xz binaries; fi + +echo "Done" diff --git a/wine/mkwine b/wine/mkwine new file mode 100755 index 0000000..e5ea4ed --- /dev/null +++ b/wine/mkwine @@ -0,0 +1,62 @@ +#!/usr/bin/env bash + +start="$PWD" +winedir=/tmp/dwarf-portable-executable/wine +script_dir="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")" + +# You can change the url below if you want to use a different Wine build +# You can also put your directory (named wine) containing Wine build near the script +# If the script will see the directory named wine, then this URL will not be used +wine_url="$(curl https://api.github.com/repos/Kron4ek/Wine-Builds/releases | grep -wo http.\*-staging-tkg-amd64.tar.xz | head -n1)" + +# If there is no wine directory, then download Wine build from the URL +mkdir $winedir && cd $winedir +if [ ! -d wine ]; then + wget -nv -O wine.tar.xz "${wine_url}" -q --show-progress + + if [ $? -ne 0 ]; then + echo "URL for downloading Wine is incorrect!" + echo "Please set wine_url variable to correct URL" + exit 1 + fi + + tar xf wine.tar.xz + rm wine.tar.xz + mv wine* wine +fi + +if [ ! -d wine-runtime ]; then + if [ ! -f "${script_dir}"/wine-runtime.tar.xz ]; then + echo "wine-runtime.tar.xz is required!" + exit 1 + elif [ "$(stat -c%s "${script_dir}"/wine-runtime.tar.xz)" -lt 10000 ]; then + echo "Seems like wine-runtime.tar.xz is corrupted!" + exit 1 + else + tar xf "${script_dir}"/wine-runtime.tar.xz + fi +fi + +if [ ! -f AppRun ]; then + if [ ! -f "${script_dir}"/AppRun ]; then + echo "AppRun is required!" + exit 1 + else + cp "${script_dir}"/AppRun . + fi + + chmod +x AppRun +fi + +if [ ! -f winetricks ]; then + if [ ! -f "${script_dir}"/winetricks ]; then + wget -nv -O winetricks "https://raw.githubusercontent.com/Winetricks/winetricks/master/src/winetricks" -q --show-progress + fi + + chmod +x winetricks +fi + +cd "$start" +appdwarf $winedir +rm -r $winedir +mv wine.sh wine diff --git a/wine/runtime_libs_list.txt b/wine/runtime_libs_list.txt new file mode 100644 index 0000000..0e6d4c0 --- /dev/null +++ b/wine/runtime_libs_list.txt @@ -0,0 +1,64 @@ +libasn1.so.8 +libasyncns.so.0 +libbsd.so.0 +libcapi20.so.3 +libcom_err.so.2 +libexif.so.12 +libexpat.so.1 +libFAudio.so.0 +libFLAC.so.8 +libgcrypt.so.20 +libgpg-error.so.0 +libgphoto2_port.so.12 +libgphoto2.so.6 +libgsm.so.1 +libhcrypto.so.4 +libheimbase.so.1 +libheimntlm.so.0 +libhx509.so.5 +libicudata.so.60 +libicuuc.so.60 +libjbig.so.0 +libjpeg.so.8 +libkrb5.so.26 +liblber-2.4.so.2 +liblcms2.so.2 +libltdl.so.7 +liblz4.so.1 +liblzma.so.5 +libmpg123.so.0 +libodbc.so.2 +libogg.so.0 +libopenal.so.1 +libpcap.so.0.8 +libpng16.so.16 +libroken.so.18 +libSDL2-2.0.so.0 +libsndfile.so.1 +libsndio.so.6.1 +libsqlite3.so.0 +libtiff.so.5 +libudev.so.1 +libvkd3d-shader.so.1 +libvkd3d.so.1 +libvorbisenc.so.2 +libvorbis.so.0 +libvulkan.so.1 +libwind.so.0 +libwrap.so.0 +libX11.so.6 +libXau.so.6 +libxcb.so.1 +libXcomposite.so.1 +libXcursor.so.1 +libXdmcp.so.6 +libXext.so.6 +libXfixes.so.3 +libXinerama.so.1 +libXi.so.6 +libxml2.so.2 +libXrandr.so.2 +libXrender.so.1 +libxslt.so.1 +libXxf86vm.so.1 +libz.so.1