diff --git a/pkgs/applications/science/electronics/magic-vlsi/0001-strip-bin-prefix.patch b/pkgs/applications/science/electronics/magic-vlsi/0001-strip-bin-prefix.patch new file mode 100644 index 000000000000..1cef96ea1408 --- /dev/null +++ b/pkgs/applications/science/electronics/magic-vlsi/0001-strip-bin-prefix.patch @@ -0,0 +1,10 @@ +diff --git a/scripts/makedbh b/scripts/makedbh +index 01e4fa5..d6299c6 100755 +--- a/scripts/makedbh ++++ b/scripts/makedbh +@@ -1,4 +1,4 @@ +-#!/bin/csh -f ++#!/usr/bin/env tcsh + # + # makes the "database.h" (1st argument, $1) file from "database.h.in" + # (2nd argument, $2), setting various mask operation definitions diff --git a/pkgs/applications/science/electronics/magic-vlsi/0002-fix-format-security.patch b/pkgs/applications/science/electronics/magic-vlsi/0002-fix-format-security.patch new file mode 100644 index 000000000000..37ae35195503 --- /dev/null +++ b/pkgs/applications/science/electronics/magic-vlsi/0002-fix-format-security.patch @@ -0,0 +1,19 @@ +diff --git a/database/DBio.c b/database/DBio.c +index 93c4b0b..292ea5f 100644 +--- a/database/DBio.c ++++ b/database/DBio.c +@@ -2378,12 +2378,12 @@ DBCellWriteFile(cellDef, f) + + #define FPRINTF(f,s)\ + {\ +- if (fprintf(f,s) == EOF) goto ioerror;\ ++ if (fprintf(f,"%s",s) == EOF) goto ioerror;\ + DBFileOffset += strlen(s);\ + } + #define FPRINTR(f,s)\ + {\ +- if (fprintf(f,s) == EOF) return 1;\ ++ if (fprintf(f,"%s",s) == EOF) return 1;\ + DBFileOffset += strlen(s);\ + } + diff --git a/pkgs/applications/science/electronics/magic-vlsi/default.nix b/pkgs/applications/science/electronics/magic-vlsi/default.nix new file mode 100644 index 000000000000..62b830547e53 --- /dev/null +++ b/pkgs/applications/science/electronics/magic-vlsi/default.nix @@ -0,0 +1,36 @@ +{ stdenv, fetchurl, m4, tcsh, libX11, tcl, tk, cairo, ncurses, mesa_glu, python3 }: + +stdenv.mkDerivation { + pname = "magic-vlsi"; + version = "8.3.5"; + + src = fetchurl { + url = "http://opencircuitdesign.com/magic/archive/magic-8.3.5.tgz"; + sha256 = "0wv4zmxlqjfaakgp802icn0cd9f8ylkz2sppix83axq8p5cg90yq"; + }; + + buildInputs = [ m4 tcsh libX11 tcl tk cairo ncurses mesa_glu ]; + nativeBuildInputs = [ python3 ]; + + configureFlags = [ + "--with-tcl=${tcl}" + "--with-tk=${tk}" + "--disable-werror" + ]; + + postPatch = '' + patchShebangs scripts/* + ''; + + patches = [ + ./0001-strip-bin-prefix.patch + ./0002-fix-format-security.patch + ]; + + meta = with stdenv.lib; { + description = "VLSI layout tool written in Tcl"; + homepage = "http://opencircuitdesign.com/magic/"; + license = licenses.mit; + maintainers = [ maintainers.dkudriavtsev ]; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index b884fd256f43..3b4479b5f55a 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -3066,6 +3066,8 @@ in kramdown-asciidoc = callPackage ../tools/typesetting/kramdown-asciidoc { }; + magic-vlsi = callPackage ../applications/science/electronics/magic-vlsi { }; + mcrcon = callPackage ../tools/networking/mcrcon {}; rage = callPackage ../tools/security/rage {