Skip to content

Commit

Permalink
MacOSX support: replace use of GNU extensions of command line utiliti…
Browse files Browse the repository at this point in the history
…es with standard Posix

Also replace symlinks with hardlinks for zip file generation.

This is not actually an incompatible change and could well be
integrated into master. I am reluctant to do that, though, since
the increased readability of the GNU style is rather attractive.
  • Loading branch information
tkoeppe committed Jan 14, 2021
1 parent 6584886 commit eecb8c0
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 19 deletions.
8 changes: 4 additions & 4 deletions BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -698,7 +698,7 @@ genrule(
" A=$$(dirname $$s); " +
" B=$${A/assets/}; " +
" mkdir -p $(@D)/baselab$${B}; " +
" ln -s -L -t $(@D)/baselab$${B} $$($(location //deepmind/support:realpath) $${s}); " +
" ln -s $$($(location //deepmind/support:realpath) $${s}) $(@D)/baselab$${B}; " +
"done",
tools = ["//deepmind/support:realpath"],
visibility = ["//visibility:public"],
Expand All @@ -716,7 +716,7 @@ genrule(
cmd = "for s in $(SRCS); do " +
" A=$$(dirname $$s); " +
" mkdir -p $(@D)/baselab/$${A}; " +
" ln -s -L -t $(@D)/baselab/$${A} $$($(location //deepmind/support:realpath) $${s}); " +
" ln -s $$($(location //deepmind/support:realpath) $${s}) $(@D)/baselab/$${A}; " +
"done",
tools = ["//deepmind/support:realpath"],
visibility = ["//visibility:public"],
Expand All @@ -733,7 +733,7 @@ genrule(
outs = ["baselab/maps" + f[len("assets/maps/built"):] for f in BUILT_MAPS],
cmd = "for s in $(SRCS); do " +
" mkdir -p $(@D)/baselab/maps; " +
" ln -s -L -t $(@D)/baselab/maps $$($(location //deepmind/support:realpath) $${s}); " +
" ln -s $$($(location //deepmind/support:realpath) $${s}) $(@D)/baselab/maps; " +
"done",
tools = ["//deepmind/support:realpath"],
visibility = ["//visibility:public"],
Expand Down Expand Up @@ -784,7 +784,7 @@ genrule(
CODE_DIR + "/q3_ui/ui.qvm",
],
outs = ["baselab/vm.pk3"],
cmd = "A=$$(pwd); mkdir $(@D)/vm; ln -s -r -t $(@D)/vm -- $(SRCS); (cd $(@D); zip --quiet -r $${A}/$(OUTS) -- vm)",
cmd = "A=$$(pwd); mkdir $(@D)/vm; ln $(SRCS) $(@D)/vm; (cd $(@D); zip --quiet -r $${A}/$(OUTS) vm)",
visibility = ["//testing:__subpackages__"],
)

Expand Down
4 changes: 2 additions & 2 deletions bazel/libxml.BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ genrule(
"include/libxml/xmlversion.h",
],
cmd = "./$(location configure) --silent --without-lzma " +
"&& cp --verbose -- config.h $(location config.h) " +
"&& cp --verbose -- include/libxml/xmlversion.h $(location include/libxml/xmlversion.h)",
"&& cp config.h $(location config.h) " +
"&& cp include/libxml/xmlversion.h $(location include/libxml/xmlversion.h)",
)

cc_library(
Expand Down
26 changes: 13 additions & 13 deletions deepmind/level_generation/compile_map.sh
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,9 @@ readonly MPF="$(basename "${MAPBASE}")"
readonly MPB="${MPF/.map/}"

if [[ -n $MAP_LOCATION ]]; then
mkdir --parents -- "${DIR}"
cp --force -- "${MAP_LOCATION}" "${MAPBASE}.map"
chmod 660 -- "${MAPBASE}.map"
mkdir -p "${DIR}"
cp --force "${MAP_LOCATION}" "${MAPBASE}.map"
chmod 660 "${MAPBASE}.map"
fi

function die {
Expand All @@ -94,7 +94,7 @@ check_exe "${BSPC}" "bspc"
## Main logic

function clean_up {
rm --force -- "${DIR}/${MPB}."{bsp,map,prt,srf}
rm -f "${DIR}/${MPB}."{bsp,map,prt,srf}
}

# Step 1: q3map2 to generate the BSP
Expand All @@ -113,23 +113,23 @@ fi

# Step 3: Zip .bsp and .aas into a .pk3 archive.

mkdir --parents -- "${DIR}/maps"
mkdir -p "${DIR}/maps"
if [[ $GENERATE_AAS = true ]]; then
mv --target-directory="${DIR}/maps" -- "${DIR}/${MPB}.bsp" "${DIR}/${MPB}.aas"
mv "${DIR}/${MPB}.bsp" "${DIR}/${MPB}.aas" "${DIR}/maps"
else
mv --target-directory="${DIR}/maps" -- "${DIR}/${MPB}.bsp"
mv "${DIR}/${MPB}.bsp" "${DIR}/maps"
fi

rm -f -- "${DIR}/${MPB}.pk3"
rm -f "${DIR}/${MPB}.pk3"
if [[ $GENERATE_AAS = true ]]; then
(cd -- "${DIR}" && zip "${MPB}.pk3" -- "maps/${MPB}.bsp" "maps/${MPB}.aas")
rm -- "${DIR}/maps/${MPB}.bsp" "${DIR}/maps/${MPB}.aas"
(cd "${DIR}" && zip "${MPB}.pk3" "maps/${MPB}.bsp" "maps/${MPB}.aas")
rm "${DIR}/maps/${MPB}.bsp" "${DIR}/maps/${MPB}.aas"
else
(cd -- "${DIR}" && zip "${MPB}.pk3" -- "maps/${MPB}.bsp")
rm -- "${DIR}/maps/${MPB}.bsp"
(cd "${DIR}" && zip "${MPB}.pk3" "maps/${MPB}.bsp")
rm "${DIR}/maps/${MPB}.bsp"
fi

rmdir -- "${DIR}/maps"
rmdir "${DIR}/maps"
clean_up

# Done!
Expand Down

0 comments on commit eecb8c0

Please sign in to comment.