Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/2.3' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
Be-ing committed Dec 17, 2020
2 parents 648bc1d + e80ce44 commit b884f4f
Show file tree
Hide file tree
Showing 6 changed files with 254 additions and 70 deletions.
20 changes: 14 additions & 6 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,12 @@ jobs:

- name: "[Windows] Install additional build tools"
if: runner.os == 'Windows'
run: python -m pip install ninja git+https://github.com/frerich/clcache.git
# TODO: Add ninja, clcache and rsync to the windows buildenv
run: |
python -m pip install ninja git+https://github.com/frerich/clcache.git
$Env:PATH="C:\msys64\usr\bin;$Env:PATH"
pacman -S --noconfirm coreutils bash rsync openssh
Add-Content -Path "$Env:GITHUB_ENV" -Value "PATH=$Env:PATH"
- name: "[Windows] Set up MSVC Developer Command Prompt"
if: runner.os == 'Windows'
Expand Down Expand Up @@ -265,15 +270,18 @@ jobs:
run: signtool sign /f $Env:WINDOWS_CODESIGN_CERTIFICATE_PATH /p $Env:WINDOWS_CODESIGN_CERTIFICATE_PASSWORD *.msi
working-directory: build

- name: "[macOS] Upload build to downloads.mixxx.org"
- name: "[macOS/Windows] Upload build to downloads.mixxx.org"
# skip deploying Ubuntu builds to downloads.mixxx.org because these are deployed to the PPA
if: runner.os == 'macOS' && env.DOWNLOADS_HOSTGATOR_DOT_MIXXX_DOT_ORG_KEY_PASSWORD != null
run: tools/deploy.sh
if: runner.os != 'Linux' && github.event_name == 'push' && env.SSH_PASSWORD != null
run: bash tools/deploy.sh ${{ matrix.artifacts_path }}
env:
FILE_TO_DEPLOY: ${{ matrix.artifacts_path }}
DESTDIR: public_html/downloads/builds
OS: ${{ runner.os }}
DOWNLOADS_HOSTGATOR_DOT_MIXXX_DOT_ORG_KEY_PASSWORD: ${{ secrets.DOWNLOADS_HOSTGATOR_DOT_MIXXX_DOT_ORG_KEY_PASSWORD }}
SSH_HOST: downloads-hostgator.mixxx.org
SSH_KEY: packaging/certificates/downloads-hostgator.mixxx.org.key
SSH_PASSWORD: ${{ secrets.DOWNLOADS_HOSTGATOR_DOT_MIXXX_DOT_ORG_KEY_PASSWORD }}
SSH_USER: mixxx
UPLOAD_ID: ${{ github.run_id }}

- name: "Upload GitHub Actions artifacts"
uses: actions/upload-artifact@v2
Expand Down
10 changes: 10 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,13 @@ compile_commands.json

# Exclude buildenv directory from our helper scripts
/buildenv/

# CMake build configurations, generated by tools/windows_buildenv.bat
CMakeSettings.json

# Build and distribution directories for various build configurations
/build/
/install/

# VisualStudio project files
/.vs/
48 changes: 35 additions & 13 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,17 @@ endif()
#
set(OPTIMIZE "portable" CACHE STRING "Optimization and Tuning (set to off, portable, native, legacy, fastbuild)")
message(STATUS "Optimization level: ${OPTIMIZE}")
if(NOT OPTIMIZE STREQUAL "off")
if(MSVC)

if(MSVC)
# Microsoft Visual Studio Compiler
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
# Target architecture is x64 -> x64 has alsways SSE and SSE2 instruction sets
message(STATUS "x64 Enabling SS2 CPU optimizations (>= Pentium 4)")
# Define gcc/clang style defines for SSE and SSE2 for compatibility
add_compile_definitions("__SSE__" "__SSE2__")
endif()

if(NOT OPTIMIZE STREQUAL "off")
# Use the fastest floating point math library
# http://msdn.microsoft.com/en-us/library/e7s85ffb.aspx
# http://msdn.microsoft.com/en-us/library/ms235601.aspx
Expand All @@ -97,10 +106,6 @@ if(NOT OPTIMIZE STREQUAL "off")
add_compile_options(/Gy)
add_link_options(/OPT:REF /OPT:ICF)

