Skip to content

Commit

Permalink
Merge pull request #3 from timothyschoen/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
timothyschoen authored Dec 10, 2022
2 parents 8ded5b3 + d47028a commit 1b32d5a
Show file tree
Hide file tree
Showing 7 changed files with 82 additions and 115 deletions.
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*.zip filter=lfs diff=lfs merge=lfs -text
*.xz filter=lfs diff=lfs merge=lfs -text
65 changes: 6 additions & 59 deletions .github/workflows/run_script.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ jobs:

- uses: actions/checkout@v3
with:
lfs: 'true'
submodules: recursive

- name: Run Packaging Script
Expand All @@ -66,65 +67,11 @@ jobs:
files: Heavy-Win64

build-linux:
name: ${{ matrix.name }}
runs-on: ubuntu-latest
container:
image: ${{ matrix.os }}
options: --privileged
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup

strategy:
fail-fast: false # show all errors for each platform (vs. cancel jobs on error)
matrix:
include:
- name: Ubuntu-22.04-x64
os: ubuntu:22.04
pacman: apt
- name: Ubuntu-20.04-x64
os: ubuntu:20.04
pacman: apt
- name: Debian-x64
os: debian
pacman: apt
- name: Fedora-36-x64
os: fedora:36
pacman: dnf
- name: Fedora-35-x64
os: fedora:35
pacman: dnf
- name: Mageia-x64
os: mageia
pacman: dnf
- name: OpenSUSE-Leap-x64
os: opensuse/leap
pacman: zypper
- name: Arch-x64
os: archlinux
pacman: pacman

name: Linux-x64
runs-on: ubuntu-18.04
steps:
- name: Install Dependencies (dnf)
if: ${{ matrix.pacman == 'dnf' }}
run: |
dnf install -y git binutils python3 curl gzip xz make dfu-util patchelf libusb-devel which gcc
- name: Install Dependencies (apt)
if: ${{ matrix.pacman == 'apt' }}
run: apt update && apt install -y git binutils python3 python3-pip curl tar gzip xz-utils make dfu-util patchelf libusb-dev build-essential

- name: Install Dependencies (zypper)
if: ${{ matrix.pacman == 'zypper' }}
run: |
zypper refresh && zypper install -y git binutils python3 curl tar gzip xz make patchelf which gcc
curl -fSL -A "Mozilla/4.0" -o libusb.rpm https://download.opensuse.org/repositories/hardware/15.4/src/libusb-1_0-1.0.26-lp154.73.1.src.rpm
rpm -i libusb.rpm
curl -fSL -A "Mozilla/4.0" -o dfu_util.rpm https://download.opensuse.org/repositories/hardware/15.4/x86_64/dfu-util-0.11-lp154.4.1.x86_64.rpm
rpm -i dfu_util.rpm
- name: Install Dependencies (pacman)
if: ${{ matrix.pacman == 'pacman' }}
run: pacman -Sy && pacman -S --noconfirm git binutils python3 curl tar gzip xz make dfu-util patchelf libusb base-devel && pacman --noconfirm -Syu
run: sudo apt update && sudo apt install -y git binutils python3 python3-pip curl tar gzip xz-utils make patchelf libusb-dev build-essential rsync csh gawk autoconf automake autotools-dev wget m4 flex bison texinfo unzip help2man meson gperf lzip libtool-bin patch ninja-build libstdc++6 libncurses5-dev

- uses: actions/checkout@v3
with:
Expand All @@ -140,7 +87,7 @@ jobs:
- name: Archive Artifacts
uses: actions/upload-artifact@v3
with:
name: Heavy-${{ matrix.name }}
name: Heavy-Linux-x64
path: ${{github.workspace}}/Heavy

- name: Release Artifacts
Expand All @@ -149,6 +96,6 @@ jobs:
with:
prerelease: true
draft: true
files: Heavy-${{ matrix.name }}
files: Heavy-Linux-x64


2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
[submodule "libDaisy"]
path = libDaisy
url = https://github.com/electro-smith/libDaisy.git
[submodule "DPF"]
[submodule "dpf"]
path = DPF
url = https://github.com/DISTRHO/DPF.git
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.3.0
0.3.1
39 changes: 15 additions & 24 deletions build.bat
Original file line number Diff line number Diff line change
@@ -1,34 +1,24 @@
:: Get daisy toolchain, containing the arm compiler and more utils
git clone --recursive https://github.com/electro-smith/DaisyToolchain
mkdir "Heavy"

move DaisyToolchain\windows Heavy

set URL="https://github.com/skeeto/w64devkit/releases/download/v1.17.0/w64devkit-1.17.0.zip"

:: Get minimal minGW environment, for command line utilities and native compilation utilities
powershell -Command "Invoke-WebRequest %URL% -OutFile w64devkit.zip"
powershell -Command "Expand-Archive w64devkit.zip -Force -DestinationPath .\tmp"

move tmp\w64devkit\bin\* Heavy\bin\
move tmp\w64devkit\lib\* Heavy\lib\
move tmp\w64devkit\libexec Heavy\libexec
:: Expand minGW environment, for command line utilities and compilation utilities
powershell -Command "Expand-Archive resources\minGW.zip -Force -DestinationPath .\Heavy"

copy resources\heavy-static.a Heavy\lib\heavy-static.a
copy resources\daisy_makefile Heavy\etc\daisy_makefile
xcopy /E /H /C /I resources\usb_driver Heavy\etc\usb_driver

:: Remove unnecessary target platforms from compiler
mkdir "Heavy\arm-none-eabi\lib\temp"
move "Heavy\arm-none-eabi\lib\thumb\v7e-m+dp" "Heavy\arm-none-eabi\lib\temp\v7e-m+dp"
rmdir /S /Q "Heavy\arm-none-eabi\lib\thumb"
rename "Heavy\arm-none-eabi\lib\temp" "thumb"
mkdir "Heavy\usr\arm-none-eabi\lib\temp"
move "Heavy\usr\arm-none-eabi\lib\thumb\v7e-m+dp" "Heavy\arm-none-eabi\usr\lib\temp\v7e-m+dp"
rmdir /S /Q "Heavy\usr\arm-none-eabi\lib\thumb"
rename "Heavy\usr\arm-none-eabi\lib\temp" "thumb"

mkdir "Heavy\lib\gcc\arm-none-eabi\12.2.0\temp"
move "Heavy\lib\gcc\arm-none-eabi\12.2.0\thumb\v7e-m+dp" "Heavy\lib\gcc\arm-none-eabi\12.2.0\temp\v7e-m+dp"
rmdir /S /Q "Heavy\lib\gcc\arm-none-eabi\12.2.0\thumb"
rename "Heavy\lib\gcc\arm-none-eabi\12.2.0\temp" "thumb"
mkdir "Heavy\usr\lib\gcc\arm-none-eabi\12.2.0\temp"
move "Heavy\usr\lib\gcc\arm-none-eabi\12.2.0\thumb\v7e-m+dp" "Heavy\usr\lib\gcc\arm-none-eabi\12.2.0\temp\v7e-m+dp"
rmdir /S /Q "Heavy\usr\lib\gcc\arm-none-eabi\12.2.0\thumb"
rename "Heavy\usr\lib\gcc\arm-none-eabi\12.2.0\temp" "thumb"

del /S /Q ".\Heavy\arm-none-eabi\lib\arm"
del /S /Q ".\Heavy\usr\arm-none-eabi\lib\arm"

:: Pre-build libdaisy
cd libDaisy
Expand All @@ -37,7 +27,8 @@ echo ../Heavy/bin/make.exe GCC_PATH=../Heavy/bin> build.sh
..\Heavy\bin\sh.exe --login build.sh
cd ..

xcopy /E /H /C /I libDaisy Heavy\lib\libDaisy
xcopy /E /H /C /I libDaisy Heavy\usr\lib\libDaisy
xcopy /E /H /C /I DPF Heavy\usr\lib\dpf

