pkgs/ultimatepp: add uppPackage builder
This commit is contained in:
parent
73142b030f
commit
ea8ac1c2c6
2 changed files with 119 additions and 18 deletions
81
pkgs/by-name/ul/ultimatepp/buildUppPackage.nix
Normal file
81
pkgs/by-name/ul/ultimatepp/buildUppPackage.nix
Normal file
|
@ -0,0 +1,81 @@
|
||||||
|
{
|
||||||
|
lib,
|
||||||
|
pkg-config,
|
||||||
|
stdenv,
|
||||||
|
ultimatepp,
|
||||||
|
}:
|
||||||
|
|
||||||
|
{
|
||||||
|
assembly ? ".",
|
||||||
|
extraAssemblies ? [],
|
||||||
|
includeUppsrcAssembly ? true,
|
||||||
|
package,
|
||||||
|
flags ? [],
|
||||||
|
buildMethod ? if stdenv.cc.isClang then "CLANG" else "GCC",
|
||||||
|
buildShared ? false,
|
||||||
|
...
|
||||||
|
}@args:
|
||||||
|
|
||||||
|
let
|
||||||
|
flagsString = lib.optionalString (flags != []) ( "+" + lib.concatStringsSep "," flags);
|
||||||
|
output = if buildShared then "lib/${package}.so" else "bin/${package}";
|
||||||
|
in
|
||||||
|
|
||||||
|
stdenv.mkDerivation (self: {
|
||||||
|
nativeBuildInputs = [
|
||||||
|
pkg-config
|
||||||
|
ultimatepp
|
||||||
|
] ++ args.nativeBuildInputs or [];
|
||||||
|
|
||||||
|
buildInputs = ultimatepp.uppsrcDependencies ++ args.buildInputs or [];
|
||||||
|
|
||||||
|
assemblies = lib.concatStringsSep "," (
|
||||||
|
lib.singleton assembly
|
||||||
|
++ extraAssemblies
|
||||||
|
++ lib.optional includeUppsrcAssembly "${ultimatepp.src}/uppsrc"
|
||||||
|
);
|
||||||
|
|
||||||
|
postUnpack = ''
|
||||||
|
mkdir -p .home
|
||||||
|
export HOME=$(realpath .home)
|
||||||
|
'';
|
||||||
|
|
||||||
|
UPP_NO_BUILD_INFO = true;
|
||||||
|
|
||||||
|
# https://www.ultimatepp.org/app$ide$umk$en-us.html
|
||||||
|
# s - use shared libraries
|
||||||
|
# S - use shared libraries and build shared libraries
|
||||||
|
# u - use target directory
|
||||||
|
# v - verbose
|
||||||
|
# r - release mdode
|
||||||
|
|
||||||
|
# FIXME: writing to $out should be done in the install phase
|
||||||
|
buildPhase = ''
|
||||||
|
runHook preBuild
|
||||||
|
|
||||||
|
mkdir -p $out/${if buildShared then "lib" else "bin"}
|
||||||
|
|
||||||
|
umk \
|
||||||
|
"$assemblies" \
|
||||||
|
${lib.escapeShellArg package} \
|
||||||
|
${buildMethod} \
|
||||||
|
-${if buildShared then "S" else "s"}uvr \
|
||||||
|
${flagsString} \
|
||||||
|
$out/${output}
|
||||||
|
|
||||||
|
runHook postBuild
|
||||||
|
'';
|
||||||
|
|
||||||
|
# Don't run installPhase unless the user explicitly provides it
|
||||||
|
dontInstall = !lib.hasAttr "installPhase" args;
|
||||||
|
} // lib.removeAttrs args [
|
||||||
|
"assembly"
|
||||||
|
"extraAssemblies"
|
||||||
|
"includeUppsrcAssembly"
|
||||||
|
"package"
|
||||||
|
"flags"
|
||||||
|
"buildMethod"
|
||||||
|
"buildShared"
|
||||||
|
"nativeBuildInputs"
|
||||||
|
"buildInputs"
|
||||||
|
])
|
|
@ -1,5 +1,6 @@
|
||||||
{
|
{
|
||||||
lib,
|
lib,
|
||||||
|
callPackage,
|
||||||
fetchFromGitHub,
|
fetchFromGitHub,
|
||||||
makeWrapper,
|
makeWrapper,
|
||||||
pkg-config,
|
pkg-config,
|
||||||
|
@ -21,6 +22,22 @@
|
||||||
|
|
||||||
let
|
let
|
||||||
buildMethod = if stdenv.cc.isClang then "CLANG" else "GCC";
|
buildMethod = if stdenv.cc.isClang then "CLANG" else "GCC";
|
||||||
|
uppsrcDependencies = [
|
||||||
|
expat
|
||||||
|
fontconfig
|
||||||
|
freetype
|
||||||
|
gtk3
|
||||||
|
libnotify
|
||||||
|
libpng
|
||||||
|
openssl
|
||||||
|
xorg.libX11
|
||||||
|
xorg.libXdmcp
|
||||||
|
xorg.libXext
|
||||||
|
xorg.libXft
|
||||||
|
xorg.libXinerama
|
||||||
|
xorg.libXrender
|
||||||
|
xorg.libxcb
|
||||||
|
];
|
||||||
in stdenv.mkDerivation (self: let
|
in stdenv.mkDerivation (self: let
|
||||||
selfBootstrap = self.overrideAttrs (selfAttrs: superAttrs: {
|
selfBootstrap = self.overrideAttrs (selfAttrs: superAttrs: {
|
||||||
passthru = superAttrs.passthru // {
|
passthru = superAttrs.passthru // {
|
||||||
|
@ -45,24 +62,7 @@ in {
|
||||||
pkg-config
|
pkg-config
|
||||||
];
|
];
|
||||||
|
|
||||||
buildInputs = [
|
buildInputs = uppsrcDependencies ++ lib.optional (!self.passthru.bootstrap) libclang;
|
||||||
# in the same order as in the Makefile
|
|
||||||
libpng
|
|
||||||
freetype
|
|
||||||
fontconfig
|
|
||||||
xorg.libX11
|
|
||||||
xorg.libxcb
|
|
||||||
expat
|
|
||||||
xorg.libXinerama
|
|
||||||
xorg.libXrender
|
|
||||||
xorg.libXft
|
|
||||||
xorg.libXdmcp
|
|
||||||
xorg.libXext
|
|
||||||
gtk3
|
|
||||||
libnotify
|
|
||||||
# not in the Makefile
|
|
||||||
openssl
|
|
||||||
] ++ lib.optional (!self.passthru.bootstrap) libclang;
|
|
||||||
|
|
||||||
patches = [
|
patches = [
|
||||||
./no-build-info.patch
|
./no-build-info.patch
|
||||||
|
@ -118,6 +118,26 @@ in {
|
||||||
|
|
||||||
passthru = {
|
passthru = {
|
||||||
bootstrap = false;
|
bootstrap = false;
|
||||||
|
inherit uppsrcDependencies;
|
||||||
|
buildUppPackage = callPackage ./buildUppPackage.nix {};
|
||||||
|
tests = lib.genAttrs [
|
||||||
|
"AddressBookXML2"
|
||||||
|
"Bombs"
|
||||||
|
"Days"
|
||||||
|
"SQLApp"
|
||||||
|
"httpcli"
|
||||||
|
] (examplePackageName: self.passthru.buildUppPackage {
|
||||||
|
pname = examplePackageName;
|
||||||
|
version = self.version;
|
||||||
|
package = examplePackageName;
|
||||||
|
src = self.src;
|
||||||
|
includeUppsrcAssembly = false;
|
||||||
|
buildInputs = self.passthru.uppsrcDependencies;
|
||||||
|
assembly = "examples";
|
||||||
|
extraAssemblies = [
|
||||||
|
"uppsrc"
|
||||||
|
];
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
meta = {
|
meta = {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue