1 1.1 riastrad #!/bin/sh 2 1.1 riastrad 3 1.4 riastrad # $NetBSD: radeon2netbsd,v 1.4 2024/07/02 20:09:13 riastradh Exp $ 4 1.1 riastrad # 5 1.1 riastrad # $ /path/to/radeon2netbsd > /path/to/files.radeon.new 6 1.1 riastrad # 7 1.1 riastrad # Run from the top-level Radeon source directory. 8 1.1 riastrad 9 1.1 riastrad set -Ceu 10 1.1 riastrad 11 1.2 riastrad : ${MV:=mv} 12 1.2 riastrad 13 1.1 riastrad # Location of the Radeon sources relative to $NETBSDSRCDIR. 14 1.1 riastrad radeon_top=external/bsd/drm2/dist/drm/radeon 15 1.1 riastrad 16 1.1 riastrad # config(5) flag for the Radeon driver. 17 1.1 riastrad radeon_flag=radeon 18 1.1 riastrad 19 1.1 riastrad env CONFIG_ACPI=y \ 20 1.4 riastrad env CONFIG_DRM_FBDEV_EMULATION=y \ 21 1.4 riastrad env CONFIG_DRM_RADEON=y \ 22 1.4 riastrad env CONFIG_MMU_NOTIFIER=y \ 23 1.4 riastrad env CONFIG_VGA_SWITCHEROO=y \ 24 1.1 riastrad env src=. \ 25 1.1 riastrad make -f Makefile -V '$(radeon-y)' \ 26 1.1 riastrad | tr ' ' '\n' \ 27 1.3 riastrad | grep -v -e '^[[:space:]]*$' \ 28 1.1 riastrad | sed -e 's,\.o$,.c,' \ 29 1.1 riastrad | sort -u \ 30 1.2 riastrad | awk ' 31 1.2 riastrad BEGIN { 32 1.2 riastrad duplicates = 0 33 1.2 riastrad } 34 1.2 riastrad { 35 1.2 riastrad if (index($1, "/")) { 36 1.2 riastrad dir = $1 37 1.2 riastrad sub("/[^/]*$", "/", dir) 38 1.2 riastrad base = $1 39 1.2 riastrad sub("^.*/", "", base) 40 1.2 riastrad } else { 41 1.2 riastrad dir = "" 42 1.2 riastrad base = $1 43 1.2 riastrad } 44 1.2 riastrad fqbase = (base ~ "^radeon_" ? "" : "radeon_") base 45 1.2 riastrad if (seen[fqbase]) { 46 1.2 riastrad printf("Duplicate basename: %s %s\n", fqbase, 47 1.2 riastrad seen[fqbase]) >"/dev/stderr" 48 1.2 riastrad duplicates = 1 49 1.2 riastrad } 50 1.2 riastrad if (duplicates) 51 1.2 riastrad next 52 1.2 riastrad printf("%s %s\n", $1, dir fqbase) 53 1.2 riastrad } 54 1.2 riastrad END { 55 1.2 riastrad if (duplicates) { 56 1.2 riastrad printf("Time to rewite me!\n") > "/dev/stderr" 57 1.2 riastrad exit 1 58 1.2 riastrad } 59 1.2 riastrad } 60 1.2 riastrad ' \ 61 1.2 riastrad | while read from to; do 62 1.2 riastrad # If the move already happened, that's fine: the makefile 63 1.2 riastrad # detects duplicates. 64 1.2 riastrad if [ "x$from" != "x$to" -a \! -f "$to" ]; then 65 1.2 riastrad ${MV} -f -- "$from" "$to" 66 1.2 riastrad fi 67 1.2 riastrad printf 'file\t%s\t%s\n' "$radeon_top/$to" "$radeon_flag" 68 1.2 riastrad done \ 69 1.2 riastrad | sort -u 70