summaryrefslogtreecommitdiff
path: root/README.md
blob: baa706fda21d5182acecb3f5cbb9d81005572319 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
# cScm Configuration Daemon

**cScm** Configuration Daemon – is a tool to convert SCM configuration files into binary format and store its in shared memory
for reading by **cSvn-ui** and **cGit-ui** CGI scripts.


## Reqired packages

**cScm** daemon depends on [libpcre2-32](https://www.pcre.org/) library. ArchLinux distribution has the **pcre2** binary package.
On RPM based systems you can find somethink like **pcre2-devel** RPM.


## Installation

The **cScm** package provides a regular Linux daemon with control scripts.


### Download Sources

To obtain sources we have to checkout its from SVN repository:

```Bash
svn checkout svn://radix.pro/cscm/tags/cscm-0.1.4 cscm-0.1.4
```
and run the bootstrap script:

```Bash
cd csvn-0.1.4
./bootstrap
```
Also **cScm** source packages are available for download on the
[Radix.pro FTP-server](https://ftp.radix.pro/pub/cscm/).


#### Bootstrap Script

The *bootstrap* script especialy created for *Autotools* install automation. To install
*Autotools* into sourse directory on build machine (i.e. when **build** == **host**) the *bootstrap*
script can be run without arguments.

```Bash
./bootstrap
```

I this case *Autotools* will be installed from current root file system.

For the cross environment the `--target-dest-dir` option allows to install some stuff from
development root file system:

```Bash
TARGET_DEST_DIR=/home/developer/prog/trunk-672/dist/.s9xx-glibc/enybox-x2 \
       ./bootstrap --target-dest-dir=${TARGET_DEST_DIR}
```

For example, in this case the *aclocal.m4* script will be collected from the
`${TARGET_DEST_DIR}/usr/share/aclocal` directory.


### Configuring Sources

```Bash
./configure --prefix=/usr \
            --sysconfdir=/etc \
            --with-controldir=/etc/rc.d \
            --with-logrotatedir=/etc/logrotate.d \
            --with-homepath=/var/lib \
            --with-logdir=/var/log \
            --with-piddir=/var/run
```


#### Install on the Build Machine

```Bash
make
make install
```


#### Cross Compilation Example

```Bash
#!/bin/sh

TARGET_DEST_DIR=/home/developer/prog/trunk-672/dist/.s9xx-glibc/enybox-x2
TOOLCHAIN_PATH=/opt/toolchains/aarch64-S9XX-linux-glibc/1.1.4/bin
TARGET=aarch64-s9xx-linux-gnu

./bootstrap --target-dest-dir=${TARGET_DEST_DIR}

PKG_CONFIG=/usr/bin/pkg-config \
PKG_CONFIG_PATH=${TARGET_DEST_DIR}/usr/lib${LIBDIRSUFFIX}/pkgconfig:${TARGET_DEST_DIR}/usr/share/pkgconfig \
PKG_CONFIG_LIBDIR=${TARGET_DEST_DIR}/usr/lib${LIBDIRSUFFIX}/pkgconfig:${TARGET_DEST_DIR}/usr/share/pkgconfig \
STRIP="${TOOLCHAIN_PATH}/${TARGET}-strip" \
CC="${TOOLCHAIN_PATH}/${TARGET}-gcc --sysroot=${TARGET_DEST_DIR}" \
./configure --prefix=/usr
  --build=x86_64-pc-linux-gnu \
  --host=${TARGET} \
  --sysconfdir=/etc \
  --with-controldir=/etc/rc.d \
  --with-logrotatedir=/etc/logrotate.d \
  --with-homepath=/var/lib \
  --with-logdir=/var/log \
  --with-piddir=/var/run

make
make install DESTDIR=${TARGET_DEST_DIR}
```

Also we can make use of additional variables such as `CFLAGS`, `LDFLAGS`:

```Bash
LDFLAGS="-L${TARGET_DEST_DIR}/lib -L${TARGET_DEST_DIR}/usr/lib"
TARGET_INCPATH="-L${TARGET_DEST_DIR}/usr/include"
CFLAGS="${TARGET_INCPATH}"
CPPFLAGS="${TARGET_INCPATH}"
```

### Post Install

To run **cScm** daemon for some SCM engine we have to make control scripts executable:

```Bash
chmod a+x /etc/rc.d/rc.csvnd
chmod a+x /etc/rc.d/rc.cgitd
```

If you want to run the **cscmd** daemons on boot time then on systems with BSD-like initialization such as **Slackware** we have
to add following lines to the */etc/rc.d/rc.M* and */etc/rc.d/rc.6* scripts correspondengly:

**/etc/rc.d/rc.M:**

```Bash
# Start cSvn SCM daemon:
if [ -x /etc/rc.d/rc.csvnd ]; then
  /etc/rc.d/rc.csvnd start
fi

# Start cGit SCM daemon:
if [ -x /etc/rc.d/rc.cgitd ]; then
  /etc/rc.d/rc.cgitd start
fi
```

**/etc/rc.d/rc.6:**

```Bash
# Stop cSvn SCM daemon:
if [ -x /etc/rc.d/rc.csvnd ]; then
  /etc/rc.d/rc.csvnd stop
fi

# Stop cGit SCM daemon:
if [ -x /etc/rc.d/rc.cgitd ]; then
  /etc/rc.d/rc.cgitd stop
fi
```

For systems which uses systemd initialization you have to setup your own systemd unit like following:

**/etc/systemd/system/csvnd.service:**

```ini
[Unit]
Description=The cSvn daemon
After=network.target

[Service]
PIDFile=/var/run/csvnd.pid
ExecStart=/usr/sbin/cscmd --daemonize --inotify --scm=svn --pid=/var/run/csvnd.pid --log=/var/log/csvnd.log --config=/etc/csvn-ui.rc
ExecReload=/bin/kill -s HUP $MAINPID
ExecStop=/bin/kill -s TERM $MAINPID

[Install]
WantedBy=multi-user.target
```

**/etc/systemd/system/cgitd.service:**

```ini
[Unit]
Description=The cGit daemon
After=network.target

[Service]
PIDFile=/var/run/cgitd.pid
ExecStart=/usr/sbin/cscmd --daemonize --inotify --scm=git --pid=/var/run/cgitd.pid --log=/var/log/cgitd.log --config=/etc/cgit-ui.rc
ExecReload=/bin/kill -s HUP $MAINPID
ExecStop=/bin/kill -s TERM $MAINPID

[Install]
WantedBy=multi-user.target
```


## Binary Packages

The instructions to build binary packages for popular Linux distributions are present in the
[**Documentation**](https://csvn.radix.pro/cscm/trunk/doc/) directory where you can find **RPM** **spec** file and also
**ArchLinux** Package Build script.


## See Also

> [**cscmd(8)**](https://csvn.radix.pro/cscm/trunk/doc/cscmd.8.md), 
> [**csvn-ui.rc(5)**](https://csvn.radix.pro/csvn-ui/trunk/doc/csvn-ui.rc.5.md), 
> [**cgit-ui.rc(5)**](https://csvn.radix.pro/cgit-ui/trunk/doc/cgit-ui.rc.5.md).


## Copyright and License

&#169; Andrey V. Kosteltsev, 2019 &#8211; 2022.<br/>
Code and documentation released under [the **Radix.pro** License](https://csvn.radix.pro/cscm/trunk/LICENSE).