Skip to content

Commit 81a1381

Browse files
committed
chore: update Makefile and flox environment
Update flox environment, fix version handling and tidy Makefile in preparation for adding to nixpkgs upstream.
1 parent 83caeb1 commit 81a1381

File tree

5 files changed

+45
-199
lines changed

5 files changed

+45
-199
lines changed

.flox/.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@ run/
22
cache/
33
lib/
44
log/
5+
!env/

.flox/env/manifest.lock

+21-143
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,6 @@
66
"clang-tools": {
77
"pkg-path": "clang-tools"
88
},
9-
"entr": {
10-
"pkg-path": "entr"
11-
},
129
"gcc": {
1310
"pkg-path": "gcc"
1411
},
@@ -39,6 +36,7 @@
3936
"build": {
4037
"t3": {
4138
"command": " make\n make test\n make install PREFIX=$out\n",
39+
"runtime-packages": [],
4240
"sandbox": "pure"
4341
}
4442
}
@@ -164,126 +162,6 @@
164162
"group": "toplevel",
165163
"priority": 5
166164
},
167-
{
168-
"attr_path": "entr",
169-
"broken": false,
170-
"derivation": "/nix/store/2m9kxlvcfm29ry5c8wwxjz6m7idkjv6j-entr-5.2.drv",
171-
"description": "Run arbitrary commands when files change",
172-
"install_id": "entr",
173-
"license": "ISC",
174-
"locked_url": "https://github.com/flox/nixpkgs?rev=0fc9fca9c8d43edd79d33fea0dd8409d7c4580f4",
175-
"name": "entr-5.2",
176-
"pname": "entr",
177-
"rev": "0fc9fca9c8d43edd79d33fea0dd8409d7c4580f4",
178-
"rev_count": 439146,
179-
"rev_date": "2023-01-02T00:06:23Z",
180-
"scrape_date": "2024-08-16T02:13:46Z",
181-
"stabilities": [
182-
"staging",
183-
"unstable"
184-
],
185-
"unfree": false,
186-
"version": "5.2",
187-
"outputs_to_install": [
188-
"out"
189-
],
190-
"outputs": {
191-
"out": "/nix/store/w2zxqvwjq135nx9spsji0xjqpb84y0dm-entr-5.2"
192-
},
193-
"system": "aarch64-darwin",
194-
"group": "toplevel",
195-
"priority": 5
196-
},
197-
{
198-
"attr_path": "entr",
199-
"broken": false,
200-
"derivation": "/nix/store/3wbgs8gshr35bkiv5pr2hzjbib5s58nh-entr-5.2.drv",
201-
"description": "Run arbitrary commands when files change",
202-
"install_id": "entr",
203-
"license": "ISC",
204-
"locked_url": "https://github.com/flox/nixpkgs?rev=0fc9fca9c8d43edd79d33fea0dd8409d7c4580f4",
205-
"name": "entr-5.2",
206-
"pname": "entr",
207-
"rev": "0fc9fca9c8d43edd79d33fea0dd8409d7c4580f4",
208-
"rev_count": 439146,
209-
"rev_date": "2023-01-02T00:06:23Z",
210-
"scrape_date": "2024-08-16T02:13:46Z",
211-
"stabilities": [
212-
"staging",
213-
"unstable"
214-
],
215-
"unfree": false,
216-
"version": "5.2",
217-
"outputs_to_install": [
218-
"out"
219-
],
220-
"outputs": {
221-
"out": "/nix/store/yqm69pda8rl4bbs02vix5h2vk86wwqqd-entr-5.2"
222-
},
223-
"system": "aarch64-linux",
224-
"group": "toplevel",
225-
"priority": 5
226-
},
227-
{
228-
"attr_path": "entr",
229-
"broken": false,
230-
"derivation": "/nix/store/jdafsf78g5qvicdyc6j63ar7brwph91c-entr-5.2.drv",
231-
"description": "Run arbitrary commands when files change",
232-
"install_id": "entr",
233-
"license": "ISC",
234-
"locked_url": "https://github.com/flox/nixpkgs?rev=0fc9fca9c8d43edd79d33fea0dd8409d7c4580f4",
235-
"name": "entr-5.2",
236-
"pname": "entr",
237-
"rev": "0fc9fca9c8d43edd79d33fea0dd8409d7c4580f4",
238-
"rev_count": 439146,
239-
"rev_date": "2023-01-02T00:06:23Z",
240-
"scrape_date": "2024-08-16T02:13:46Z",
241-
"stabilities": [
242-
"staging",
243-
"unstable"
244-
],
245-
"unfree": false,
246-
"version": "5.2",
247-
"outputs_to_install": [
248-
"out"
249-
],
250-
"outputs": {
251-
"out": "/nix/store/q2j2m17an7b1inqzdm0js2r054ji5n9j-entr-5.2"
252-
},
253-
"system": "x86_64-darwin",
254-
"group": "toplevel",
255-
"priority": 5
256-
},
257-
{
258-
"attr_path": "entr",
259-
"broken": false,
260-
"derivation": "/nix/store/yabgf5jhca8czd150jcmv9rss4nrkx66-entr-5.2.drv",
261-
"description": "Run arbitrary commands when files change",
262-
"install_id": "entr",
263-
"license": "ISC",
264-
"locked_url": "https://github.com/flox/nixpkgs?rev=0fc9fca9c8d43edd79d33fea0dd8409d7c4580f4",
265-
"name": "entr-5.2",
266-
"pname": "entr",
267-
"rev": "0fc9fca9c8d43edd79d33fea0dd8409d7c4580f4",
268-
"rev_count": 439146,
269-
"rev_date": "2023-01-02T00:06:23Z",
270-
"scrape_date": "2024-08-16T02:13:46Z",
271-
"stabilities": [
272-
"staging",
273-
"unstable"
274-
],
275-
"unfree": false,
276-
"version": "5.2",
277-
"outputs_to_install": [
278-
"out"
279-
],
280-
"outputs": {
281-
"out": "/nix/store/xvzmsmjk8lgzdbzach38za42v5pz65qa-entr-5.2"
282-
},
283-
"system": "x86_64-linux",
284-
"group": "toplevel",
285-
"priority": 5
286-
},
287165
{
288166
"attr_path": "gcc",
289167
"broken": false,
@@ -303,10 +181,10 @@
303181
"unstable"
304182
],
305183
"unfree": false,
306-
"version": "wrapper-11.3.0",
184+
"version": "11.3.0",
307185
"outputs_to_install": [
308-
"out",
309-
"man"
186+
"man",
187+
"out"
310188
],
311189
"outputs": {
312190
"info": "/nix/store/ihj6xpggw8cy9gzq1pqwk2353jyvxa77-gcc-wrapper-11.3.0-info",
@@ -336,10 +214,10 @@
336214
"unstable"
337215
],
338216
"unfree": false,
339-
"version": "wrapper-9.5.0",
217+
"version": "9.5.0",
340218
"outputs_to_install": [
341-
"out",
342-
"man"
219+
"man",
220+
"out"
343221
],
344222
"outputs": {
345223
"info": "/nix/store/k280mzgbhda3la8qp9jvfgm71rfvqi8x-gcc-wrapper-9.5.0-info",
@@ -369,10 +247,10 @@
369247
"unstable"
370248
],
371249
"unfree": false,
372-
"version": "wrapper-11.3.0",
250+
"version": "11.3.0",
373251
"outputs_to_install": [
374-
"out",
375-
"man"
252+
"man",
253+
"out"
376254
],
377255
"outputs": {
378256
"info": "/nix/store/yih14rjv4rgmg4n76ljgwy848mr1p8hp-gcc-wrapper-11.3.0-info",
@@ -402,10 +280,10 @@
402280
"unstable"
403281
],
404282
"unfree": false,
405-
"version": "wrapper-11.3.0",
283+
"version": "11.3.0",
406284
"outputs_to_install": [
407-
"out",
408-
"man"
285+
"man",
286+
"out"
409287
],
410288
"outputs": {
411289
"info": "/nix/store/mhyxwk72p093hpv563cj1rmbpfmhpw8a-gcc-wrapper-11.3.0-info",
@@ -557,8 +435,8 @@
557435
"unfree": false,
558436
"version": "4.4",
559437
"outputs_to_install": [
560-
"out",
561-
"man"
438+
"man",
439+
"out"
562440
],
563441
"outputs": {
564442
"info": "/nix/store/xjpcray0p1zrpa9sadjcp7d7nzzlv21i-gnumake-4.4-info",
@@ -590,8 +468,8 @@
590468
"unfree": false,
591469
"version": "4.4",
592470
"outputs_to_install": [
593-
"out",
594-
"man"
471+
"man",
472+
"out"
595473
],
596474
"outputs": {
597475
"debug": "/nix/store/37a9n7r9zn3szhgz9dgr2n7h2bwhs715-gnumake-4.4-debug",
@@ -624,8 +502,8 @@
624502
"unfree": false,
625503
"version": "4.4",
626504
"outputs_to_install": [
627-
"out",
628-
"man"
505+
"man",
506+
"out"
629507
],
630508
"outputs": {
631509
"info": "/nix/store/6z4zn7r258b5h3hqi8z9pb6vlib19mfh-gnumake-4.4-info",
@@ -657,8 +535,8 @@
657535
"unfree": false,
658536
"version": "4.4",
659537
"outputs_to_install": [
660-
"out",
661-
"man"
538+
"man",
539+
"out"
662540
],
663541
"outputs": {
664542
"debug": "/nix/store/frnlf8flm2q084dcgm1vvkgap4j7wkw3-gnumake-4.4-debug",

.flox/env/manifest.toml

+8-53
Original file line numberDiff line numberDiff line change
@@ -1,68 +1,23 @@
1-
#
2-
# This is a Flox environment manifest.
3-
# Visit flox.dev/docs/concepts/manifest/
4-
# or see flox-edit(1), manifest.toml(5) for more information.
5-
#
6-
# Flox manifest version managed by Flox CLI
71
version = 1
82

9-
# List packages you wish to install in your environment inside
10-
# the `[install]` section.
113
[install]
124
clang-tools.pkg-path = "clang-tools"
13-
entr.pkg-path = "entr"
145
gcc.pkg-path = "gcc"
15-
gnumake.pkg-path = "gnumake"
166
gdb.pkg-path = "gdb"
7+
gnumake.pkg-path = "gnumake"
178
help2man.pkg-path = "help2man"
189

19-
# Set environment variables in the `[vars]` section. These variables may not
20-
# reference one another, and are added to the environment without first
21-
# expanding them. They are available for use in the `[profile]` and `[hook]`
22-
# scripts.
23-
[vars]
24-
# message = "Howdy"
25-
26-
# The `hook.on-activate` script is run by the *bash* shell immediately upon
27-
# activating an environment, and will not be invoked if Flox detects that the
28-
# environment has previously been activated. Variables set by the script will
29-
# be inherited by `[profile]` scripts defined below. Note that any stdout
30-
# generated by the script will be redirected to stderr.
31-
[hook]
32-
# on-activate = '''
33-
# # Set variables, create files and directories
34-
# venv_dir="$(mktemp -d)"
35-
# export venv_dir
36-
#
37-
# # Perform initialization steps, e.g. create a python venv
38-
# python -m venv "$venv_dir"
39-
# '''
40-
41-
# Scripts defined in the `[profile]` section are *sourced* by *your shell* and
42-
# inherit environment variables set in the `[vars]` section and by `[hook]` scripts.
43-
# The `profile.common` script is sourced by all shells and special care should be
44-
# taken to ensure compatibility with all shells, after which exactly one of
45-
# `profile.{bash,fish,tcsh,zsh}` is sourced by the corresponding shell.
46-
[profile]
47-
# common = '''
48-
# echo "it's gettin' flox in here"
49-
# '''
50-
51-
# The `[services]` section of the manifest allows you to define services.
52-
# Services defined here use the packages provided by the `[install]` section
53-
# and any variables you've defined in the `[vars]` section or `hook.on-activate` script.
54-
[services]
55-
# postgres.command = "postgres --config-file=pg.conf"
56-
57-
# Additional options can be set in the `[options]` section. Refer to
58-
# manifest.toml(5) for a list of available options.
5910
[options]
60-
systems = ["aarch64-darwin", "aarch64-linux", "x86_64-darwin", "x86_64-linux"]
61-
# Uncomment to disable CUDA detection.
62-
# cuda-detection = false
11+
systems = [
12+
"aarch64-darwin",
13+
"aarch64-linux",
14+
"x86_64-darwin",
15+
"x86_64-linux",
16+
]
6317

6418
[build]
6519
t3.sandbox = "pure"
20+
t3.runtime-packages = []
6621
t3.command = '''
6722
make
6823
make test

Makefile

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
21
.DEFAULT_GOAL = all
32

43
NAME = t3
4+
VERSION ?= unknown
55
PREFIX ?= /usr/local
6-
CFLAGS = -Wall -g
6+
CFLAGS = -Wall -g -DVERSION='"$(VERSION)"'
77

88
BINDIR = $(PREFIX)/bin
99
BIN = $(NAME)
@@ -42,6 +42,9 @@ install: $(INSTBIN) $(INSTMAN1)
4242
lint: $(BIN).c
4343
clang-tidy $< -- $(CFLAGS)
4444

45+
format: $(BIN).c
46+
clang-format -i $<
47+
4548
clean:
4649
-rm -f $(BIN) $(MAN1)
4750

t3.c

+10-1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,15 @@
2020
* to the provided filename and to its own stdout and stderr streams.
2121
*/
2222

23+
/*
24+
* Include <TargetConditionals.h> to address error:
25+
* 'TARGET_OS_IPHONE' is not defined
26+
* https://developer.apple.com/documentation/xcode/identifying-and-addressing-framework-module-issues
27+
*/
28+
#ifdef __APPLE__
29+
#include <TargetConditionals.h>
30+
#endif
31+
2332
#include <errno.h>
2433
#include <fcntl.h>
2534
#include <getopt.h>
@@ -425,7 +434,7 @@ int main(int argc, char *argv[]) {
425434
usage(EXIT_SUCCESS);
426435
break;
427436
case 'v':
428-
printf("t3 version 1.0\n");
437+
puts(VERSION);
429438
exit(EXIT_SUCCESS);
430439
case 'x':
431440
debuglevel++;

0 commit comments

Comments
 (0)