@@ -0,0 +1,75 @@
1+{ stdenv, fetchgit, xorgproto, libX11, bison, ksh, perl, gnum4
2+, libXinerama, libXt, libXext, libtirpc, motif, libXft, xbitmaps
3+, libjpeg, libXmu, libXdmcp, libXScrnSaver, symlinkJoin, bdftopcf
4+, ncompress, mkfontdir, tcl, libXaw, gcc, glibcLocales, gawk
5+, autoPatchelfHook, libredirect, makeWrapper, xset, xrdb, fakeroot }:
6+
7+let
8+ x11ProjectRoot = symlinkJoin {
9+ name = "x11ProjectRoot";
10+ paths = [
11+ bdftopcf mkfontdir
12+ xset # fonts
13+ xrdb # session load
14+ ];
15+ };
16+in stdenv.mkDerivation rec {
17+ version = "2019-11-30";
18+ name = "cde-${version}";
19+
20+ src = fetchgit {
21+ url = "https://git.code.sf.net/p/cdesktopenv/code";
22+ rev = "5cebd7c4da1afea353a3baef250e31a4cf867bc5";
23+ sha256 = "06wvnb3n8hn98kxvmrf6v3lyqp8bxpzl8wrixlw9jinmsivfs4b9";
24+ };
25+ setSourceRoot = ''export sourceRoot="$(echo */cde)"'';
26+
27+ buildInputs = [
28+ libX11 libXinerama libXt libXext libtirpc motif libXft xbitmaps
29+ libjpeg libXmu libXdmcp libXScrnSaver tcl libXaw ksh
30+ ];
31+ nativeBuildInputs = [
32+ bison ncompress gawk autoPatchelfHook makeWrapper fakeroot
33+ ];
34+
35+ makeFlags = [
36+ "World"
37+ "BOOTSTRAPCFLAGS=-I${xorgproto}/include/X11"
38+ "IMAKECPP=cpp"
39+ "LOCALE_ARCHIVE=${glibcLocales}/lib/locale/locale-archive"
40+ ];
41+
42+ preBuild = ''
43+ while IFS= read -r -d ''$'\0' i; do
44+ substituteInPlace "$i" --replace /usr/dt $out/opt/dt
45+ done < <(find "." -type f -exec grep -Iq /usr/dt {} \; -and -print0)
46+
47+ cat >> config/cf/site.def << EOF
48+#define MakeFlagsToShellFlags(makeflags,shellcmd) set -e
49+#define KornShell ${ksh}/bin/ksh
50+#define PerlCmd ${perl}/bin/perl
51+#define M4Cmd ${gnum4}/bin/m4
52+#define X11ProjectRoot ${x11ProjectRoot}
53+#define CppCmd ${gcc}/bin/cpp
54+TIRPCINC = -I${libtirpc.dev}/include/tirpc
55+EOF
56+
57+ patchShebangs .
58+ unset AR
59+ '';
60+
61+ installPhase = ''
62+ fakeroot admin/IntegTools/dbTools/installCDE -s . -DontRunScripts
63+
64+ mkdir -p $out/bin
65+ mv $out/opt/dt/bin/dtmail $out/bin
66+ '';
67+
68+ meta = with stdenv.lib; {
69+ description = "Common Desktop Environment";
70+ homepage = https://sourceforge.net/projects/cdesktopenv/;
71+ license = licenses.lgpl2;
72+ maintainers = [ maintainers.gnidorah ];
73+ platforms = [ "i686-linux" "x86_64-linux" ];
74+ };
75+}