fix packaging scripts

This commit is contained in:
otavepto 2024-06-02 20:11:18 +03:00
parent b09ddad7c7
commit c789f4d078
4 changed files with 54 additions and 25 deletions

View File

@ -50,6 +50,21 @@ jobs:
pattern: emu-win-*-${{ github.sha }}
merge-multiple: true
### print files
- name: Print files
shell: cmd
working-directory: ${{ github.workspace }}
run: |
dir /s /b /a:-d build\win
### remove linker files
- name: Remove linker files
shell: cmd
working-directory: ${{ github.workspace }}
run: |
del /f /s /q build\win\*.exp,build\win\*.lib
exit /b 0
### package (release mode)
- name: Package build (release)
shell: cmd
@ -116,17 +131,32 @@ jobs:
working-directory: ${{ github.workspace }}
run: sudo chmod -R 777 "${{ github.workspace }}" && sudo chmod 777 package_linux.sh
### print files
- name: Print files
shell: bash
working-directory: ${{ github.workspace }}
run: |
ls -la build/linux/*/*
### downlaod ubuntu packages
- name: Download required Ubuntu packages
shell: bash
working-directory: ${{ github.workspace }}
run: |
sudo apt update || exit 1
sudo apt install tar -y || exit 1
### package (release mode)
- name: Package build (release)
shell: bash
working-directory: ${{ github.workspace }}
run: sudo ./package_linux.sh gmake2/release
run: ./package_linux.sh gmake2/release
### package (debug mode)
- name: Package build (debug)
shell: bash
working-directory: ${{ github.workspace }}
run: sudo ./package_linux.sh gmake2/debug
run: ./package_linux.sh gmake2/debug
### release (debug + release modes) if this is a tag push
- name: Release

View File

@ -325,13 +325,13 @@ Open CMD in the repos's directory, then run this script
```batch
package_win.bat <build_folder>
```
`build_folder` is any folder inside `build\win`, for example: `release`
The above example will create a `.7z` archive inside `build\package\win\release`
`build_folder` is any folder inside `build\win`, for example: `vs2022\release`
The above example will create a `.7z` archive inside `build\package\win\`
### On Linux:
Open bash terminal in the repos's directory, then run this script
```shell
package_linux.sh <build_folder>
```
`build_folder` is any folder inside `build/linux`, for example: `release`
The above example will create a compressed `.tar` archive inside `build/package/linux/release`
`build_folder` is any folder inside `build/linux`, for example: `gmake2/release`
The above example will create a compressed `.tar` archive inside `build/package/linux/`

View File

@ -10,21 +10,13 @@ script_dir=$( cd -- "$( dirname -- "${0}" )" &> /dev/null && pwd )
exit 1;
}
if [ "$(id -u)" -ne 0 ]; then
echo "Please run as root" >&2
exit 1
fi
[[ -d "$script_dir/$build_base_dir/$1" ]] || {
target_src_dir="$script_dir/$build_base_dir/$1"
[[ -d "$target_src_dir" ]] || {
echo "[X] build folder wasn't found";
exit 1;
}
apt update || exit 1
apt install tar -y || exit 1
mkdir -p "$script_dir/$out_dir/$1"
archive_file="$script_dir/$out_dir/$1/emu-linux-$1.tar.bz2"
[[ -f "$archive_file" ]] && rm -f "$archive_file"
tar -C "$script_dir/$build_base_dir" -c -j -vf "$archive_file" "$1"
mkdir -p "$(dirname "$archive_file")"
tar -C "$(dirname "$target_src_dir")" -c -j -vf "$archive_file" "$(basename "$target_src_dir")"

View File

@ -13,9 +13,11 @@ set /a DICT_SIZE_MB=384
set "packager=third-party\deps\win\7za\7za.exe"
:: use 70%
set /a THREAD_COUNT=2
if defined NUMBER_OF_PROCESSORS (
set /a THREAD_COUNT=NUMBER_OF_PROCESSORS*70/100
) else (
)
if %THREAD_COUNT% lss 2 (
set /a THREAD_COUNT=2
)
@ -31,20 +33,25 @@ if "%~1"=="" (
goto :script_end
)
if not exist "%build_base_dir%\%~1" (
set "target_src_dir=%build_base_dir%\%~1"
if not exist "%target_src_dir%" (
1>&2 echo [X] build folder wasn't found
set /a last_code=1
goto :script_end
)
mkdir "%out_dir%\%~1"
set "archive_file=%out_dir%\%~1\emu-win-%~1.7z"
if exist "%archive_file%" (
del /f /q "%archive_file%"
del /f /q "%archive_file%"
)
"%packager%" a "%archive_file%" ".\%build_base_dir%\%~1" -t7z -slp -ssw -mx -myx -mmemuse=p%MEM_PERCENT% -ms=on -mqs=off -mf=on -mhc+ -mhe- -m0=LZMA2:d=%DICT_SIZE_MB%m -mmt=%THREAD_COUNT% -mmtf+ -mtm- -mtc- -mta- -mtr+
set "archive_file_dirname="
set "archive_file_basename="
for %%A in ("%archive_file%") do (
set "archive_file_dirname=%%~dpA"
set "archive_file_basename=%%~nxA"
)
mkdir "%archive_file_dirname%"
"%packager%" a "%archive_file%" ".\%target_src_dir%" -t7z -slp -ssw -mx -myx -mmemuse=p%MEM_PERCENT% -ms=on -mqs=off -mf=on -mhc+ -mhe- -m0=LZMA2:d=%DICT_SIZE_MB%m -mmt=%THREAD_COUNT% -mmtf+ -mtm- -mtc- -mta- -mtr+
:script_end