:: Package heavy using pyinstaller
python -m ensurepip
Expand All @@ -49,7 +40,7 @@ FOR /F "tokens=*" %%g IN ('python -m site --user-site') do (SET PYTHON_SITE=%%g)
python resources\run_pyinstaller.py -n Heavy --noconfirm --windowed --paths %PYTHON_SITE% .\hvcc\hvcc\__init__.py --collect-data json2daisy --add-data=".\hvcc\hvcc\generators;.\generators" --add-data=".\hvcc\hvcc\core;.\hvcc\core" --add-data=".\hvcc\hvcc\generators;.\hvcc\generators" --add-data=".\hvcc\hvcc\interpreters;.\hvcc\interpreters"

copy .\dist\Heavy\json2daisy\resources\component_defs.json .\dist\Heavy\json2daisy\resources\seed.json
move .\dist\Heavy .\Heavy\bin\
move .\dist\Heavy .\Heavy\usr\bin\

del /s /q .\dist\*
del /s /q .\build\*
Expand Down
84 changes: 54 additions & 30 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,45 +11,52 @@ else
URL="https://developer.arm.com/-/media/Files/downloads/gnu/12.2.mpacbti-bet1/binrel/arm-gnu-toolchain-12.2.mpacbti-bet1-x86_64-arm-none-eabi.tar.xz"
fi

echo "Downloading arm-none-eabi-gcc"
curl -fSL -A "Mozilla/4.0" -o gcc-arm-none-eabi.tar.xz $URL

echo "Extracting..."
mkdir tmp
pushd tmp
mkdir gcc-arm-none-eabi
pushd gcc-arm-none-eabi
tar -xf ../gcc-arm-none-eabi.tar.xz
popd
rm gcc-arm-none-eabi.tar.xz

mkdir Heavy
cp -rf tmp/arm-gnu-*/bin ./Heavy
cp -rf tmp/arm-gnu-*/lib ./Heavy
cp -rf tmp/arm-gnu-*/libexec ./Heavy
cp -rf tmp/arm-gnu-*/share ./Heavy
cp -rf tmp/arm-gnu-*/include ./Heavy
cp -rf tmp/arm-gnu-*/arm-none-eabi ./Heavy
cp -rf gcc-arm-none-eabi/arm-gnu-*/bin ./Heavy
cp -rf gcc-arm-none-eabi/arm-gnu-*/lib ./Heavy
cp -rf gcc-arm-none-eabi/arm-gnu-*/libexec ./Heavy
cp -rf gcc-arm-none-eabi/arm-gnu-*/share ./Heavy
cp -rf gcc-arm-none-eabi/arm-gnu-*/include ./Heavy
cp -rf gcc-arm-none-eabi/arm-gnu-*/arm-none-eabi ./Heavy

if [[ "$OSTYPE" == "darwin"* ]]; then
#curl -fSL -A "Mozilla/4.0" -o homebrew.zip https://github.com/Homebrew/brew/archive/refs/tags/3.6.13.zip
#unzip homebrew.zip
#mv brew-3.6.13 homebrew
#./homebrew/bin/brew install llvm
#cp -rf ./homebrew/bin/* ./Heavy/bin
#cp -rf ./homebrew/lib/* ./Heavy/lib
#cp -rf ./homebrew/Cellar ./Heavy/Cellar
echo "do nothing for now"
else
if [[ "$OSTYPE" == "linux-gnu"* ]]; then

