Skip to content

Commit

Permalink
Build Updates
Browse files Browse the repository at this point in the history
This is a series of updates to make building magic far less of a headache:

* Drop `csh`/`tcsh` dependency and detection from `./configure`.
* Rewrite makedbh in Python.
* Rewrite printmans in POSIX sh.
* Stop deleting Depend before every compile (which causes some files to recompile and thus increases recompile times significantly)
* Add Depend to CLEANS in scripts/defs.mak.in
* Turn POSIX suffix rule in magic/rules.mak to a pattern rule with proper prerequisites
  • Loading branch information
donn authored and RTimothyEdwards committed Aug 25, 2023
1 parent cb00ede commit 02e16b8
Show file tree
Hide file tree
Showing 11 changed files with 115 additions and 268 deletions.
7 changes: 3 additions & 4 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ jobs:
steps:
- name: Pulling the docker image
run: docker pull vezzal/vezzal:v1

- name: Start the container with the docker image
run: docker run -id --name test_magic vezzal/vezzal:v1 bash | exit

- name: Run the testing on the container and send the mail
run: docker exec test_magic /vezzal/test_magic.sh "lankasaicharan123@gmail.com,tim@opencircuitdesign.com" ${{secrets.MAILING_KEY}}
simple_build_linux:
Expand All @@ -29,7 +29,7 @@ jobs:
- uses: actions/checkout@v2
- name: Get Dependencies
run: |
sudo apt-get install -y tcl-dev tk-dev libcairo-dev csh
sudo apt-get install -y tcl-dev tk-dev libcairo-dev
- name: Build
run: |
./configure
Expand All @@ -41,7 +41,6 @@ jobs:
- uses: actions/checkout@v2
- name: Get Dependencies
run: |
sudo apt-get install -y csh
git clone https://github.com/emscripten-core/emsdk.git
cd emsdk
./emsdk install latest
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,4 @@ magic/tclmagic.dylib
tcltk/magicdnull.dSYM/
tcltk/magicexec.dSYM/
reconfigure.sh
pfx/
2 changes: 1 addition & 1 deletion INSTALL_MacOS.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Get [Homebrew](https://brew.sh).

```sh
brew install cairo tcl-tk tcsh
brew install cairo tcl-tk
brew install --cask xquartz
./scripts/configure_mac
make database/database.h
Expand Down
1 change: 0 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ libs:

depend: database/database.h
@echo --- making dependencies
${RM} */Depend
for dir in ${MODULES} ${UNUSED_MODULES} ${PROGRAMS}; do \
(cd $$dir && ${MAKE} depend) || exit 1; done

Expand Down
5 changes: 2 additions & 3 deletions rules.mak
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,12 @@ depend: ${DEPEND_FILE}

${DEPEND_FILE}:
${CC} ${CFLAGS} ${CPPFLAGS} ${DFLAGS} ${DEPEND_FLAG} ${DEPSRCS} | \
sed -e "/#/D" -e "/ \//s/ \/.*\.h//" -e "/ \\\/D" \
> ${DEPEND_FILE}
sed -e "/#/D" -e "/ \//s/ \/.*\.h//" -e "/ \\\/D" > ${DEPEND_FILE}

# Original Depend file generating line:
# ${CC} ${CFLAGS} ${CPPFLAGS} ${DFLAGS} ${DEPEND_FLAG} ${SRCS} > ${DEPEND_FILE}

.c.o: ../database/database.h
${OBJS}: %.o: ${SRCS} ../database/database.h
@echo --- compiling ${MODULE}/$*.o
${RM} $*.o
${CC} ${CFLAGS} ${CPPFLAGS} ${DFLAGS} -c $*.c
Expand Down
1 change: 1 addition & 0 deletions scripts/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
autom4te.cache/
63 changes: 2 additions & 61 deletions scripts/configure
Original file line number Diff line number Diff line change
Expand Up @@ -673,7 +673,6 @@ X_PRE_LIBS
X_CFLAGS
XMKMF
PYTHON3
CSH
GCORE
EGREP
GREP
Expand Down Expand Up @@ -723,7 +722,6 @@ infodir
docdir
oldincludedir
includedir
runstatedir
localstatedir
sharedstatedir
sysconfdir
Expand Down Expand Up @@ -829,7 +827,6 @@ datadir='${datarootdir}'
sysconfdir='${prefix}/etc'
sharedstatedir='${prefix}/com'
localstatedir='${prefix}/var'
runstatedir='${localstatedir}/run'
includedir='${prefix}/include'
oldincludedir='/usr/include'
docdir='${datarootdir}/doc/${PACKAGE}'
Expand Down Expand Up @@ -1082,15 +1079,6 @@ do
| -silent | --silent | --silen | --sile | --sil)
silent=yes ;;

-runstatedir | --runstatedir | --runstatedi | --runstated \
| --runstate | --runstat | --runsta | --runst | --runs \
| --run | --ru | --r)
ac_prev=runstatedir ;;
-runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \
| --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \
| --run=* | --ru=* | --r=*)
runstatedir=$ac_optarg ;;

-sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
ac_prev=sbindir ;;
-sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
Expand Down Expand Up @@ -1228,7 +1216,7 @@ fi
for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \
datadir sysconfdir sharedstatedir localstatedir includedir \
oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
libdir localedir mandir runstatedir
libdir localedir mandir
do
eval ac_val=\$$ac_var
# Remove trailing slashes.
Expand Down Expand Up @@ -1381,7 +1369,6 @@ Fine tuning of the installation directories:
--sysconfdir=DIR read-only single-machine data [PREFIX/etc]
--sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com]
--localstatedir=DIR modifiable single-machine data [PREFIX/var]
--runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run]
--libdir=DIR object code libraries [EPREFIX/lib]
--includedir=DIR C header files [PREFIX/include]
--oldincludedir=DIR C header files for non-gcc [/usr/include]
Expand Down Expand Up @@ -5340,53 +5327,6 @@ fi




# Extract the first word of "csh", so it can be a program name with args.
set dummy csh; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_path_CSH+:} false; then :
$as_echo_n "(cached) " >&6
else
case $CSH in
[\\/]* | ?:[\\/]*)
ac_cv_path_CSH="$CSH" # Let the user override the test with a path.
;;
*)
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_path_CSH="$as_dir/$ac_word$ac_exec_ext"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS

test -z "$ac_cv_path_CSH" && ac_cv_path_CSH="no"
;;
esac
fi
CSH=$ac_cv_path_CSH
if test -n "$CSH"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CSH" >&5
$as_echo "$CSH" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi



if test "x${CSH}" = "xno"; then
as_fn_error $? "cannot find /bin/csh---cannot compile!" "$LINENO" 5
fi

# Extract the first word of "python3", so it can be a program name with args.
set dummy python3; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
Expand Down Expand Up @@ -7794,6 +7734,7 @@ case $target in
;;
*-emscripten*)
$as_echo "#define linux 1" >>confdefs.h

CFLAGS="${CFLAGS} -fPIC -Werror=implicit-function-declaration -Wno-int-conversion -Wno-implicit-int"
;;
*solaris*)
Expand Down
10 changes: 0 additions & 10 deletions scripts/configure.in
Original file line number Diff line number Diff line change
Expand Up @@ -290,16 +290,6 @@ dnl Check for gcore, used by niceabort.c

AC_PATH_PROG(GCORE, gcore, [no])

dnl Check for /bin/csh; warn if not available. We should do something
dnl here to get makedbh to run under other common conditions, such as
dnl csh not being in /bin, or only tcsh being available.

AC_PATH_PROG(CSH, csh, [no])

if test "x${CSH}" = "xno"; then
AC_MSG_ERROR([cannot find /bin/csh---cannot compile!])
fi

dnl Python3 is preferred for running the preprocessor script
dnl but CPP can be used instead.
AC_PATH_PROG([PYTHON3], [python3], [no])
Expand Down
2 changes: 1 addition & 1 deletion scripts/defs.mak.in
Original file line number Diff line number Diff line change
Expand Up @@ -105,4 +105,4 @@ OA_LIBS = @OA_LIBS@
DEPSRCS = ${SRCS}
OBJS = ${SRCS:.c=.o} ${CXXSRCS:.cpp=.o}
LIB_OBJS = ${LIB_SRCS:.c=.o}
CLEANS = ${OBJS} ${LIB_OBJS} lib${MODULE}.a lib${MODULE}.o ${MODULE}
CLEANS = Depend ${OBJS} ${LIB_OBJS} lib${MODULE}.a lib${MODULE}.o ${MODULE}
Loading

0 comments on commit 02e16b8

Please sign in to comment.