mirror of
https://github.com/ysoftdevs/cpp-examples.git
synced 2026-01-16 08:36:50 +01:00
add Gradle Debian Linux packaging
This commit is contained in:
74
README.md
74
README.md
@@ -68,8 +68,72 @@ How to run:
|
|||||||
make
|
make
|
||||||
./helloworld
|
./helloworld
|
||||||
|
|
||||||
Gradle
|
Gradle basics and C plugin
|
||||||
------
|
--------------------------
|
||||||
|
|
||||||
|
### 00-empty-project ###
|
||||||
|
|
||||||
|
Empty gradle project.
|
||||||
|
|
||||||
|
How to run:
|
||||||
|
|
||||||
|
gradle tasks
|
||||||
|
|
||||||
|
### 01-hello-task ###
|
||||||
|
|
||||||
|
Simple task to print string during build.
|
||||||
|
|
||||||
|
How to run:
|
||||||
|
|
||||||
|
gradle tasks
|
||||||
|
gradle hello
|
||||||
|
|
||||||
|
### 02-c-plugin ###
|
||||||
|
|
||||||
|
Simple usage C plugin. There is no working C code in this example.
|
||||||
|
|
||||||
|
How to run:
|
||||||
|
|
||||||
|
gradle tasks
|
||||||
|
|
||||||
|
### 03-executable ###
|
||||||
|
|
||||||
|
Gradle with C plugin with simple Hello application.
|
||||||
|
|
||||||
|
How to run (Shell):
|
||||||
|
|
||||||
|
gradle mE
|
||||||
|
cd build/binaries/mainExecutable
|
||||||
|
./main
|
||||||
|
|
||||||
|
How to run (PowerShell):
|
||||||
|
|
||||||
|
gradle mE
|
||||||
|
cd build\binaries\mainExecutable
|
||||||
|
.\main.exe
|
||||||
|
|
||||||
|
### 04-visua-studio ###
|
||||||
|
|
||||||
|
Gradle C plugin example with support for Visual Studio solution files.
|
||||||
|
|
||||||
|
How to run (PowerShell):
|
||||||
|
|
||||||
|
gradle mainVisualStudio
|
||||||
|
ii mainExe.sln
|
||||||
|
|
||||||
|
### 05-debian-package ###
|
||||||
|
|
||||||
|
Gradle plugin for packaging Debian/Ubuntu package. Gradle downloads plugin from repository.
|
||||||
|
|
||||||
|
How to run:
|
||||||
|
|
||||||
|
gradle helloExecutable prepare buildDeb
|
||||||
|
|
||||||
|
Debian package is available in directory build.
|
||||||
|
|
||||||
|
|
||||||
|
Gradle C++ plugin
|
||||||
|
-----------------
|
||||||
|
|
||||||
### 01-hello-muni ###
|
### 01-hello-muni ###
|
||||||
|
|
||||||
@@ -84,7 +148,7 @@ Note for Visual Studio 2013: Use Gradle at least night build 1.10-20131122230018
|
|||||||
|
|
||||||
How to run:
|
How to run:
|
||||||
|
|
||||||
cd gradle/01-hello-muni
|
cd gradle-cpp-plugin/01-hello-muni
|
||||||
gradle mainExecutable
|
gradle mainExecutable
|
||||||
cd build/binaries/mainExecutable
|
cd build/binaries/mainExecutable
|
||||||
./01-hello-muni
|
./01-hello-muni
|
||||||
@@ -102,7 +166,7 @@ support.
|
|||||||
|
|
||||||
How to run:
|
How to run:
|
||||||
|
|
||||||
cd gradle/02-hello-muni-with-gradle-wrapper
|
cd gradle-cpp-plugin/02-hello-muni-with-gradle-wrapper
|
||||||
./gradlew mainExecutable (or .\gradle.bat mainExecutable for PowerShell)
|
./gradlew mainExecutable (or .\gradle.bat mainExecutable for PowerShell)
|
||||||
cd build/binaries/mainExecutable
|
cd build/binaries/mainExecutable
|
||||||
./02-hello-muni-with-gradle-wrapper
|
./02-hello-muni-with-gradle-wrapper
|
||||||
@@ -114,7 +178,7 @@ This example shows how to update build script to add debug flags for compilers l
|
|||||||
|
|
||||||
How to run:
|
How to run:
|
||||||
|
|
||||||
cd gradle/03-hello-muni-with-debug
|
cd gradle-cpp-plugin/03-hello-muni-with-debug
|
||||||
gradle mainExecutable
|
gradle mainExecutable
|
||||||
cd build/binaries/mainExecutable
|
cd build/binaries/mainExecutable
|
||||||
./03-hello-muni-with-debug
|
./03-hello-muni-with-debug
|
||||||
|
|||||||
45
gradle/05-debian-package/build.gradle
Normal file
45
gradle/05-debian-package/build.gradle
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
import org.gradle.api.publish.maven.MavenPublication
|
||||||
|
buildscript {
|
||||||
|
repositories {
|
||||||
|
maven {
|
||||||
|
url "http://dl.bintray.com/gesellix/gradle-plugins"
|
||||||
|
}
|
||||||
|
mavenCentral()
|
||||||
|
mavenLocal()
|
||||||
|
}
|
||||||
|
dependencies {
|
||||||
|
classpath "de.gesellix:gradle-debian-plugin:12"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
apply plugin: 'maven'
|
||||||
|
apply plugin: 'pkg-debian'
|
||||||
|
apply plugin: 'c'
|
||||||
|
|
||||||
|
version = "1.0.0"
|
||||||
|
|
||||||
|
executables {
|
||||||
|
hello {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
task prepare(type: Copy) {
|
||||||
|
description "Copy files to Linux directory layout"
|
||||||
|
from "build/binaries/helloExecutable"
|
||||||
|
into "build/linux/usr/bin"
|
||||||
|
}
|
||||||
|
|
||||||
|
debian {
|
||||||
|
packagename = "hello-fimuni"
|
||||||
|
publications = ['fimuni']
|
||||||
|
controlDirectory = "$projectDir/src/main/resources/control"
|
||||||
|
changelogFile = "$projectDir/src/main/resources/txt/changelog.txt"
|
||||||
|
|
||||||
|
data {
|
||||||
|
def baseDir = "$buildDir/linux"
|
||||||
|
dir {
|
||||||
|
name = baseDir
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
7
gradle/05-debian-package/src/hello/c/hello.c
Normal file
7
gradle/05-debian-package/src/hello/c/hello.c
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
int main(int argc, char** argv){
|
||||||
|
printf("Hello FI MUNI!\n");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
/etc/default/hello-fimuni
|
||||||
11
gradle/05-debian-package/src/main/resources/control/control
Normal file
11
gradle/05-debian-package/src/main/resources/control/control
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
Source: hello-fimuni
|
||||||
|
Section: web
|
||||||
|
Priority: optional
|
||||||
|
Version: 1.0.0
|
||||||
|
Maintainer: Juraj Michalek <juraj.michalek@ysoft.com>
|
||||||
|
Homepage: http://www.ysoft.com/
|
||||||
|
Package: hello-fimuni
|
||||||
|
Architecture: all
|
||||||
|
Depends:
|
||||||
|
Description: Hello FI MUNI
|
||||||
|
Example of Linux packaging for Gradle.
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
set -e
|
||||||
|
|
||||||
|
# Post installation script - executed at the last phase of installation
|
||||||
|
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
set -e
|
||||||
|
|
||||||
|
# Post remove script
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
# Pre-uninstallation script
|
||||||
|
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
|
||||||
|
|
||||||
@@ -20,7 +20,8 @@ executables {
|
|||||||
binaries.all {
|
binaries.all {
|
||||||
if (toolChain in VisualCpp) {
|
if (toolChain in VisualCpp) {
|
||||||
cCompiler.args "/MD"
|
cCompiler.args "/MD"
|
||||||
linker.args "/SUBSYSTEM:CONSOLE", "/LIBPATH:../build/lib/", "SDL2main.lib", "SDL2.lib"
|
linker.args "/SUBSYSTEM:CONSOLE", "/LIBPATH:../build/lib/",
|
||||||
|
"SDL2main.lib", "SDL2.lib"
|
||||||
} else if (toolChain in Gcc) {
|
} else if (toolChain in Gcc) {
|
||||||
linker.args "-lSDL2"
|
linker.args "-lSDL2"
|
||||||
}
|
}
|
||||||
@@ -28,3 +29,9 @@ executables {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
task prepare(type: Copy) {
|
||||||
|
description "Copy DLL dependencies"
|
||||||
|
from "../build/lib/"
|
||||||
|
into "build/binaries/mainExecutable"
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user