diff options
author | daid <daid303@gmail.com> | 2015-01-14 18:33:34 +0300 |
---|---|---|
committer | daid <daid303@gmail.com> | 2015-01-14 18:33:34 +0300 |
commit | e8d361b03633d6b9514af0142e614b705aacb03a (patch) | |
tree | 844574fc57241e07c257df83ba451b5e19ef4933 | |
parent | a8e864aa5bc9e98ab648d217a67d36fd5440ddd9 (diff) | |
parent | 7e3c32666fd9624e304765b0ed0923eb90e31d7f (diff) |
Merge pull request #1086 from fhuberts/fedora15.01-RC8
package.sh: add fedora
-rw-r--r-- | README.md | 54 | ||||
-rwxr-xr-x | package.sh | 130 | ||||
-rw-r--r-- | scripts/linux/fedora/.gitignore | 2 | ||||
-rw-r--r-- | scripts/linux/fedora/rpm.spec | 82 | ||||
-rwxr-xr-x | scripts/linux/fedora/usr/bin/cura | 2 | ||||
-rw-r--r-- | scripts/linux/fedora/usr/share/.gitignore | 1 | ||||
-rwxr-xr-x | scripts/linux/fedora/usr/share/applications/cura.desktop | 10 |
7 files changed, 281 insertions, 0 deletions
@@ -26,6 +26,60 @@ The "package.sh" script generates a final release package. You should not need i Both MacOS and Linux require some extra instructions for development, as you need to prepare an environment. Look below at the proper section to see what is needed.
+Fedora
+--------
+
+Fedora builds Cura by using ```mock```, thereby enabling it to build RPMs for
+every distribution that ```mock``` has a configuration file for. In pratice
+this means that Fedora can build RPMs for several versions of Fedora, CentOS
+and RHEL.
+
+Cura can be built under a regular user account, there is no need to have root
+privileges. In fact, having root privileges is very much discouraged.
+
+However, the user account under which the build is performed needs to be a
+member of the 'mock' group. This is accomplished as follows:
+
+```bash
+sudo usermod -a -G mock "$(whoami)"
+```
+
+To install the software that is required to build Cura, run the following
+commands:
+
+```bash
+sudo yum install -y git rpmdevtools rpm-build mock arduino
+
+# Ensure that the Arduino tools can be found by the build
+sudo mkdir -p /usr/share/arduino/hardware/tools/avr
+sudo ln -sf /usr/bin /usr/share/arduino/hardware/tools/avr/bin
+
+```
+
+To build and install Cura, run the following commands:
+
+```bash
+# Get the Cura software, only required once
+git clone https://github.com/daid/Cura.git Cura
+
+# Build for the current system
+cd Cura
+./package.sh fedora
+
+# Install on the current system
+sudo yum localinstall -y scripts/linux/fedora/RPMS/Cura-*.rpm
+```
+
+Examples of building other configurations:
+
+```bash
+# Build for Fedora rawhide x86-64 and i386
+./package.sh fedora fedora-rawhide-x86_64.cfg fedora-rawhide-i386.cfg
+
+# Since only the basename of the mock configurations is used, this also works:
+./package.sh fedora /etc/mock/fedora-21-x86_64.cfg /etc/mock/fedora-rawhide-i386.cfg
+```
+
Debian and Ubuntu Linux
--------
diff --git a/package.sh b/package.sh index 7c970264bb..d492947e1d 100755 --- a/package.sh +++ b/package.sh @@ -95,6 +95,8 @@ if [ "$BUILD_TARGET" = "none" ]; then echo "$0 debian_armhf" echo "$0 darwin" echo "$0 freebsd" + echo "$0 fedora # current system" + echo "$0 fedora \"mock_config_file\" ... # different system(s)" exit 0 fi @@ -144,6 +146,7 @@ if [ ! -d "$ARDUINO_PATH" ]; then exit 1 fi + #Build the Ultimaker Original firmwares. gitClone git@github.com:Ultimaker/Marlin.git _UltimakerMarlin cd _UltimakerMarlin/Marlin @@ -380,6 +383,133 @@ if [ "$BUILD_TARGET" = "debian_armhf" ]; then fi ############################# +# Fedora Generic +############################# + +function sanitiseVersion() { + local _version="$1" + echo "${_version//-/.}" +} + +function fedoraCreateSRPM() { + local _curaName="$1" + local _version="$(sanitiseVersion "$2")" + local _srcSpecFile="$3" + local _srcSpecFileRelease="$4" + local _dstSrpmDir="$5" + + local _dstTarSources="$HOME/rpmbuild/SOURCES/$_curaName-$_version.tar.gz" + local _dstSpec="$HOME/rpmbuild/SPECS/$_curaName-$_version.spec" + + local _namePower="Power" + local _nameCuraEngine="CuraEngine" + + gitClone "https://github.com/GreatFruitOmsk/Power" "$_namePower" + gitClone "$CURA_ENGINE_REPO" "$_nameCuraEngine" + + cd "$_namePower" + local _gitPower="$(git rev-list -1 HEAD)" + cd - + + cd "$_nameCuraEngine" + local _gitCuraEngine="$(git rev-list -1 HEAD)" + cd - + + local _gitCura="$(git rev-list -1 HEAD)" + + rpmdev-setuptree + + rm -fv "$_dstTarSources" + tar \ + --exclude-vcs \ + --transform "s#^#$_curaName-$_version/#" \ + -zcvf "$_dstTarSources" \ + "$_nameCuraEngine" \ + "$_namePower" \ + Cura \ + resources \ + plugins \ + scripts/linux/cura.py \ + scripts/linux/fedora/usr + + sed \ + -e "s#__curaName__#$_curaName#" \ + -e "s#__version__#$_version#" \ + -e "s#__gitCura__#$_gitCura#" \ + -e "s#__gitCuraEngine__#$_gitCuraEngine#" \ + -e "s#__gitPower__#$_gitPower#" \ + -e "s#__basedir__#scripts/linux/fedora#" \ + "$_srcSpecFile" \ + > "$_dstSpec" + + rpmbuild -bs "$_dstSpec" + + mkdir -pv "$_dstSrpmDir" + cp -v \ + "$HOME/rpmbuild/SRPMS/$_curaName-$_version-$_srcSpecFileRelease.src.rpm" \ + "$_dstSrpmDir" +} + +function buildFedora() { + local _nameForRpm="Cura" + local _versionForRpm="$(sanitiseVersion "$BUILD_NAME")" + + # + # SRPM + # + + local _srcSpecFile="scripts/linux/fedora/rpm.spec" + local _srcSpecFileRelease="$(rpmspec -P "$_srcSpecFile" | grep -E '^Release:'|awk '{print $NF}')" + local _dstSrpmDir="scripts/linux/fedora/SRPMS" + + fedoraCreateSRPM \ + "$_nameForRpm" \ + "$_versionForRpm" \ + "$_srcSpecFile" \ + "$_srcSpecFileRelease" \ + "$_dstSrpmDir" + + # + # RPM + # + + local _srpmFile="$_dstSrpmDir/$_nameForRpm-$_versionForRpm-$_srcSpecFileRelease.src.rpm" + local _dstRpmDir="scripts/linux/fedora/RPMS" + + while [ $# -ne 0 ]; do + local _mockRelease="$(basename "${1%\.cfg}")" + local _mockReleaseArg="" + if [ -n "$_mockRelease" ]; then + _mockReleaseArg="-r $_mockRelease" + fi + + mkdir -pv "$_dstRpmDir/$_mockRelease" + mock \ + $_mockReleaseArg \ + --resultdir="$_dstRpmDir/$_mockRelease" \ + "$_srpmFile" + + shift 1 + done +} + +############################# +# Fedora RPMs +############################# + +if [ "$BUILD_TARGET" = "fedora" ]; then + shift 1 # skip "fedora" arg + + if [ $# -eq 0 ]; then + "$0" "$BUILD_TARGET" "" + else + buildFedora "${@}" + fi + + exit +fi + +############################# # Rest ############################# diff --git a/scripts/linux/fedora/.gitignore b/scripts/linux/fedora/.gitignore new file mode 100644 index 0000000000..ea03173056 --- /dev/null +++ b/scripts/linux/fedora/.gitignore @@ -0,0 +1,2 @@ +/RPMS/ +/SRPMS/ diff --git a/scripts/linux/fedora/rpm.spec b/scripts/linux/fedora/rpm.spec new file mode 100644 index 0000000000..230aebf4c0 --- /dev/null +++ b/scripts/linux/fedora/rpm.spec @@ -0,0 +1,82 @@ +%global _curaName __curaName__ +%global _baseDir __basedir__ +%global _version __version__ +%global _gitCura __gitCura__ +%global _gitCuraEngine __gitCuraEngine__ +%global _gitPower __gitPower__ + + +Name: %{_curaName} +Version: %{_version} +Release: 1%{?dist} +Summary: 3D printing software aimed at RepRaps and the Ultimaker +Group: Applications/Engineering + +License: GPLv2+ +URL: https://github.com/daid/Cura.git +Source0: %{_curaName}-%{_version}.tar.gz + +BuildRequires: libstdc++-static, glibc-static +Requires: wxPython, curl +Requires: python3-setuptools >= 0.6.34 +Requires: python3-PyOpenGL >= 3.0.2, PyOpenGL >= 3.0.2 +Requires: python3-pyserial >= 2.6, pyserial >= 2.6 +Requires: python3-numpy >= 1.6.2, numpy >= 1.6.2 +Requires: python3-power >= 1.2 + + +%description +%{_curaName} is a full software solution for 3D printing, aimed at RepRaps and +the Ultimaker. + +It's free software payed for and maintained by Ultimaker. + + +%prep +%setup -q -n %{name}-%{version} + + +%build +make -C CuraEngine VERSION=%{_version} + +dstDir="%{_baseDir}/usr/share/cura" + +rm -frv "$dstDir" +mkdir -pv "$dstDir" + +cp -av -t "$dstDir" \ + Cura \ + resources \ + plugins \ + CuraEngine/build/CuraEngine \ + Power/power \ + scripts/linux/cura.py + +echo "%{_version}" > "$dstDir/Cura/version" +cat > "$dstDir/Cura/versions" << EOF +# Git SHAs of software used to build %{_curaName} +Cura : %{_gitCura} +CuraEngine : %{_gitCuraEngine} +Power : %{_gitPower} +EOF + + +%install +mkdir -pv "%{buildroot}" +cp -av -t "%{buildroot}" "%{_baseDir}/usr" + + +%files +%defattr(-,root,root) +%{_bindir}/cura +%attr(644, root, root) %{_datarootdir}/applications/cura.desktop +%attr(755, root, root) %{_datarootdir}/cura/Cura/cura.py +%attr(755, root, root) %{_datarootdir}/cura/Cura/util/pymclevel/mce.py +%attr(755, root, root) %{_datarootdir}/cura/CuraEngine +%attr(755, root, root) %{_datarootdir}/cura/cura.py +%{_datarootdir}/cura + + +%changelog +* Wed Jan 14 2015 Ferry Huberts <ferry.huberts@pelagic.nl> +- Initial packaging, currently at version 15.01.RC7 diff --git a/scripts/linux/fedora/usr/bin/cura b/scripts/linux/fedora/usr/bin/cura new file mode 100755 index 0000000000..bd9ef0e1a4 --- /dev/null +++ b/scripts/linux/fedora/usr/bin/cura @@ -0,0 +1,2 @@ +#!/bin/sh +PYTHONPATH=$PYTHONPATH:/usr/share/cura/ /usr/bin/python /usr/share/cura/cura.py "$@" diff --git a/scripts/linux/fedora/usr/share/.gitignore b/scripts/linux/fedora/usr/share/.gitignore new file mode 100644 index 0000000000..90e6af15ef --- /dev/null +++ b/scripts/linux/fedora/usr/share/.gitignore @@ -0,0 +1 @@ +/cura/ diff --git a/scripts/linux/fedora/usr/share/applications/cura.desktop b/scripts/linux/fedora/usr/share/applications/cura.desktop new file mode 100755 index 0000000000..25dcc7f364 --- /dev/null +++ b/scripts/linux/fedora/usr/share/applications/cura.desktop @@ -0,0 +1,10 @@ +[Desktop Entry] +Type=Application +Name=Cura +Comment=Cura +Icon=/usr/share/cura/resources/images/c.png +Exec=/usr/bin/python /usr/share/cura/cura.py +Path=/usr/share/cura/ +StartupNotify=true +Terminal=false +Categories=Graphics;3DGraphics;Engineering;Development; |