@@ -0,0 +1,150 @@
1+{stdenv, lib, fetchurl, fetchpatch, autoreconfHook}:
2+
3+stdenv.mkDerivation rec {
4+ pname = "arj";
5+ version = "3.10.22";
6+
7+ src = fetchurl {
8+ url = "mirror://sourceforge/${pname}/${pname}-${version}.tar.gz";
9+ sha256 = "1nx7jqxwqkihhdmdbahhzqhjqshzw1jcsvwddmxrwrn8rjdlr7jq";
10+ };
11+
12+ patches = [
13+ (fetchpatch {
14+ url = "https://sources.debian.org/data/main/a/arj/3.10.22-24/debian/patches/001_arches_align.patch";
15+ sha256 = "0i3qclm2mh98c04rqpx1r4qagd3wpxlkj7lvq0ddpkmr8bm0fh0m";
16+ })
17+
18+ (fetchpatch {
19+ url = "https://sources.debian.org/data/main/a/arj/3.10.22-24/debian/patches/002_no_remove_static_const.patch";
20+ sha256 = "0zfjqmjsj0y1kfzxbp29v6nxq5qwgazhb9clqc544sm5zn0bdp8n";
21+ })
22+
23+ (fetchpatch {
24+ url = "https://sources.debian.org/data/main/a/arj/3.10.22-24/debian/patches/003_64_bit_clean.patch";
25+ sha256 = "0mda9fkaqf2s1xl6vlbkbq20362h3is9dpml9kfmacpbifl4dx3n";
26+ })
27+
28+ (fetchpatch {
29+ url = "https://sources.debian.org/data/main/a/arj/3.10.22-24/debian/patches/004_parallel_build.patch";
30+ sha256 = "0gam6k7jknzmbjlf1r6c9kjh5s5h76pd31v59cnaqiycwiy8z6q9";
31+ })
32+
33+ (fetchpatch {
34+ url = "https://sources.debian.org/data/main/a/arj/3.10.22-24/debian/patches/005_use_system_strnlen.patch";
35+ sha256 = "0q0ypm8mdsxd0rl1k0id6fdx5m7mvqgwcla4r250cmc6zqzpib6d";
36+ })
37+
38+ (fetchpatch {
39+ url = "https://sources.debian.org/data/main/a/arj/3.10.22-24/debian/patches/006_use_safe_strcpy.patch";
40+ sha256 = "1garad95s34cix3kd77lz37andrcnz19glzkfdnkjaq7ldvzwikc";
41+ })
42+
43+ (fetchpatch {
44+ url = "https://sources.debian.org/data/main/a/arj/3.10.22-24/debian/patches/hurd_no_fcntl_getlk.patch";
45+ sha256 = "0b3hpn4qypimrw9ar2n4h24886sl6pmim4lb4ly1wqcq0f73arva";
46+ })
47+
48+ (fetchpatch {
49+ url = "https://sources.debian.org/data/main/a/arj/3.10.22-24/debian/patches/security_format.patch";
50+ sha256 = "0q67cvln55p38bm0xwd2cgppqmkp2nfar2pg1zj78f7ncn35lbvf";
51+ })
52+
53+ (fetchpatch {
54+ url = "https://sources.debian.org/data/main/a/arj/3.10.22-24/debian/patches/doc_refer_robert_k_jung.patch";
55+ sha256 = "1wxdx0m6a9vdvjlaycwsissn75l1ni7grg8n6qmkynz2vrcvgzb1";
56+ })
57+
58+ (fetchpatch {
59+ url = "https://sources.debian.org/data/main/a/arj/3.10.22-24/debian/patches/gnu_build_fix.patch";
60+ sha256 = "19ycp1rak7l6ql28m50v95ls621w3sl8agw5r5va73svkgh8hc3g";
61+ })
62+
63+ (fetchpatch {
64+ url = "https://sources.debian.org/data/main/a/arj/3.10.22-24/debian/patches/gnu_build_flags.patch";
65+ sha256 = "1jw1y9i9lw1idgi4l9cycwsql1hcz1m4f3k2iybwsgx0acaw695q";
66+ })
67+
68+ (fetchpatch {
69+ url = "https://sources.debian.org/data/main/a/arj/3.10.22-24/debian/patches/gnu_build_strip.patch";
70+ sha256 = "1b18khj6cxnjyqk2ycygwqlcs20hrsbf4h6bckl99dxnpbq5blxi";
71+ })
72+
73+ (fetchpatch {
74+ url = "https://sources.debian.org/data/main/a/arj/3.10.22-24/debian/patches/gnu_build_pie.patch";
75+ sha256 = "1jqswxgc1plipblf055n9175fbanfi6fb67lnzk8dcvxjn227fs3";
76+ })
77+
78+ (fetchpatch {
79+ url = "https://sources.debian.org/data/main/a/arj/3.10.22-24/debian/patches/self_integrity_64bit.patch";
80+ sha256 = "0s5zdq81a0f83hdg9hy6lqn3xvckx9y9r20awczm9mbf11vi01cb";
81+ })
82+
83+ (fetchpatch {
84+ url = "https://sources.debian.org/data/main/a/arj/3.10.22-24/debian/patches/security-afl.patch";
85+ sha256 = "0yajcwpghij8wg21a0kkp3f9x7anz5m121jx2vnkyn04bvi9541a";
86+ })
87+
88+ (fetchpatch {
89+ url = "https://sources.debian.org/data/main/a/arj/3.10.22-24/debian/patches/security-traversal-dir.patch";
90+ sha256 = "10lv3867k0wm2s0cyf40hkxfqbjaxm4aph5ivk2q2rjkracrn2y4";
91+ })
92+
93+ (fetchpatch {
94+ url = "https://sources.debian.org/data/main/a/arj/3.10.22-24/debian/patches/security-traversal-symlink.patch";
95+ sha256 = "095pdfskxwh0jnyy31dpz10s2ppv8n7lvvn4q722y3g71d0c79qq";
96+ })
97+
98+ (fetchpatch {
99+ url = "https://sources.debian.org/data/main/a/arj/3.10.22-24/debian/patches/out-of-bounds-read.patch";
100+ sha256 = "0ps9lqkbqzlhzr2bnr47sir431z1nywr7nagkmk42iki4d96v0jq";
101+ })
102+
103+ (fetchpatch {
104+ url = "https://sources.debian.org/data/main/a/arj/3.10.22-24/debian/patches/remove_build_date.patch";
105+ sha256 = "1vjlfq6firxpj068l9acyqs77mfydn1rwgr2jmxgsy9mq0fw1dsc";
106+ })
107+
108+ (fetchpatch {
109+ url = "https://sources.debian.org/data/main/a/arj/3.10.22-24/debian/patches/reproducible_help_archive.patch";
110+ sha256 = "0l3qi9f140pwc6fk8qdbxx4g9d8zlf45asimmr8wfpbi4pf59n8i";
111+ })
112+
113+ (fetchpatch {
114+ url = "https://sources.debian.org/data/main/a/arj/3.10.22-24/debian/patches/gnu_build_cross.patch";
115+ sha256 = "1vb0vbh3jbxj192q47vg3f41l343ghcz2ypbrrm2bkbpwm5cl8qr";
116+ })
117+
118+ (fetchpatch {
119+ url = "https://sources.debian.org/data/main/a/arj/3.10.22-24/debian/patches/fix-time_t-usage.patch";
120+ sha256 = "012c6pnf5y4jwn715kxn3vjy088rm905959j6yh8bslyx84qaijv";
121+ })
122+
123+ (fetchpatch {
124+ url = "https://sources.debian.org/data/main/a/arj/3.10.22-24/debian/patches/gnu_build_fix_autoreconf.patch";
125+ sha256 = "0yhxbdasnbqcg1nyx2379fpbr7fmdlv4n2nlxrv1z1vbc7rlvw9d";
126+ })
127+ ];
128+
129+ nativeBuildInputs = [ autoreconfHook ];
130+
131+ preAutoreconf = ''
132+ cd gnu
133+ '';
134+
135+ postConfigure = ''
136+ cd ..
137+ '';
138+
139+ meta = with lib; {
140+ description = "Open-source implementation of the world-famous ARJ archiver";
141+ longDescription = ''
142+ This version of ARJ has been created with an intent to preserve maximum
143+ compatibility and retain the feature set of the original ARJ archiver as
144+ provided by ARJ Software, Inc.
145+ '';
146+ license = licenses.gpl2Plus;
147+ maintainers = [ maintainers.sander ];
148+ platforms = platforms.unix;
149+ };
150+}