# Don't worry about aligning code on 4KB boundaries
# ALBERT: NOWIN98 is not supported in MSVC 2010.
#add_link_options(mixxx-lib PUBLIC "/OPT:NOWIN98")

# http://msdn.microsoft.com/en-us/library/59a3b321.aspx
# In general, you should pick /O2 over /Ox
add_compile_options($<$<NOT:$<CONFIG:Debug>>:/O2>)
Expand Down Expand Up @@ -130,22 +135,39 @@ if(NOT OPTIMIZE STREQUAL "off")
endif()

if(OPTIMIZE STREQUAL "portable" OR OPTIMIZE STREQUAL "fastbuild")
message(STATUS "Enabling SS2 CPU optimizations (>= Pentium 4)")
# SSE and SSE2 are core instructions on x64
# and consequently raise a warning message from compiler with this flag on x64.
if(NOT CMAKE_SIZEOF_VOID_P EQUAL 8)
# Target architecture is x86 with SSE and SSE2
message(STATUS "x86 Enabling SS2 CPU optimizations (>= Pentium 4)")
# Define gcc/clang style defines for SSE and SSE2 for compatibility
add_compile_definitions("__SSE__" "__SSE2__")
# Set compiler option for SSE/SSE2
add_compile_options(/arch:SSE2)
endif()
add_compile_definitions("__SSE__" "__SSE2__")
elseif(OPTIMIZE STREQUAL "native")
message("Enabling native optimizations for ${CMAKE_SYSTEM_PROCESSOR}")
message("Enabling optimizations for native system, specified by user")
if(NOT CMAKE_SIZEOF_VOID_P EQUAL 8)
# Target architecture is x86 with SSE and SSE2
message(STATUS "x86 Enabling SS2 CPU optimizations (>= Pentium 4)")
# Define gcc/clang style defines for SSE and SSE2 for compatibility
add_compile_definitions("__SSE__" "__SSE2__")
endif()
# Define the target processor instruction and other compiler optimization flags here:
# https://docs.microsoft.com/en-us/cpp/build/reference/arch-x64?view=msvc-160
# add_compile_options(/arch:AVX512)
message(FATAL_ERROR "User need to set the MSVC compiler flags for the native processor here!")
add_compile_options("/favor:${CMAKE_SYSTEM_PROCESSOR}")
elseif(OPTIMIZE STREQUAL "legacy")
message("Enabling pure i386 code")
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
message("Enabling pure x64 instruction set (without AVX etc.)")
else()
message("Enabling pure i386 instruction set (without SSE/SSE2 etc.)")
endif()
else()
message(FATAL_ERROR "Invalid value passed to OPTIMIZE option: ${OPTIMIZE}")
endif()
elseif(GNU_GCC OR LLVM_CLANG)
endif()
elseif(GNU_GCC OR LLVM_CLANG)
if(NOT OPTIMIZE STREQUAL "off")
# Common flags to all optimizations.
# -ffast-math will prevent a performance penalty by denormals
# (floating point values almost Zero are treated as Zero)
Expand Down
53 changes: 36 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,24 +31,42 @@ Have a bug or feature request? [File a bug on Launchpad][fileabug].
Want to get involved in Mixxx development? Assign yourself a bug from the [easy
bug list][easybugs] and get started!

## Compiling

