mirror of
https://github.com/hensm/fx_cast.git
synced 2026-06-12 18:39:58 +00:00
Add .rpm package building
This commit is contained in:
@@ -2,6 +2,7 @@ const fs = require("fs-extra");
|
|||||||
const os = require("os");
|
const os = require("os");
|
||||||
const path = require("path");
|
const path = require("path");
|
||||||
const minimist = require("minimist");
|
const minimist = require("minimist");
|
||||||
|
const glob = require("glob");
|
||||||
|
|
||||||
const { spawnSync } = require("child_process");
|
const { spawnSync } = require("child_process");
|
||||||
const { exec: pkgExec } = require("pkg");
|
const { exec: pkgExec } = require("pkg");
|
||||||
@@ -82,10 +83,12 @@ async function build () {
|
|||||||
if (argv.package) {
|
if (argv.package) {
|
||||||
const installerName = await package(argv.platform);
|
const installerName = await package(argv.platform);
|
||||||
|
|
||||||
// Move installer to dist
|
if (installerName) {
|
||||||
fs.moveSync(path.join(BUILD_PATH, installerName)
|
// Move installer to dist
|
||||||
, path.join(DIST_PATH, installerName)
|
fs.moveSync(path.join(BUILD_PATH, installerName)
|
||||||
, { overwrite: true });
|
, path.join(DIST_PATH, path.basename(installerName))
|
||||||
|
, { overwrite: true });
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
// Move binary / app manifest
|
// Move binary / app manifest
|
||||||
fs.moveSync(path.join(BUILD_PATH, manifestName)
|
fs.moveSync(path.join(BUILD_PATH, manifestName)
|
||||||
@@ -130,10 +133,8 @@ function packageDarwin () {
|
|||||||
|
|
||||||
// Create pkgbuild root
|
// Create pkgbuild root
|
||||||
const rootPath = path.join(BUILD_PATH, "root");
|
const rootPath = path.join(BUILD_PATH, "root");
|
||||||
const rootExecutablePath = path.join(rootPath
|
const rootExecutablePath = path.join(rootPath, executablePath["darwin"]);
|
||||||
, executablePath["darwin"]);
|
const rootManifestPath = path.join(rootPath, manifestPath["darwin"]);
|
||||||
const rootManifestPath = path.join(rootPath
|
|
||||||
, manifestPath["darwin"]);
|
|
||||||
|
|
||||||
// Create install locations
|
// Create install locations
|
||||||
fs.ensureDirSync(rootExecutablePath, { recursive: true });
|
fs.ensureDirSync(rootExecutablePath, { recursive: true });
|
||||||
@@ -171,14 +172,10 @@ function packageDarwin () {
|
|||||||
function packageLinuxDeb () {
|
function packageLinuxDeb () {
|
||||||
const installerName = "fx_cast_bridge.deb";
|
const installerName = "fx_cast_bridge.deb";
|
||||||
|
|
||||||
const packagingDir = path.join(__dirname, "../packaging/linux/deb");
|
|
||||||
|
|
||||||
// Create root
|
// Create root
|
||||||
const rootPath = path.join(BUILD_PATH, "root");
|
const rootPath = path.join(BUILD_PATH, "root");
|
||||||
const rootExecutablePath = path.join(rootPath
|
const rootExecutablePath = path.join(rootPath, executablePath["linux"]);
|
||||||
, executablePath["linux"]);
|
const rootManifestPath = path.join(rootPath, manifestPath["linux"]);
|
||||||
const rootManifestPath = path.join(rootPath
|
|
||||||
, manifestPath["linux"]);
|
|
||||||
|
|
||||||
fs.ensureDirSync(rootExecutablePath, { recursive: true });
|
fs.ensureDirSync(rootExecutablePath, { recursive: true });
|
||||||
fs.ensureDirSync(rootManifestPath, { recursive: true });
|
fs.ensureDirSync(rootManifestPath, { recursive: true });
|
||||||
@@ -190,7 +187,7 @@ function packageLinuxDeb () {
|
|||||||
, path.join(rootManifestPath, manifestName));
|
, path.join(rootManifestPath, manifestName));
|
||||||
|
|
||||||
// Copy package info to root
|
// Copy package info to root
|
||||||
fs.copySync(path.join(packagingDir, "DEBIAN")
|
fs.copySync(path.join(__dirname, "../packaging/linux/deb/DEBIAN/")
|
||||||
, path.join(rootPath, "DEBIAN"));
|
, path.join(rootPath, "DEBIAN"));
|
||||||
|
|
||||||
// Build .deb package
|
// Build .deb package
|
||||||
@@ -202,7 +199,19 @@ function packageLinuxDeb () {
|
|||||||
return installerName;
|
return installerName;
|
||||||
}
|
}
|
||||||
|
|
||||||
function packageLinuxRpm () {}
|
function packageLinuxRpm () {
|
||||||
|
const specPath = path.join(__dirname
|
||||||
|
, "../packaging/linux/rpm/fx_cast_bridge.spec");
|
||||||
|
|
||||||
|
spawnSync(
|
||||||
|
`rpmbuild -bb ${specPath} `
|
||||||
|
+ `--define "_distdir ${BUILD_PATH}" `
|
||||||
|
+ `--define "_rpmdir ${BUILD_PATH}" `
|
||||||
|
, { shell: true });
|
||||||
|
|
||||||
|
return glob.sync("**/*.rpm", { cwd: BUILD_PATH })[0];
|
||||||
|
}
|
||||||
|
|
||||||
function packageWin32 () {}
|
function packageWin32 () {}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -23,6 +23,7 @@
|
|||||||
"@babel/plugin-transform-runtime": "^7.0.0",
|
"@babel/plugin-transform-runtime": "^7.0.0",
|
||||||
"@babel/preset-env": "^7.0.0",
|
"@babel/preset-env": "^7.0.0",
|
||||||
"@babel/register": "^7.0.0",
|
"@babel/register": "^7.0.0",
|
||||||
|
"glob": "^7.1.3",
|
||||||
"minimist": "^1.2.0",
|
"minimist": "^1.2.0",
|
||||||
"pkg": "^4.3.4"
|
"pkg": "^4.3.4"
|
||||||
},
|
},
|
||||||
|
|||||||
20
app/packaging/linux/rpm/fx_cast_bridge.spec
Normal file
20
app/packaging/linux/rpm/fx_cast_bridge.spec
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
Name: fx_cast_bridge
|
||||||
|
Summary: fx_cast Bridge application
|
||||||
|
Version: 0.0.1
|
||||||
|
Release: 1
|
||||||
|
License: MIT
|
||||||
|
|
||||||
|
%description
|
||||||
|
fx_cast Bridge application
|
||||||
|
|
||||||
|
%install
|
||||||
|
rm -rf $RPM_BUILD_ROOT
|
||||||
|
mkdir -p $RPM_BUILD_ROOT/opt/fx_cast/ \
|
||||||
|
$RPM_BUILD_ROOT/usr/lib/mozilla/native-messaging-hosts/
|
||||||
|
|
||||||
|
cp %{_distdir}/bridge $RPM_BUILD_ROOT/opt/fx_cast/
|
||||||
|
cp %{_distdir}/fx_cast_bridge.json $RPM_BUILD_ROOT/usr/lib/mozilla/native-messaging-hosts/
|
||||||
|
|
||||||
|
%files
|
||||||
|
/opt/fx_cast/bridge
|
||||||
|
/usr/lib/mozilla/native-messaging-hosts/fx_cast_bridge.json
|
||||||
Reference in New Issue
Block a user