git clone https://github.com/minos-org/minos-static.git
./minos-static/static-get -x gcc
echo $(ls)
cp -rf ./gcc-*/usr/bin/* ./Heavy/bin/
cp -rf ./gcc-*/usr/lib/* ./Heavy/lib/
cp -rf ./gcc-*/usr/libexec/* ./Heavy/libexec/
cp -rf ./gcc-*/usr/share/* ./Heavy/share/
cp -rf ./gcc-*/usr/include/* ./Heavy/include/
fi
curl -fSL -A "Mozilla/4.0" -o x86_64-anywhere-linux-gnu-v5.tar.xz https://github.com/theopolis/build-anywhere/releases/download/v5/x86_64-anywhere-linux-gnu-v5.tar.xz

mkdir build-anywhere
pushd build-anywhere
tar -xf ../x86_64-anywhere-linux-gnu-v5.tar.xz

pushd x86_64-anywhere-linux-gnu
# Fix: use gcc instead of clang, for compactness
rm -rf ./x86_64-anywhere-linux-gnu/sysroot/usr/include/llvm
rm -rf ./x86_64-anywhere-linux-gnu/sysroot/usr/share/clang
rm -rf ./x86_64-anywhere-linux-gnu/sysroot/usr/lib/libclang
rm -rf ./x86_64-anywhere-linux-gnu/sysroot/usr/lib/cmake/llvm
rm -rf ./x86_64-anywhere-linux-gnu/sysroot/usr/lib/cmake/clang
rm -rf ./x86_64-anywhere-linux-gnu/sysroot/usr/lib/clang
rm -rf ./x86_64-anywhere-linux-gnu/sysroot/usr/bin/llvm-cov
rm -rf ./x86_64-anywhere-linux-gnu/sysroot/usr/bin/llvm-*
rm -rf ./x86_64-anywhere-linux-gnu/sysroot/usr/bin/clang-*
rm ./x86_64-anywhere-linux-gnu/sysroot/usr/lib/libclang.so.8
rm ./x86_64-anywhere-linux-gnu/sysroot/usr/lib/libLLVM-8.so
rm ./x86_64-anywhere-linux-gnu/sysroot/usr/bin/git-clang-format
cp ../../resources/anywhere-setup.sh ./scripts/anywhere-setup.sh

popd
popd

rsync -a ./build-anywhere/x86_64-anywhere-linux-gnu/ ./Heavy/
fi

# Reduce package size by only including the daisy platform tools
mkdir -p "./Heavy/arm-none-eabi/lib/temp/"
Expand All @@ -71,8 +78,23 @@ cp -rf ./resources/heavy-static.a ./Heavy/lib/heavy-static.a
cp -rf ./resources/daisy_makefile ./Heavy/etc/daisy_makefile
cp -rf ./resources/*.lds ./Heavy/etc/linkers

# install an old version of dfu-util for compatibility
TEMP_DEB="$(mktemp)"
wget -O "$TEMP_DEB" 'http://ftp.de.debian.org/debian/pool/main/d/dfu-util/dfu-util_0.9-1_amd64.deb'
sudo dpkg -i "$TEMP_DEB"
rm -f "$TEMP_DEB"

TEMP_DEB2="$(mktemp)"
wget -O "$TEMP_DEB2" 'http://ftp.de.debian.org/debian/pool/main/a/alsa-lib/libasound2_1.1.3-5_amd64.deb'
ar x "$TEMP_DEB2"
tar xvf data.tar.xz
cp ./usr/lib/x86_64-linux-gnu/libasound.so.2.0.0 ./Heavy/x86_64-anywhere-linux-gnu/sysroot/lib/libasound.so


# copy dfu-util
cp $(which dfu-util) ./Heavy/bin/dfu-util
cp $(which dfu-prefix) ./Heavy/bin/dfu-prefix
cp $(which dfu-suffix) ./Heavy/bin/dfu-suffix

if [[ "$OSTYPE" == "linux-gnu"* ]]; then
cp "$(ldconfig -p | grep libusb-1.0.so | tr ' ' '\n' | grep /)" ./Heavy/lib/libusb-1.0.so
Expand All @@ -90,10 +112,12 @@ fi
curl -fSL -A "Mozilla/4.0" -o make-4.4.tar.gz https://ftp.gnu.org/gnu/make/make-4.4.tar.gz
tar -xf make-4.4.tar.gz
pushd make-4.4

chmod +x ./build.sh
chmod +x ./configure

# Hack: make sure libintl is not found on macOS, when building on Github actions server!

# Hack: make sure libintl is not found on macOS when building on Github actions server!
if [[ "$CLEAR_INTL" == "1" ]]; then
rm -f /usr/local/opt/gettext/lib/libintl*.dylib
fi
Expand All @@ -110,7 +134,7 @@ make GCC_PATH=../Heavy/bin/
popd

cp -rf ./libDaisy ./Heavy/lib/libDaisy
cp -rf ./DPF ./Heavy/lib/DPF
cp -rf ./DPF ./Heavy/lib/dpf

# Package Heavy with pyinstaller
python3 -m ensurepip
Expand Down
3 changes: 3 additions & 0 deletions resources/minGW.zip
Git LFS file not shown

0 comments on commit 1b32d5a

Please sign in to comment.