* macOS [![Build Status](https://travis-ci.org/mixxxdj/mixxx.svg)](https://travis-ci.org/mixxxdj/mixxx)
* Ubuntu / Windows [![Build status](https://ci.appveyor.com/api/projects/status/j460rficblcaopwx?svg=true)](https://ci.appveyor.com/project/mixxxdj/mixxx)
* Jenkins [![Build status](https://img.shields.io/jenkins/s/https/builds.mixxx.org/job/master-release.svg)](https://builds.mixxx.org/job/master-release)

First, you must install all of Mixxx's dependencies. To compile Mixxx using
[CMake], run:

## Compiling on Linux
$ mkdir build
$ cd build
$ cmake ..
$ cmake --build .
Please see our helpful guide on the [wiki] for more information: [Compiling on Linux]

Please see our helpful guides on the [wiki] for more information:
- [Compiling on Linux]
- [Compiling on macOS]
- [Compiling on Windows]
## Compiling on MacOS
$ mkdir build
$ cd build
$ cmake ..
$ cmake --build .
Please see our helpful guide on the [wiki] for more information: [Compiling on MacOS]

## Compiling on Windows
### Build Requirements
- Windows 7 or later
- MS Visual Studio 2019 (Community Edition is free of charge)
- At least 10G free diskspace
- To create an .msi installer, you need to install the WiX toolkit from https://wixtoolset.org/releases/
### Setup your build environment
1. Download these sources (using git checkout as described in [Using Git])
2. Run the batch file `tools\windows_buildenv.bat`
- This file downloads the prebuild Mixxx environment, defined in `cmake\windows_build_environment_name` from https://downloads.mixxx.org/builds/buildserver/2.3.x-windows/
- Generates the `CMakeSettings.json` with the matching build configurations for Visual Studio
3. Start Visual Studio, choose "Open a local folder" select the `mixxx` directory containing `CMakeSettings.json`
4. Menu "Project" -> "Generate Cache for mixxx"
5. Select the build configuration in the toolbar (`x64__fastbuild` is recommended)
6. Menu "Build" -> "Build All"
### Creating an .msi installer (optional)
7. Than open the Visual Studio 'Developer Command Prompt' by Menu -> "Tools" -> "Command line" -> "Developer Command Prompt"
8. Go to your build directory, e.g. by "cd .\build\x64-fastbuild"
9. Run "cpack -G WIX"


Please see also our helpful guide on the [wiki] for more information: [Compiling on Windows]

## Documentation

Expand Down Expand Up @@ -94,12 +112,13 @@ license.
[facebook]: https://www.facebook.com/pages/Mixxx-DJ-Software/21723485212
[blog]: https://mixxxblog.blogspot.com
[manual]: https://www.mixxx.org/manual/latest/
[wiki]: https://www.mixxx.org/wiki/
[wiki]: https://github.com/mixxxdj/mixxx/wiki
[faq]: https://mixxx.org/wiki/doku.php/faq
[forums]: https://www.mixxx.org/forums/
[compiling on linux]: https://mixxx.org/wiki/doku.php/compiling_on_linux
[compiling on macOS]: https://mixxx.org/wiki/doku.php/compiling_on_os_x
[compiling on windows]: https://mixxx.org/wiki/doku.php/compiling_on_windows
[Compiling on Linux]: https://github.com/mixxxdj/mixxx/wiki/Compiling%20on%20Linux
[Compiling on MacOS]: https://github.com/mixxxdj/mixxx/wiki/Compiling%20on%20macOS
[Compiling on Windows]: https://github.com/mixxxdj/mixxx/wiki/compiling-on-windows
[Using Git]: https://github.com/mixxxdj/mixxx/wiki/Using-Git
[mailing list]: https://lists.sourceforge.net/lists/listinfo/mixxx-devel
[CMake]: https://cmake.org/
[launchpad 2.3.0]: https://launchpad.net/mixxx/+milestone/2.3.0
Expand Down
81 changes: 54 additions & 27 deletions tools/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,37 +4,64 @@

set -eu -o pipefail

USER=mixxx
HOSTNAME=downloads-hostgator.mixxx.org
DESTDIR=public_html/downloads/builds
[ -z "${SSH_HOST}" ] && echo "Please set the SSH_HOST env var." >&2 && exit 1
[ -z "${SSH_KEY}" ] && echo "Please set the SSH_KEY env var." >&2 && exit 1
[ -z "${SSH_PASSWORD}" ] && echo "Please set the SSH_PASSWORD env var." >&2 && exit 1
[ -z "${SSH_USER}" ] && echo "Please set the SSH_USER env var." >&2 && exit 1
[ -z "${UPLOAD_ID}" ] && echo "Please set the UPLOAD_ID env var." >&2 && exit 1
[ -z "${OS}" ] && echo "Please set the OS env var." >&2 && exit 1
[ -z "${DESTDIR}" ] && echo "Please set the DESTDIR env var." >&2 && exit 1

SSH="ssh -i ${SSH_KEY} -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null"
GIT_BRANCH=$(git rev-parse --abbrev-ref HEAD)
DEST_PATH=${DESTDIR}/${GIT_BRANCH}/${OS}
TMP_PATH=${DESTDIR}/.tmp/${GIT_BRANCH}/${OS}
GIT_BRANCH="$(git rev-parse --abbrev-ref HEAD)"
DEST_PATH="${DESTDIR}/${GIT_BRANCH}/${OS}"
TMP_PATH="${DESTDIR}/.tmp/${UPLOAD_ID}"

echo "Deploying to $TMP_PATH, then to $DEST_PATH."

# Remove permissions for group and other users so that ssh-keygen does not
# complain about the key not being protected.
chmod go-rwx ${SSH_KEY}

# "Unlock" the key by removing its password. This is easier than messing with ssh-agent.
ssh-keygen -p -P ${DOWNLOADS_HOSTGATOR_DOT_MIXXX_DOT_ORG_KEY_PASSWORD} -N "" -f ${SSH_KEY}

# Always upload to a temporary path.
# This prevents users from downloading an incomplete file from the server which has not yet finished deploying.
shopt -s extglob
rsync -e "${SSH}" --rsync-path="mkdir -p ${TMP_PATH} && rsync" -r --delete-after ${FILE_TO_DEPLOY} ${USER}@${HOSTNAME}:${TMP_PATH}

FILE_NAME=$(basename $FILE_TO_DEPLOY)
FILE_EXTENSION="${FILE_NAME##*.}"
SYMLINK_NAME="Mixxx-${GIT_BRANCH}-latest.${FILE_EXTENSION}"

# Move from the temporary path to the final destination.
$SSH ${USER}@${HOSTNAME} << EOF
mkdir -p ${DEST_PATH} &&
mv ${TMP_PATH}/* ${DEST_PATH} &&
rmdir ${TMP_PATH} &&
cd ${DEST_PATH} &&
ln -sf ${FILE_NAME} ${SYMLINK_NAME}
chmod go-rwx "${SSH_KEY}"

# Unlock the key by removing its password. This is easier than messing with ssh-agent.
ssh-keygen -p -P "${SSH_PASSWORD}" -N "" -f "${SSH_KEY}"

# realpath does not exist on macOS
command -v realpath >/dev/null 2>&1 || realpath() {
[[ "$1" = /* ]] && echo "$1" || echo "${PWD}/${1#./}"
}

# sha256sum doesn't exist on Windows (Git Bash) or macOS
command -v sha256sum >/dev/null 2>&1 || sha256sum() {
openssl dgst -sha256 "$@" | sed 's/^SHA256(\(.*\))= \(\w\+\)$/\2 \1/'
}

for FILEPATH in "$@"
do
# Always upload to a temporary path.
# This prevents users from downloading an incomplete file from the server which has not yet finished deploying.
echo "Deploying artifact: ${FILEPATH}"
FILENAME="$(basename "${FILEPATH}")"
FILENAME_HASH="${FILENAME}.sha256sum"
FILEPATH_HASH="${FILEPATH}.sha256sum"

# There should be no path components in the shasum file, so we need to cd to it first.
pushd "$(dirname "$(realpath "${FILEPATH}")")"
sha256sum "${FILENAME}" > "${FILENAME_HASH}"
popd

FILEEXT="${FILENAME##*.}"
SYMLINK_NAME="Mixxx-${GIT_BRANCH}-latest.${FILEEXT}"

rsync -e "${SSH}" --rsync-path="mkdir -p ${TMP_PATH} && rsync" -r --delete-after "${FILEPATH}" "${FILEPATH_HASH}" "${SSH_USER}@${SSH_HOST}:${TMP_PATH}"

# Move from the temporary path to the final destination.
${SSH} "${SSH_USER}@${SSH_HOST}" << EOF
trap 'rm -rf "${TMP_PATH}"' EXIT
mkdir -p "${DEST_PATH}" &&
mv "${TMP_PATH}/${FILENAME}" "${TMP_PATH}/${FILENAME_HASH}" "${DEST_PATH}" &&
cd "${DEST_PATH}" &&
ln -sf "${FILENAME_HASH}" "${SYMLINK_NAME}.sha256sum" &&
ln -sf "${FILENAME}" "${SYMLINK_NAME}"
EOF
done
Loading

0 comments on commit b884f4f

Please sign in to comment.