Add RPM packaging
authorWonyoung Choi <wy80.choi@samsung.com>
Tue, 11 Sep 2018 04:17:37 +0000 (13:17 +0900)
committerWonyoung Choi <wy80.choi@samsung.com>
Tue, 11 Sep 2018 06:01:32 +0000 (15:01 +0900)
Change-Id: I5edd6820b6658b842a5459c6ff1e9f9a69d06982

.gitattributes
build-tizen.sh
packages/commandlineparser.2.2.0.nupkg [new file with mode: 0644]
packages/mono.cecil.0.10.0.nupkg [new file with mode: 0644]
packaging/opentk.manifest [new file with mode: 0644]
packaging/opentk.spec [new file with mode: 0644]

index 5811d79..31b98de 100644 (file)
@@ -29,4 +29,6 @@
 *.ogg binary
 *.zip binary
 *.pdf binary
+*.nupkg binary
+
 
index 01f2e04..08d5ae4 100755 (executable)
@@ -1,16 +1,63 @@
 #!/bin/bash
 
+SCRIPT_FILE=$(readlink -f $0)
+SCRIPT_DIR=$(dirname $SCRIPT_FILE)
+
 CONFIGURATION=Release
 
-# Build tools
-dotnet build -c $CONFIGURATION src/Generator.Bind/Generator.Bind.NETCore.csproj
-dotnet build -c $CONFIGURATION src/Generator.Rewrite/Generator.Rewrite.NETCore.csproj
+PROJECT_BIND=$SCRIPT_DIR/src/Generator.Bind/Generator.Bind.NETCore.csproj
+PROJECT_REWRITE=$SCRIPT_DIR/src/Generator.Rewrite/Generator.Rewrite.NETCore.csproj
+PROJECT_OPENTK=$SCRIPT_DIR/src/OpenTK/OpenTK.Tizen.csproj
+
+BIND_EXE="dotnet $SCRIPT_DIR/src/Generator.Bind/bin/$CONFIGURATION/netcoreapp2.0/Bind.dll"
+
+ARTIFACTS_DIR=$SCRIPT_DIR/artifacts
+
+build() {
+  if [ -d /nuget ]; then
+    NUGET_SOURCE_OPT="-s /nuget -s $SCRIPT_DIR/packages"
+  fi
+
+  # Build tools
+  dotnet restore $NUGET_SOURCE_OPT $PROJECT_BIND
+  dotnet build --no-restore -c $CONFIGURATION $PROJECT_BIND
+
+  dotnet restore $NUGET_SOURCE_OPT $PROJECT_REWRITE
+  dotnet build --no-restore -c $CONFIGURATION $PROJECT_REWRITE
+
+  # Run Binding
+  $BIND_EXE -mode:es11
+  $BIND_EXE -mode:es20
+
+  # Build OpenTK
+  dotnet restore $NUGET_SOURCE_OPT $PROJECT_OPENTK
+  dotnet build --no-restore -c $CONFIGURATION $PROJECT_OPENTK
+
+  # Pack OpenTK.Tizen
+  dotnet pack --no-restore --no-build -c $CONFIGURATION $PROJECT_OPENTK
+
+  # Artifacts
+  mkdir -p $ARTIFACTS_DIR/bin/ref
+  cp -f $SCRIPT_DIR/src/OpenTK/bin/$CONFIGURATION/netstandard2.0/OpenTK.* $ARTIFACTS_DIR/bin/
+  cp -f $SCRIPT_DIR/src/OpenTK/bin/$CONFIGURATION/netstandard2.0/ref/* $ARTIFACTS_DIR/bin/ref/
+  cp -f $SCRIPT_DIR/src/OpenTK/bin/$CONFIGURATION/OpenTK.Tizen.*.nupkg $ARTIFACTS_DIR
+}
+
+clean() {
+  dotnet clean -c $CONFIGURATION $PROJECT_BIND
+  dotnet clean -c $CONFIGURATION $PROJECT_REWRITE
+  dotnet clean -c $CONFIGURATION $PROJECT_OPENTK
+
+  rm -fr $ARTIFACTS_DIR
+}
+
 
-# Run Binding
-dotnet src/Generator.Bind/bin/$CONFIGURATION/netcoreapp2.0/Bind.dll
+export DOTNET_SKIP_FIRST_TIME_EXPERIENCE=true
 
-# Build OpenTK
-dotnet build -c $CONFIGURATION src/OpenTK/OpenTK.Tizen.csproj
+cmd=$1; shift
 
-# Pack OpenTK.Tizen
-dotnet pack --no-build -c $CONFIGURATION src/OpenTK/OpenTK.Tizen.csproj
+if [ "x$cmd" == "xclean" ]; then
+  clean
+else
+  build
+fi
diff --git a/packages/commandlineparser.2.2.0.nupkg b/packages/commandlineparser.2.2.0.nupkg
new file mode 100644 (file)
index 0000000..96b2511
Binary files /dev/null and b/packages/commandlineparser.2.2.0.nupkg differ
diff --git a/packages/mono.cecil.0.10.0.nupkg b/packages/mono.cecil.0.10.0.nupkg
new file mode 100644 (file)
index 0000000..10b5cc8
Binary files /dev/null and b/packages/mono.cecil.0.10.0.nupkg differ
diff --git a/packaging/opentk.manifest b/packaging/opentk.manifest
new file mode 100644 (file)
index 0000000..96a1325
--- /dev/null
@@ -0,0 +1,5 @@
+<manifest>
+    <request>
+        <domain name="_"/>
+    </request>
+</manifest>
\ No newline at end of file
diff --git a/packaging/opentk.spec b/packaging/opentk.spec
new file mode 100644 (file)
index 0000000..f7d9d52
--- /dev/null
@@ -0,0 +1,72 @@
+Name:       opentk
+Summary:    C# binding for OpenGL, OpenGL ES
+Version:    3.0.1
+Release:    1
+Group:      Development/Libraries
+License:    MIT
+URL:        https://github.com/opentk/opentk/
+Source0:    %{name}-%{version}.tar.gz
+Source1:    %{name}.manifest
+
+BuildArch:   noarch
+ExcludeArch: aarch64
+AutoReqProv: no
+
+BuildRequires: dotnet-build-tools
+BuildRequires: csapi-tizenfx-nuget
+
+%description
+The Open Toolkit library is a fast, low-level C# binding for OpenGL, OpenGL ES and OpenAL.
+It runs on all major platforms and powers hundreds of apps, games and scientific research.
+
+%package nuget
+Summary:   NuGet package for %{name}
+Group:     Development/Libraries
+AutoReqProv: no
+
+%description nuget
+NuGet package for %{name}
+
+%package debug
+Summary:   All .pdb files of Tizen .NET
+Group:     Development/Libraries
+AutoReqProv: no
+
+%description debug
+All .pdb files of Tizen .NET
+
+
+%prep
+%setup -q
+cp %{SOURCE1} .
+
+
+%build
+%{?asan:export ASAN_OPTIONS=use_sigaltstack=false:allow_user_segv_handler=true:handle_sigfpe=false:`cat /ASAN_OPTIONS`}
+
+./build-tizen.sh
+
+
+%install
+
+%define DOTNET_ASSEMBLY_PATH /usr/share/dotnet.tizen/framework
+
+mkdir -p %{buildroot}%{DOTNET_ASSEMBLY_PATH}
+
+install -p -m 644 artifacts/bin/OpenTK.dll %{buildroot}%{DOTNET_ASSEMBLY_PATH}
+install -p -m 644 artifacts/bin/OpenTK.pdb %{buildroot}%{DOTNET_ASSEMBLY_PATH}
+
+mkdir -p %{buildroot}/nuget
+install -p -m 644 artifacts/OpenTK.*.nupkg %{buildroot}/nuget
+
+
+%files
+%license License.txt
+%manifest %{name}.manifest
+%attr(644,root,root) %{DOTNET_ASSEMBLY_PATH}/*.dll
+
+%files nuget
+%attr(644,root,root) /nuget/*.nupkg
+
+%files debug
+%attr(644,root,root) %{DOTNET_ASSEMBLY_PATH}/*.pdb